{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Ggit.Callbacks
    ( 

 -- * Signals
-- ** ConfigCallback #signal:ConfigCallback#
    C_ConfigCallback                        ,
    ConfigCallback                          ,
    ConfigCallback_WithClosures             ,
    drop_closures_ConfigCallback            ,
    dynamic_ConfigCallback                  ,
    genClosure_ConfigCallback               ,
    mk_ConfigCallback                       ,
    noConfigCallback                        ,
    noConfigCallback_WithClosures           ,
    wrap_ConfigCallback                     ,


-- ** ConfigMatchCallback #signal:ConfigMatchCallback#
    C_ConfigMatchCallback                   ,
    ConfigMatchCallback                     ,
    ConfigMatchCallback_WithClosures        ,
    drop_closures_ConfigMatchCallback       ,
    dynamic_ConfigMatchCallback             ,
    genClosure_ConfigMatchCallback          ,
    mk_ConfigMatchCallback                  ,
    noConfigMatchCallback                   ,
    noConfigMatchCallback_WithClosures      ,
    wrap_ConfigMatchCallback                ,


-- ** CredAcquireCallback #signal:CredAcquireCallback#
    C_CredAcquireCallback                   ,
    CredAcquireCallback                     ,
    CredAcquireCallback_WithClosures        ,
    drop_closures_CredAcquireCallback       ,
    dynamic_CredAcquireCallback             ,
    genClosure_CredAcquireCallback          ,
    mk_CredAcquireCallback                  ,
    noCredAcquireCallback                   ,
    noCredAcquireCallback_WithClosures      ,
    wrap_CredAcquireCallback                ,


-- ** DiffBinaryCallback #signal:DiffBinaryCallback#
    C_DiffBinaryCallback                    ,
    DiffBinaryCallback                      ,
    DiffBinaryCallback_WithClosures         ,
    drop_closures_DiffBinaryCallback        ,
    dynamic_DiffBinaryCallback              ,
    genClosure_DiffBinaryCallback           ,
    mk_DiffBinaryCallback                   ,
    noDiffBinaryCallback                    ,
    noDiffBinaryCallback_WithClosures       ,
    wrap_DiffBinaryCallback                 ,


-- ** DiffFileCallback #signal:DiffFileCallback#
    C_DiffFileCallback                      ,
    DiffFileCallback                        ,
    DiffFileCallback_WithClosures           ,
    drop_closures_DiffFileCallback          ,
    dynamic_DiffFileCallback                ,
    genClosure_DiffFileCallback             ,
    mk_DiffFileCallback                     ,
    noDiffFileCallback                      ,
    noDiffFileCallback_WithClosures         ,
    wrap_DiffFileCallback                   ,


-- ** DiffHunkCallback #signal:DiffHunkCallback#
    C_DiffHunkCallback                      ,
    DiffHunkCallback                        ,
    DiffHunkCallback_WithClosures           ,
    drop_closures_DiffHunkCallback          ,
    dynamic_DiffHunkCallback                ,
    genClosure_DiffHunkCallback             ,
    mk_DiffHunkCallback                     ,
    noDiffHunkCallback                      ,
    noDiffHunkCallback_WithClosures         ,
    wrap_DiffHunkCallback                   ,


-- ** DiffLineCallback #signal:DiffLineCallback#
    C_DiffLineCallback                      ,
    DiffLineCallback                        ,
    DiffLineCallback_WithClosures           ,
    drop_closures_DiffLineCallback          ,
    dynamic_DiffLineCallback                ,
    genClosure_DiffLineCallback             ,
    mk_DiffLineCallback                     ,
    noDiffLineCallback                      ,
    noDiffLineCallback_WithClosures         ,
    wrap_DiffLineCallback                   ,


-- ** DiffSimilarityMetricBufferSignatureCallback #signal:DiffSimilarityMetricBufferSignatureCallback#
    C_DiffSimilarityMetricBufferSignatureCallback,
    DiffSimilarityMetricBufferSignatureCallback,
    DiffSimilarityMetricBufferSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricBufferSignatureCallback,
    dynamic_DiffSimilarityMetricBufferSignatureCallback,
    genClosure_DiffSimilarityMetricBufferSignatureCallback,
    mk_DiffSimilarityMetricBufferSignatureCallback,
    noDiffSimilarityMetricBufferSignatureCallback,
    noDiffSimilarityMetricBufferSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricBufferSignatureCallback,


-- ** DiffSimilarityMetricFileSignatureCallback #signal:DiffSimilarityMetricFileSignatureCallback#
    C_DiffSimilarityMetricFileSignatureCallback,
    DiffSimilarityMetricFileSignatureCallback,
    DiffSimilarityMetricFileSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricFileSignatureCallback,
    dynamic_DiffSimilarityMetricFileSignatureCallback,
    genClosure_DiffSimilarityMetricFileSignatureCallback,
    mk_DiffSimilarityMetricFileSignatureCallback,
    noDiffSimilarityMetricFileSignatureCallback,
    noDiffSimilarityMetricFileSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricFileSignatureCallback,


-- ** DiffSimilarityMetricFreeSignatureCallback #signal:DiffSimilarityMetricFreeSignatureCallback#
    C_DiffSimilarityMetricFreeSignatureCallback,
    DiffSimilarityMetricFreeSignatureCallback,
    DiffSimilarityMetricFreeSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricFreeSignatureCallback,
    dynamic_DiffSimilarityMetricFreeSignatureCallback,
    genClosure_DiffSimilarityMetricFreeSignatureCallback,
    mk_DiffSimilarityMetricFreeSignatureCallback,
    noDiffSimilarityMetricFreeSignatureCallback,
    noDiffSimilarityMetricFreeSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricFreeSignatureCallback,


-- ** DiffSimilarityMetricSimilarityCallback #signal:DiffSimilarityMetricSimilarityCallback#
    C_DiffSimilarityMetricSimilarityCallback,
    DiffSimilarityMetricSimilarityCallback  ,
    DiffSimilarityMetricSimilarityCallback_WithClosures,
    drop_closures_DiffSimilarityMetricSimilarityCallback,
    dynamic_DiffSimilarityMetricSimilarityCallback,
    genClosure_DiffSimilarityMetricSimilarityCallback,
    mk_DiffSimilarityMetricSimilarityCallback,
    noDiffSimilarityMetricSimilarityCallback,
    noDiffSimilarityMetricSimilarityCallback_WithClosures,
    wrap_DiffSimilarityMetricSimilarityCallback,


-- ** NoteCallback #signal:NoteCallback#
    C_NoteCallback                          ,
    NoteCallback                            ,
    NoteCallback_WithClosures               ,
    drop_closures_NoteCallback              ,
    dynamic_NoteCallback                    ,
    genClosure_NoteCallback                 ,
    mk_NoteCallback                         ,
    noNoteCallback                          ,
    noNoteCallback_WithClosures             ,
    wrap_NoteCallback                       ,


-- ** ReferencesCallback #signal:ReferencesCallback#
    C_ReferencesCallback                    ,
    ReferencesCallback                      ,
    ReferencesCallback_WithClosures         ,
    drop_closures_ReferencesCallback        ,
    dynamic_ReferencesCallback              ,
    genClosure_ReferencesCallback           ,
    mk_ReferencesCallback                   ,
    noReferencesCallback                    ,
    noReferencesCallback_WithClosures       ,
    wrap_ReferencesCallback                 ,


-- ** ReferencesNameCallback #signal:ReferencesNameCallback#
    C_ReferencesNameCallback                ,
    ReferencesNameCallback                  ,
    ReferencesNameCallback_WithClosures     ,
    drop_closures_ReferencesNameCallback    ,
    dynamic_ReferencesNameCallback          ,
    genClosure_ReferencesNameCallback       ,
    mk_ReferencesNameCallback               ,
    noReferencesNameCallback                ,
    noReferencesNameCallback_WithClosures   ,
    wrap_ReferencesNameCallback             ,


-- ** RemoteListCallback #signal:RemoteListCallback#
    C_RemoteListCallback                    ,
    RemoteListCallback                      ,
    RemoteListCallback_WithClosures         ,
    drop_closures_RemoteListCallback        ,
    dynamic_RemoteListCallback              ,
    genClosure_RemoteListCallback           ,
    mk_RemoteListCallback                   ,
    noRemoteListCallback                    ,
    noRemoteListCallback_WithClosures       ,
    wrap_RemoteListCallback                 ,


-- ** StashCallback #signal:StashCallback#
    C_StashCallback                         ,
    StashCallback                           ,
    StashCallback_WithClosures              ,
    drop_closures_StashCallback             ,
    dynamic_StashCallback                   ,
    genClosure_StashCallback                ,
    mk_StashCallback                        ,
    noStashCallback                         ,
    noStashCallback_WithClosures            ,
    wrap_StashCallback                      ,


-- ** StatusCallback #signal:StatusCallback#
    C_StatusCallback                        ,
    StatusCallback                          ,
    StatusCallback_WithClosures             ,
    drop_closures_StatusCallback            ,
    dynamic_StatusCallback                  ,
    genClosure_StatusCallback               ,
    mk_StatusCallback                       ,
    noStatusCallback                        ,
    noStatusCallback_WithClosures           ,
    wrap_StatusCallback                     ,


-- ** SubmoduleCallback #signal:SubmoduleCallback#
    C_SubmoduleCallback                     ,
    SubmoduleCallback                       ,
    SubmoduleCallback_WithClosures          ,
    drop_closures_SubmoduleCallback         ,
    dynamic_SubmoduleCallback               ,
    genClosure_SubmoduleCallback            ,
    mk_SubmoduleCallback                    ,
    noSubmoduleCallback                     ,
    noSubmoduleCallback_WithClosures        ,
    wrap_SubmoduleCallback                  ,


-- ** TagCallback #signal:TagCallback#
    C_TagCallback                           ,
    TagCallback                             ,
    TagCallback_WithClosures                ,
    drop_closures_TagCallback               ,
    dynamic_TagCallback                     ,
    genClosure_TagCallback                  ,
    mk_TagCallback                          ,
    noTagCallback                           ,
    noTagCallback_WithClosures              ,
    wrap_TagCallback                        ,


-- ** TransferProgressCallback #signal:TransferProgressCallback#
    C_TransferProgressCallback              ,
    TransferProgressCallback                ,
    TransferProgressCallback_WithClosures   ,
    drop_closures_TransferProgressCallback  ,
    dynamic_TransferProgressCallback        ,
    genClosure_TransferProgressCallback     ,
    mk_TransferProgressCallback             ,
    noTransferProgressCallback              ,
    noTransferProgressCallback_WithClosures ,
    wrap_TransferProgressCallback           ,


-- ** TreeWalkCallback #signal:TreeWalkCallback#
    C_TreeWalkCallback                      ,
    TreeWalkCallback                        ,
    TreeWalkCallback_WithClosures           ,
    drop_closures_TreeWalkCallback          ,
    dynamic_TreeWalkCallback                ,
    genClosure_TreeWalkCallback             ,
    mk_TreeWalkCallback                     ,
    noTreeWalkCallback                      ,
    noTreeWalkCallback_WithClosures         ,
    wrap_TreeWalkCallback                   ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GLib.Structs.MatchInfo as GLib.MatchInfo
import {-# SOURCE #-} qualified GI.Ggit.Flags as Ggit.Flags
import {-# SOURCE #-} qualified GI.Ggit.Objects.Cred as Ggit.Cred
import {-# SOURCE #-} qualified GI.Ggit.Objects.Ref as Ggit.Ref
import {-# SOURCE #-} qualified GI.Ggit.Structs.ConfigEntry as Ggit.ConfigEntry
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffBinary as Ggit.DiffBinary
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffDelta as Ggit.DiffDelta
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffFile as Ggit.DiffFile
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffHunk as Ggit.DiffHunk
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffLine as Ggit.DiffLine
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId
import {-# SOURCE #-} qualified GI.Ggit.Structs.Submodule as Ggit.Submodule
import {-# SOURCE #-} qualified GI.Ggit.Structs.TransferProgress as Ggit.TransferProgress
import {-# SOURCE #-} qualified GI.Ggit.Structs.TreeEntry as Ggit.TreeEntry

-- callback TreeWalkCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next entry or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "root", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the current (relative) root of the entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "TreeEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tree entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for walking a tree.\nSee ggit_tree_walk().", sinceVersion = Nothing}}
type C_TreeWalkCallback =
    CString ->
    Ptr Ggit.TreeEntry.TreeEntry ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "root", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the current (relative) root of the entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "TreeEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tree entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TreeWalkCallback :: FunPtr C_TreeWalkCallback -> C_TreeWalkCallback

dynamic_TreeWalkCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TreeWalkCallback
    -> T.Text
    {- ^ /@root@/: the current (relative) root of the entry -}
    -> Ggit.TreeEntry.TreeEntry
    {- ^ /@entry@/: the tree entry -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next entry or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_TreeWalkCallback __funPtr root entry userData = liftIO $ do
    root' <- textToCString root
    entry' <- unsafeManagedPtrGetPtr entry
    result <- (__dynamic_C_TreeWalkCallback __funPtr) root' entry' userData
    touchManagedPtr entry
    freeMem root'
    return result

foreign import ccall "wrapper"
    mk_TreeWalkCallback :: C_TreeWalkCallback -> IO (FunPtr C_TreeWalkCallback)

type TreeWalkCallback =
    T.Text ->
    Ggit.TreeEntry.TreeEntry ->
    IO Int32

noTreeWalkCallback :: Maybe TreeWalkCallback
noTreeWalkCallback = Nothing

type TreeWalkCallback_WithClosures =
    T.Text ->
    Ggit.TreeEntry.TreeEntry ->
    Ptr () ->
    IO Int32

noTreeWalkCallback_WithClosures :: Maybe TreeWalkCallback_WithClosures
noTreeWalkCallback_WithClosures = Nothing

drop_closures_TreeWalkCallback :: TreeWalkCallback -> TreeWalkCallback_WithClosures
drop_closures_TreeWalkCallback _f root entry _ = _f root entry

genClosure_TreeWalkCallback :: TreeWalkCallback -> IO Closure
genClosure_TreeWalkCallback cb = do
    let cb' = drop_closures_TreeWalkCallback cb
    let cb'' = wrap_TreeWalkCallback Nothing cb'
    mk_TreeWalkCallback cb'' >>= newCClosure


wrap_TreeWalkCallback ::
    Maybe (Ptr (FunPtr C_TreeWalkCallback)) ->
    TreeWalkCallback_WithClosures ->
    CString ->
    Ptr Ggit.TreeEntry.TreeEntry ->
    Ptr () ->
    IO Int32
wrap_TreeWalkCallback funptrptr _cb root entry userData = do
    root' <- cstringToText root
    B.ManagedPtr.withTransient Ggit.TreeEntry.TreeEntry entry $ \entry' -> do
        result <- _cb  root' entry' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback TransferProgressCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "a value less than zero to cancel the transfer.", sinceVersion = Nothing}, args = [Arg {argCName = "stats", argType = TInterface (Name {namespace = "Ggit", name = "TransferProgress"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitTransferProgress.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Progress callbacks during indexing.", sinceVersion = Nothing}}
type C_TransferProgressCallback =
    Ptr Ggit.TransferProgress.TransferProgress ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "stats", argType = TInterface (Name {namespace = "Ggit", name = "TransferProgress"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitTransferProgress.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TransferProgressCallback :: FunPtr C_TransferProgressCallback -> C_TransferProgressCallback

dynamic_TransferProgressCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TransferProgressCallback
    -> Ggit.TransferProgress.TransferProgress
    {- ^ /@stats@/: a 'GI.Ggit.Structs.TransferProgress.TransferProgress'. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ a value less than zero to cancel the transfer. -}
dynamic_TransferProgressCallback __funPtr stats userData = liftIO $ do
    stats' <- unsafeManagedPtrGetPtr stats
    result <- (__dynamic_C_TransferProgressCallback __funPtr) stats' userData
    touchManagedPtr stats
    return result

foreign import ccall "wrapper"
    mk_TransferProgressCallback :: C_TransferProgressCallback -> IO (FunPtr C_TransferProgressCallback)

type TransferProgressCallback =
    Ggit.TransferProgress.TransferProgress ->
    IO Int32

noTransferProgressCallback :: Maybe TransferProgressCallback
noTransferProgressCallback = Nothing

type TransferProgressCallback_WithClosures =
    Ggit.TransferProgress.TransferProgress ->
    Ptr () ->
    IO Int32

noTransferProgressCallback_WithClosures :: Maybe TransferProgressCallback_WithClosures
noTransferProgressCallback_WithClosures = Nothing

drop_closures_TransferProgressCallback :: TransferProgressCallback -> TransferProgressCallback_WithClosures
drop_closures_TransferProgressCallback _f stats _ = _f stats

genClosure_TransferProgressCallback :: TransferProgressCallback -> IO Closure
genClosure_TransferProgressCallback cb = do
    let cb' = drop_closures_TransferProgressCallback cb
    let cb'' = wrap_TransferProgressCallback Nothing cb'
    mk_TransferProgressCallback cb'' >>= newCClosure


wrap_TransferProgressCallback ::
    Maybe (Ptr (FunPtr C_TransferProgressCallback)) ->
    TransferProgressCallback_WithClosures ->
    Ptr Ggit.TransferProgress.TransferProgress ->
    Ptr () ->
    IO Int32
wrap_TransferProgressCallback funptrptr _cb stats userData = do
    B.ManagedPtr.withTransient Ggit.TransferProgress.TransferProgress stats $ \stats' -> do
        result <- _cb  stats' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback TagCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag oid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "When iterating over all the tags, callback that will be\nissued per entry. See ggit_repository_tag_foreach().", sinceVersion = Nothing}}
type C_TagCallback =
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag oid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TagCallback :: FunPtr C_TagCallback -> C_TagCallback

dynamic_TagCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TagCallback
    -> T.Text
    {- ^ /@name@/: the tag name. -}
    -> Ggit.OId.OId
    {- ^ /@tagOid@/: the tag oid. -}
    -> Ptr ()
    {- ^ /@userData@/: user-suplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_TagCallback __funPtr name tagOid userData = liftIO $ do
    name' <- textToCString name
    tagOid' <- unsafeManagedPtrGetPtr tagOid
    result <- (__dynamic_C_TagCallback __funPtr) name' tagOid' userData
    touchManagedPtr tagOid
    freeMem name'
    return result

foreign import ccall "wrapper"
    mk_TagCallback :: C_TagCallback -> IO (FunPtr C_TagCallback)

type TagCallback =
    T.Text ->
    Ggit.OId.OId ->
    IO Int32

noTagCallback :: Maybe TagCallback
noTagCallback = Nothing

type TagCallback_WithClosures =
    T.Text ->
    Ggit.OId.OId ->
    Ptr () ->
    IO Int32

noTagCallback_WithClosures :: Maybe TagCallback_WithClosures
noTagCallback_WithClosures = Nothing

drop_closures_TagCallback :: TagCallback -> TagCallback_WithClosures
drop_closures_TagCallback _f name tagOid _ = _f name tagOid

genClosure_TagCallback :: TagCallback -> IO Closure
genClosure_TagCallback cb = do
    let cb' = drop_closures_TagCallback cb
    let cb'' = wrap_TagCallback Nothing cb'
    mk_TagCallback cb'' >>= newCClosure


wrap_TagCallback ::
    Maybe (Ptr (FunPtr C_TagCallback)) ->
    TagCallback_WithClosures ->
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32
wrap_TagCallback funptrptr _cb name tagOid userData = do
    name' <- cstringToText name
    B.ManagedPtr.withTransient Ggit.OId.OId tagOid $ \tagOid' -> do
        result <- _cb  name' tagOid' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback SubmoduleCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next submodule or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the submodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving the submodules\nin a #GgitRepository. See ggit_repository_submodule_foreach().", sinceVersion = Nothing}}
type C_SubmoduleCallback =
    Ptr Ggit.Submodule.Submodule ->
    CString ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the submodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SubmoduleCallback :: FunPtr C_SubmoduleCallback -> C_SubmoduleCallback

dynamic_SubmoduleCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_SubmoduleCallback
    -> Ggit.Submodule.Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> T.Text
    {- ^ /@name@/: the name of the submodule. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next submodule or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_SubmoduleCallback __funPtr submodule name userData = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    name' <- textToCString name
    result <- (__dynamic_C_SubmoduleCallback __funPtr) submodule' name' userData
    touchManagedPtr submodule
    freeMem name'
    return result

foreign import ccall "wrapper"
    mk_SubmoduleCallback :: C_SubmoduleCallback -> IO (FunPtr C_SubmoduleCallback)

type SubmoduleCallback =
    Ggit.Submodule.Submodule ->
    T.Text ->
    IO Int32

noSubmoduleCallback :: Maybe SubmoduleCallback
noSubmoduleCallback = Nothing

type SubmoduleCallback_WithClosures =
    Ggit.Submodule.Submodule ->
    T.Text ->
    Ptr () ->
    IO Int32

noSubmoduleCallback_WithClosures :: Maybe SubmoduleCallback_WithClosures
noSubmoduleCallback_WithClosures = Nothing

drop_closures_SubmoduleCallback :: SubmoduleCallback -> SubmoduleCallback_WithClosures
drop_closures_SubmoduleCallback _f submodule name _ = _f submodule name

genClosure_SubmoduleCallback :: SubmoduleCallback -> IO Closure
genClosure_SubmoduleCallback cb = do
    let cb' = drop_closures_SubmoduleCallback cb
    let cb'' = wrap_SubmoduleCallback Nothing cb'
    mk_SubmoduleCallback cb'' >>= newCClosure


wrap_SubmoduleCallback ::
    Maybe (Ptr (FunPtr C_SubmoduleCallback)) ->
    SubmoduleCallback_WithClosures ->
    Ptr Ggit.Submodule.Submodule ->
    CString ->
    Ptr () ->
    IO Int32
wrap_SubmoduleCallback funptrptr _cb submodule name userData = do
    B.ManagedPtr.withTransient Ggit.Submodule.Submodule submodule $ \submodule' -> do
        name' <- cstringToText name
        result <- _cb  submodule' name' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback StatusCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next file or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file to retrieve status for, rooted at the repository working dir.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "status_flags", argType = TInterface (Name {namespace = "Ggit", name = "StatusFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the status value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving the status of the files\nin a #GgitRepository. See ggit_repository_file_status_foreach().", sinceVersion = Nothing}}
type C_StatusCallback =
    CString ->
    CUInt ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file to retrieve status for, rooted at the repository working dir.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "status_flags", argType = TInterface (Name {namespace = "Ggit", name = "StatusFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the status value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StatusCallback :: FunPtr C_StatusCallback -> C_StatusCallback

dynamic_StatusCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StatusCallback
    -> T.Text
    {- ^ /@path@/: the file to retrieve status for, rooted at the repository working dir. -}
    -> [Ggit.Flags.StatusFlags]
    {- ^ /@statusFlags@/: the status value. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next file or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_StatusCallback __funPtr path statusFlags userData = liftIO $ do
    path' <- textToCString path
    let statusFlags' = gflagsToWord statusFlags
    result <- (__dynamic_C_StatusCallback __funPtr) path' statusFlags' userData
    freeMem path'
    return result

foreign import ccall "wrapper"
    mk_StatusCallback :: C_StatusCallback -> IO (FunPtr C_StatusCallback)

type StatusCallback =
    T.Text ->
    [Ggit.Flags.StatusFlags] ->
    IO Int32

noStatusCallback :: Maybe StatusCallback
noStatusCallback = Nothing

type StatusCallback_WithClosures =
    T.Text ->
    [Ggit.Flags.StatusFlags] ->
    Ptr () ->
    IO Int32

noStatusCallback_WithClosures :: Maybe StatusCallback_WithClosures
noStatusCallback_WithClosures = Nothing

drop_closures_StatusCallback :: StatusCallback -> StatusCallback_WithClosures
drop_closures_StatusCallback _f path statusFlags _ = _f path statusFlags

genClosure_StatusCallback :: StatusCallback -> IO Closure
genClosure_StatusCallback cb = do
    let cb' = drop_closures_StatusCallback cb
    let cb'' = wrap_StatusCallback Nothing cb'
    mk_StatusCallback cb'' >>= newCClosure


wrap_StatusCallback ::
    Maybe (Ptr (FunPtr C_StatusCallback)) ->
    StatusCallback_WithClosures ->
    CString ->
    CUInt ->
    Ptr () ->
    IO Int32
wrap_StatusCallback funptrptr _cb path statusFlags userData = do
    path' <- cstringToText path
    let statusFlags' = wordToGFlags statusFlags
    result <- _cb  path' statusFlags' userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback StashCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position within the stash list. 0 points to the\nmost recent stashed state.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stash message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stash_oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the commit oid of the stashed state.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "When iterating over all the stashed states, callback that will be\nissued per entry. See ggit_repository_stash_foreach().", sinceVersion = Nothing}}
type C_StashCallback =
    Word64 ->
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position within the stash list. 0 points to the\nmost recent stashed state.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stash message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stash_oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the commit oid of the stashed state.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StashCallback :: FunPtr C_StashCallback -> C_StashCallback

dynamic_StashCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StashCallback
    -> Word64
    {- ^ /@index@/: the position within the stash list. 0 points to the
most recent stashed state. -}
    -> T.Text
    {- ^ /@message@/: the stash message. -}
    -> Ggit.OId.OId
    {- ^ /@stashOid@/: the commit oid of the stashed state. -}
    -> Ptr ()
    {- ^ /@userData@/: user-suplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_StashCallback __funPtr index message stashOid userData = liftIO $ do
    message' <- textToCString message
    stashOid' <- unsafeManagedPtrGetPtr stashOid
    result <- (__dynamic_C_StashCallback __funPtr) index message' stashOid' userData
    touchManagedPtr stashOid
    freeMem message'
    return result

foreign import ccall "wrapper"
    mk_StashCallback :: C_StashCallback -> IO (FunPtr C_StashCallback)

type StashCallback =
    Word64 ->
    T.Text ->
    Ggit.OId.OId ->
    IO Int32

noStashCallback :: Maybe StashCallback
noStashCallback = Nothing

type StashCallback_WithClosures =
    Word64 ->
    T.Text ->
    Ggit.OId.OId ->
    Ptr () ->
    IO Int32

noStashCallback_WithClosures :: Maybe StashCallback_WithClosures
noStashCallback_WithClosures = Nothing

drop_closures_StashCallback :: StashCallback -> StashCallback_WithClosures
drop_closures_StashCallback _f index message stashOid _ = _f index message stashOid

genClosure_StashCallback :: StashCallback -> IO Closure
genClosure_StashCallback cb = do
    let cb' = drop_closures_StashCallback cb
    let cb'' = wrap_StashCallback Nothing cb'
    mk_StashCallback cb'' >>= newCClosure


wrap_StashCallback ::
    Maybe (Ptr (FunPtr C_StashCallback)) ->
    StashCallback_WithClosures ->
    Word64 ->
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32
wrap_StashCallback funptrptr _cb index message stashOid userData = do
    message' <- cstringToText message
    B.ManagedPtr.withTransient Ggit.OId.OId stashOid $ \stashOid' -> do
        result <- _cb  index message' stashOid' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback RemoteListCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the reference.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference's oid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "loid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference's loid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "local", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if available locally.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for listing the references of a\n#GgitRemote. See ggit_remote_list().", sinceVersion = Nothing}}
type C_RemoteListCallback =
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    CInt ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the reference.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "oid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference's oid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "loid", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference's loid.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "local", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if available locally.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RemoteListCallback :: FunPtr C_RemoteListCallback -> C_RemoteListCallback

dynamic_RemoteListCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_RemoteListCallback
    -> T.Text
    {- ^ /@name@/: the name of the reference. -}
    -> Ggit.OId.OId
    {- ^ /@oid@/: the reference\'s oid. -}
    -> Ggit.OId.OId
    {- ^ /@loid@/: the reference\'s loid. -}
    -> Bool
    {- ^ /@local@/: if available locally. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_RemoteListCallback __funPtr name oid loid local userData = liftIO $ do
    name' <- textToCString name
    oid' <- unsafeManagedPtrGetPtr oid
    loid' <- unsafeManagedPtrGetPtr loid
    let local' = (fromIntegral . fromEnum) local
    result <- (__dynamic_C_RemoteListCallback __funPtr) name' oid' loid' local' userData
    touchManagedPtr oid
    touchManagedPtr loid
    freeMem name'
    return result

foreign import ccall "wrapper"
    mk_RemoteListCallback :: C_RemoteListCallback -> IO (FunPtr C_RemoteListCallback)

type RemoteListCallback =
    T.Text ->
    Ggit.OId.OId ->
    Ggit.OId.OId ->
    Bool ->
    IO Int32

noRemoteListCallback :: Maybe RemoteListCallback
noRemoteListCallback = Nothing

type RemoteListCallback_WithClosures =
    T.Text ->
    Ggit.OId.OId ->
    Ggit.OId.OId ->
    Bool ->
    Ptr () ->
    IO Int32

noRemoteListCallback_WithClosures :: Maybe RemoteListCallback_WithClosures
noRemoteListCallback_WithClosures = Nothing

drop_closures_RemoteListCallback :: RemoteListCallback -> RemoteListCallback_WithClosures
drop_closures_RemoteListCallback _f name oid loid local _ = _f name oid loid local

genClosure_RemoteListCallback :: RemoteListCallback -> IO Closure
genClosure_RemoteListCallback cb = do
    let cb' = drop_closures_RemoteListCallback cb
    let cb'' = wrap_RemoteListCallback Nothing cb'
    mk_RemoteListCallback cb'' >>= newCClosure


wrap_RemoteListCallback ::
    Maybe (Ptr (FunPtr C_RemoteListCallback)) ->
    RemoteListCallback_WithClosures ->
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    CInt ->
    Ptr () ->
    IO Int32
wrap_RemoteListCallback funptrptr _cb name oid loid local userData = do
    name' <- cstringToText name
    B.ManagedPtr.withTransient Ggit.OId.OId oid $ \oid' -> do
        B.ManagedPtr.withTransient Ggit.OId.OId loid $ \loid' -> do
            let local' = (/= 0) local
            result <- _cb  name' oid' loid' local' userData
            maybeReleaseFunPtr funptrptr
            return result


-- callback ReferencesNameCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next references or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the reference", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving the references\nin a #GgitRepository. See ggit_repository_references_foreach_name().", sinceVersion = Nothing}}
type C_ReferencesNameCallback =
    CString ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the reference", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ReferencesNameCallback :: FunPtr C_ReferencesNameCallback -> C_ReferencesNameCallback

dynamic_ReferencesNameCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ReferencesNameCallback
    -> T.Text
    {- ^ /@name@/: the name of the reference -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next references or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_ReferencesNameCallback __funPtr name userData = liftIO $ do
    name' <- textToCString name
    result <- (__dynamic_C_ReferencesNameCallback __funPtr) name' userData
    freeMem name'
    return result

foreign import ccall "wrapper"
    mk_ReferencesNameCallback :: C_ReferencesNameCallback -> IO (FunPtr C_ReferencesNameCallback)

type ReferencesNameCallback =
    T.Text ->
    IO Int32

noReferencesNameCallback :: Maybe ReferencesNameCallback
noReferencesNameCallback = Nothing

type ReferencesNameCallback_WithClosures =
    T.Text ->
    Ptr () ->
    IO Int32

noReferencesNameCallback_WithClosures :: Maybe ReferencesNameCallback_WithClosures
noReferencesNameCallback_WithClosures = Nothing

drop_closures_ReferencesNameCallback :: ReferencesNameCallback -> ReferencesNameCallback_WithClosures
drop_closures_ReferencesNameCallback _f name _ = _f name

genClosure_ReferencesNameCallback :: ReferencesNameCallback -> IO Closure
genClosure_ReferencesNameCallback cb = do
    let cb' = drop_closures_ReferencesNameCallback cb
    let cb'' = wrap_ReferencesNameCallback Nothing cb'
    mk_ReferencesNameCallback cb'' >>= newCClosure


wrap_ReferencesNameCallback ::
    Maybe (Ptr (FunPtr C_ReferencesNameCallback)) ->
    ReferencesNameCallback_WithClosures ->
    CString ->
    Ptr () ->
    IO Int32
wrap_ReferencesNameCallback funptrptr _cb name userData = do
    name' <- cstringToText name
    result <- _cb  name' userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback ReferencesCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next references or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "reference", argType = TInterface (Name {namespace = "Ggit", name = "Ref"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving the references\nin a #GgitRepository. See ggit_repository_references_foreach().", sinceVersion = Nothing}}
type C_ReferencesCallback =
    Ptr Ggit.Ref.Ref ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "reference", argType = TInterface (Name {namespace = "Ggit", name = "Ref"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the reference.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ReferencesCallback :: FunPtr C_ReferencesCallback -> C_ReferencesCallback

dynamic_ReferencesCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Ggit.Ref.IsRef a) =>
    FunPtr C_ReferencesCallback
    -> a
    {- ^ /@reference@/: the reference. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next references or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_ReferencesCallback __funPtr reference userData = liftIO $ do
    reference' <- B.ManagedPtr.disownObject reference
    result <- (__dynamic_C_ReferencesCallback __funPtr) reference' userData
    touchManagedPtr reference
    return result

foreign import ccall "wrapper"
    mk_ReferencesCallback :: C_ReferencesCallback -> IO (FunPtr C_ReferencesCallback)

type ReferencesCallback =
    Ggit.Ref.Ref ->
    IO Int32

noReferencesCallback :: Maybe ReferencesCallback
noReferencesCallback = Nothing

type ReferencesCallback_WithClosures =
    Ggit.Ref.Ref ->
    Ptr () ->
    IO Int32

noReferencesCallback_WithClosures :: Maybe ReferencesCallback_WithClosures
noReferencesCallback_WithClosures = Nothing

drop_closures_ReferencesCallback :: ReferencesCallback -> ReferencesCallback_WithClosures
drop_closures_ReferencesCallback _f reference _ = _f reference

genClosure_ReferencesCallback :: ReferencesCallback -> IO Closure
genClosure_ReferencesCallback cb = do
    let cb' = drop_closures_ReferencesCallback cb
    let cb'' = wrap_ReferencesCallback Nothing cb'
    mk_ReferencesCallback cb'' >>= newCClosure


wrap_ReferencesCallback ::
    Maybe (Ptr (FunPtr C_ReferencesCallback)) ->
    ReferencesCallback_WithClosures ->
    Ptr Ggit.Ref.Ref ->
    Ptr () ->
    IO Int32
wrap_ReferencesCallback funptrptr _cb reference userData = do
    reference' <- (wrapObject Ggit.Ref.Ref) reference
    result <- _cb  reference' userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback NoteCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "blob_id", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "id of the blob containing the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "annotated_object_id", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "id of the git object being annotated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "When iterating over all the notes, callback that will be\nissued per note. See ggit_repository_note_foreach().", sinceVersion = Nothing}}
type C_NoteCallback =
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "blob_id", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "id of the blob containing the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "annotated_object_id", argType = TInterface (Name {namespace = "Ggit", name = "OId"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "id of the git object being annotated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-suplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_NoteCallback :: FunPtr C_NoteCallback -> C_NoteCallback

dynamic_NoteCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_NoteCallback
    -> Ggit.OId.OId
    {- ^ /@blobId@/: id of the blob containing the message. -}
    -> Ggit.OId.OId
    {- ^ /@annotatedObjectId@/: id of the git object being annotated. -}
    -> Ptr ()
    {- ^ /@userData@/: user-suplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_NoteCallback __funPtr blobId annotatedObjectId userData = liftIO $ do
    blobId' <- unsafeManagedPtrGetPtr blobId
    annotatedObjectId' <- unsafeManagedPtrGetPtr annotatedObjectId
    result <- (__dynamic_C_NoteCallback __funPtr) blobId' annotatedObjectId' userData
    touchManagedPtr blobId
    touchManagedPtr annotatedObjectId
    return result

foreign import ccall "wrapper"
    mk_NoteCallback :: C_NoteCallback -> IO (FunPtr C_NoteCallback)

type NoteCallback =
    Ggit.OId.OId ->
    Ggit.OId.OId ->
    IO Int32

noNoteCallback :: Maybe NoteCallback
noNoteCallback = Nothing

type NoteCallback_WithClosures =
    Ggit.OId.OId ->
    Ggit.OId.OId ->
    Ptr () ->
    IO Int32

noNoteCallback_WithClosures :: Maybe NoteCallback_WithClosures
noNoteCallback_WithClosures = Nothing

drop_closures_NoteCallback :: NoteCallback -> NoteCallback_WithClosures
drop_closures_NoteCallback _f blobId annotatedObjectId _ = _f blobId annotatedObjectId

genClosure_NoteCallback :: NoteCallback -> IO Closure
genClosure_NoteCallback cb = do
    let cb' = drop_closures_NoteCallback cb
    let cb'' = wrap_NoteCallback Nothing cb'
    mk_NoteCallback cb'' >>= newCClosure


wrap_NoteCallback ::
    Maybe (Ptr (FunPtr C_NoteCallback)) ->
    NoteCallback_WithClosures ->
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32
wrap_NoteCallback funptrptr _cb blobId annotatedObjectId userData = do
    B.ManagedPtr.withTransient Ggit.OId.OId blobId $ \blobId' -> do
        B.ManagedPtr.withTransient Ggit.OId.OId annotatedObjectId $ \annotatedObjectId' -> do
            result <- _cb  blobId' annotatedObjectId' userData
            maybeReleaseFunPtr funptrptr
            return result


-- callback DiffSimilarityMetricSimilarityCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "score", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_a", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_b", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DiffSimilarityMetricSimilarityCallback =
    Int32 ->
    Ptr () ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "score", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_a", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_b", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricSimilarityCallback :: FunPtr C_DiffSimilarityMetricSimilarityCallback -> C_DiffSimilarityMetricSimilarityCallback

dynamic_DiffSimilarityMetricSimilarityCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricSimilarityCallback
    -> Int32
    -> Ptr ()
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricSimilarityCallback __funPtr score signatureA signatureB userData = liftIO $ do
    result <- (__dynamic_C_DiffSimilarityMetricSimilarityCallback __funPtr) score signatureA signatureB userData
    return result

foreign import ccall "wrapper"
    mk_DiffSimilarityMetricSimilarityCallback :: C_DiffSimilarityMetricSimilarityCallback -> IO (FunPtr C_DiffSimilarityMetricSimilarityCallback)

type DiffSimilarityMetricSimilarityCallback =
    Int32 ->
    Ptr () ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricSimilarityCallback :: Maybe DiffSimilarityMetricSimilarityCallback
noDiffSimilarityMetricSimilarityCallback = Nothing

type DiffSimilarityMetricSimilarityCallback_WithClosures =
    Int32 ->
    Ptr () ->
    Ptr () ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricSimilarityCallback_WithClosures :: Maybe DiffSimilarityMetricSimilarityCallback_WithClosures
noDiffSimilarityMetricSimilarityCallback_WithClosures = Nothing

drop_closures_DiffSimilarityMetricSimilarityCallback :: DiffSimilarityMetricSimilarityCallback -> DiffSimilarityMetricSimilarityCallback_WithClosures
drop_closures_DiffSimilarityMetricSimilarityCallback _f score signatureA signatureB _ = _f score signatureA signatureB

genClosure_DiffSimilarityMetricSimilarityCallback :: DiffSimilarityMetricSimilarityCallback -> IO Closure
genClosure_DiffSimilarityMetricSimilarityCallback cb = do
    let cb' = drop_closures_DiffSimilarityMetricSimilarityCallback cb
    let cb'' = wrap_DiffSimilarityMetricSimilarityCallback Nothing cb'
    mk_DiffSimilarityMetricSimilarityCallback cb'' >>= newCClosure


wrap_DiffSimilarityMetricSimilarityCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback)) ->
    DiffSimilarityMetricSimilarityCallback_WithClosures ->
    Int32 ->
    Ptr () ->
    Ptr () ->
    Ptr () ->
    IO Int32
wrap_DiffSimilarityMetricSimilarityCallback funptrptr _cb score signatureA signatureB userData = do
    result <- _cb  score signatureA signatureB userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback DiffSimilarityMetricFreeSignatureCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "signature", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DiffSimilarityMetricFreeSignatureCallback =
    Ptr () ->
    Ptr () ->
    IO ()

-- Args : [Arg {argCName = "signature", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricFreeSignatureCallback :: FunPtr C_DiffSimilarityMetricFreeSignatureCallback -> C_DiffSimilarityMetricFreeSignatureCallback

dynamic_DiffSimilarityMetricFreeSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricFreeSignatureCallback
    -> Ptr ()
    -> Ptr ()
    -> m ()
dynamic_DiffSimilarityMetricFreeSignatureCallback __funPtr signature userData = liftIO $ do
    (__dynamic_C_DiffSimilarityMetricFreeSignatureCallback __funPtr) signature userData
    return ()

foreign import ccall "wrapper"
    mk_DiffSimilarityMetricFreeSignatureCallback :: C_DiffSimilarityMetricFreeSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)

type DiffSimilarityMetricFreeSignatureCallback =
    Ptr () ->
    IO ()

noDiffSimilarityMetricFreeSignatureCallback :: Maybe DiffSimilarityMetricFreeSignatureCallback
noDiffSimilarityMetricFreeSignatureCallback = Nothing

type DiffSimilarityMetricFreeSignatureCallback_WithClosures =
    Ptr () ->
    Ptr () ->
    IO ()

noDiffSimilarityMetricFreeSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricFreeSignatureCallback_WithClosures
noDiffSimilarityMetricFreeSignatureCallback_WithClosures = Nothing

drop_closures_DiffSimilarityMetricFreeSignatureCallback :: DiffSimilarityMetricFreeSignatureCallback -> DiffSimilarityMetricFreeSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFreeSignatureCallback _f signature _ = _f signature

genClosure_DiffSimilarityMetricFreeSignatureCallback :: DiffSimilarityMetricFreeSignatureCallback -> IO Closure
genClosure_DiffSimilarityMetricFreeSignatureCallback cb = do
    let cb' = drop_closures_DiffSimilarityMetricFreeSignatureCallback cb
    let cb'' = wrap_DiffSimilarityMetricFreeSignatureCallback Nothing cb'
    mk_DiffSimilarityMetricFreeSignatureCallback cb'' >>= newCClosure


wrap_DiffSimilarityMetricFreeSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)) ->
    DiffSimilarityMetricFreeSignatureCallback_WithClosures ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DiffSimilarityMetricFreeSignatureCallback funptrptr _cb signature userData = do
    _cb  signature userData
    maybeReleaseFunPtr funptrptr


-- callback DiffSimilarityMetricFileSignatureCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "file", argType = TInterface (Name {namespace = "Ggit", name = "DiffFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fullpath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DiffSimilarityMetricFileSignatureCallback =
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "Ggit", name = "DiffFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fullpath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricFileSignatureCallback :: FunPtr C_DiffSimilarityMetricFileSignatureCallback -> C_DiffSimilarityMetricFileSignatureCallback

dynamic_DiffSimilarityMetricFileSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricFileSignatureCallback
    -> Ggit.DiffFile.DiffFile
    -> T.Text
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricFileSignatureCallback __funPtr file fullpath out userData = liftIO $ do
    file' <- unsafeManagedPtrGetPtr file
    fullpath' <- textToCString fullpath
    result <- (__dynamic_C_DiffSimilarityMetricFileSignatureCallback __funPtr) file' fullpath' out userData
    touchManagedPtr file
    freeMem fullpath'
    return result

foreign import ccall "wrapper"
    mk_DiffSimilarityMetricFileSignatureCallback :: C_DiffSimilarityMetricFileSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricFileSignatureCallback)

type DiffSimilarityMetricFileSignatureCallback =
    Ggit.DiffFile.DiffFile ->
    T.Text ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricFileSignatureCallback :: Maybe DiffSimilarityMetricFileSignatureCallback
noDiffSimilarityMetricFileSignatureCallback = Nothing

type DiffSimilarityMetricFileSignatureCallback_WithClosures =
    Ggit.DiffFile.DiffFile ->
    T.Text ->
    Ptr () ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricFileSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricFileSignatureCallback_WithClosures
noDiffSimilarityMetricFileSignatureCallback_WithClosures = Nothing

drop_closures_DiffSimilarityMetricFileSignatureCallback :: DiffSimilarityMetricFileSignatureCallback -> DiffSimilarityMetricFileSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFileSignatureCallback _f file fullpath out _ = _f file fullpath out

genClosure_DiffSimilarityMetricFileSignatureCallback :: DiffSimilarityMetricFileSignatureCallback -> IO Closure
genClosure_DiffSimilarityMetricFileSignatureCallback cb = do
    let cb' = drop_closures_DiffSimilarityMetricFileSignatureCallback cb
    let cb'' = wrap_DiffSimilarityMetricFileSignatureCallback Nothing cb'
    mk_DiffSimilarityMetricFileSignatureCallback cb'' >>= newCClosure


wrap_DiffSimilarityMetricFileSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback)) ->
    DiffSimilarityMetricFileSignatureCallback_WithClosures ->
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Ptr () ->
    Ptr () ->
    IO Int32
wrap_DiffSimilarityMetricFileSignatureCallback funptrptr _cb file fullpath out userData = do
    B.ManagedPtr.withTransient Ggit.DiffFile.DiffFile file $ \file' -> do
        fullpath' <- cstringToText fullpath
        result <- _cb  file' fullpath' out userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback DiffSimilarityMetricBufferSignatureCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "file", argType = TInterface (Name {namespace = "Ggit", name = "DiffFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buflen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
type C_DiffSimilarityMetricBufferSignatureCallback =
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Word64 ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "file", argType = TInterface (Name {namespace = "Ggit", name = "DiffFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buflen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricBufferSignatureCallback :: FunPtr C_DiffSimilarityMetricBufferSignatureCallback -> C_DiffSimilarityMetricBufferSignatureCallback

dynamic_DiffSimilarityMetricBufferSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricBufferSignatureCallback
    -> Ggit.DiffFile.DiffFile
    -> T.Text
    -> Word64
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricBufferSignatureCallback __funPtr file buf buflen out userData = liftIO $ do
    file' <- unsafeManagedPtrGetPtr file
    buf' <- textToCString buf
    result <- (__dynamic_C_DiffSimilarityMetricBufferSignatureCallback __funPtr) file' buf' buflen out userData
    touchManagedPtr file
    freeMem buf'
    return result

foreign import ccall "wrapper"
    mk_DiffSimilarityMetricBufferSignatureCallback :: C_DiffSimilarityMetricBufferSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)

type DiffSimilarityMetricBufferSignatureCallback =
    Ggit.DiffFile.DiffFile ->
    T.Text ->
    Word64 ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricBufferSignatureCallback :: Maybe DiffSimilarityMetricBufferSignatureCallback
noDiffSimilarityMetricBufferSignatureCallback = Nothing

type DiffSimilarityMetricBufferSignatureCallback_WithClosures =
    Ggit.DiffFile.DiffFile ->
    T.Text ->
    Word64 ->
    Ptr () ->
    Ptr () ->
    IO Int32

noDiffSimilarityMetricBufferSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricBufferSignatureCallback_WithClosures
noDiffSimilarityMetricBufferSignatureCallback_WithClosures = Nothing

drop_closures_DiffSimilarityMetricBufferSignatureCallback :: DiffSimilarityMetricBufferSignatureCallback -> DiffSimilarityMetricBufferSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricBufferSignatureCallback _f file buf buflen out _ = _f file buf buflen out

genClosure_DiffSimilarityMetricBufferSignatureCallback :: DiffSimilarityMetricBufferSignatureCallback -> IO Closure
genClosure_DiffSimilarityMetricBufferSignatureCallback cb = do
    let cb' = drop_closures_DiffSimilarityMetricBufferSignatureCallback cb
    let cb'' = wrap_DiffSimilarityMetricBufferSignatureCallback Nothing cb'
    mk_DiffSimilarityMetricBufferSignatureCallback cb'' >>= newCClosure


wrap_DiffSimilarityMetricBufferSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)) ->
    DiffSimilarityMetricBufferSignatureCallback_WithClosures ->
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Word64 ->
    Ptr () ->
    Ptr () ->
    IO Int32
wrap_DiffSimilarityMetricBufferSignatureCallback funptrptr _cb file buf buflen out userData = do
    B.ManagedPtr.withTransient Ggit.DiffFile.DiffFile file $ \file' -> do
        buf' <- cstringToText buf
        result <- _cb  file' buf' buflen out userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback DiffLineCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hunk", argType = TInterface (Name {namespace = "Ggit", name = "DiffHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TInterface (Name {namespace = "Ggit", name = "DiffLine"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffLine.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Called for each line.", sinceVersion = Nothing}}
type C_DiffLineCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr Ggit.DiffLine.DiffLine ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hunk", argType = TInterface (Name {namespace = "Ggit", name = "DiffHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TInterface (Name {namespace = "Ggit", name = "DiffLine"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffLine.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffLineCallback :: FunPtr C_DiffLineCallback -> C_DiffLineCallback

dynamic_DiffLineCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffLineCallback
    -> Ggit.DiffDelta.DiffDelta
    {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -}
    -> Ggit.DiffHunk.DiffHunk
    {- ^ /@hunk@/: a 'GI.Ggit.Structs.DiffHunk.DiffHunk'. -}
    -> Ggit.DiffLine.DiffLine
    {- ^ /@line@/: a 'GI.Ggit.Structs.DiffLine.DiffLine'. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_DiffLineCallback __funPtr delta hunk line userData = liftIO $ do
    delta' <- unsafeManagedPtrGetPtr delta
    hunk' <- unsafeManagedPtrGetPtr hunk
    line' <- unsafeManagedPtrGetPtr line
    result <- (__dynamic_C_DiffLineCallback __funPtr) delta' hunk' line' userData
    touchManagedPtr delta
    touchManagedPtr hunk
    touchManagedPtr line
    return result

foreign import ccall "wrapper"
    mk_DiffLineCallback :: C_DiffLineCallback -> IO (FunPtr C_DiffLineCallback)

type DiffLineCallback =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffHunk.DiffHunk ->
    Ggit.DiffLine.DiffLine ->
    IO Int32

noDiffLineCallback :: Maybe DiffLineCallback
noDiffLineCallback = Nothing

type DiffLineCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffHunk.DiffHunk ->
    Ggit.DiffLine.DiffLine ->
    Ptr () ->
    IO Int32

noDiffLineCallback_WithClosures :: Maybe DiffLineCallback_WithClosures
noDiffLineCallback_WithClosures = Nothing

drop_closures_DiffLineCallback :: DiffLineCallback -> DiffLineCallback_WithClosures
drop_closures_DiffLineCallback _f delta hunk line _ = _f delta hunk line

genClosure_DiffLineCallback :: DiffLineCallback -> IO Closure
genClosure_DiffLineCallback cb = do
    let cb' = drop_closures_DiffLineCallback cb
    let cb'' = wrap_DiffLineCallback Nothing cb'
    mk_DiffLineCallback cb'' >>= newCClosure


wrap_DiffLineCallback ::
    Maybe (Ptr (FunPtr C_DiffLineCallback)) ->
    DiffLineCallback_WithClosures ->
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr Ggit.DiffLine.DiffLine ->
    Ptr () ->
    IO Int32
wrap_DiffLineCallback funptrptr _cb delta hunk line userData = do
    B.ManagedPtr.withTransient Ggit.DiffDelta.DiffDelta delta $ \delta' -> do
        B.ManagedPtr.withTransient Ggit.DiffHunk.DiffHunk hunk $ \hunk' -> do
            B.ManagedPtr.withTransient Ggit.DiffLine.DiffLine line $ \line' -> do
                result <- _cb  delta' hunk' line' userData
                maybeReleaseFunPtr funptrptr
                return result


-- callback DiffHunkCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hunk", argType = TInterface (Name {namespace = "Ggit", name = "DiffHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Called for each hunk.", sinceVersion = Nothing}}
type C_DiffHunkCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hunk", argType = TInterface (Name {namespace = "Ggit", name = "DiffHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffHunkCallback :: FunPtr C_DiffHunkCallback -> C_DiffHunkCallback

dynamic_DiffHunkCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffHunkCallback
    -> Ggit.DiffDelta.DiffDelta
    {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -}
    -> Ggit.DiffHunk.DiffHunk
    {- ^ /@hunk@/: a 'GI.Ggit.Structs.DiffHunk.DiffHunk'. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_DiffHunkCallback __funPtr delta hunk userData = liftIO $ do
    delta' <- unsafeManagedPtrGetPtr delta
    hunk' <- unsafeManagedPtrGetPtr hunk
    result <- (__dynamic_C_DiffHunkCallback __funPtr) delta' hunk' userData
    touchManagedPtr delta
    touchManagedPtr hunk
    return result

foreign import ccall "wrapper"
    mk_DiffHunkCallback :: C_DiffHunkCallback -> IO (FunPtr C_DiffHunkCallback)

type DiffHunkCallback =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffHunk.DiffHunk ->
    IO Int32

noDiffHunkCallback :: Maybe DiffHunkCallback
noDiffHunkCallback = Nothing

type DiffHunkCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffHunk.DiffHunk ->
    Ptr () ->
    IO Int32

noDiffHunkCallback_WithClosures :: Maybe DiffHunkCallback_WithClosures
noDiffHunkCallback_WithClosures = Nothing

drop_closures_DiffHunkCallback :: DiffHunkCallback -> DiffHunkCallback_WithClosures
drop_closures_DiffHunkCallback _f delta hunk _ = _f delta hunk

genClosure_DiffHunkCallback :: DiffHunkCallback -> IO Closure
genClosure_DiffHunkCallback cb = do
    let cb' = drop_closures_DiffHunkCallback cb
    let cb'' = wrap_DiffHunkCallback Nothing cb'
    mk_DiffHunkCallback cb'' >>= newCClosure


wrap_DiffHunkCallback ::
    Maybe (Ptr (FunPtr C_DiffHunkCallback)) ->
    DiffHunkCallback_WithClosures ->
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr () ->
    IO Int32
wrap_DiffHunkCallback funptrptr _cb delta hunk userData = do
    B.ManagedPtr.withTransient Ggit.DiffDelta.DiffDelta delta $ \delta' -> do
        B.ManagedPtr.withTransient Ggit.DiffHunk.DiffHunk hunk $ \hunk' -> do
            result <- _cb  delta' hunk' userData
            maybeReleaseFunPtr funptrptr
            return result


-- callback DiffFileCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the progress.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Called for each file.", sinceVersion = Nothing}}
type C_DiffFileCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    CFloat ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the progress.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffFileCallback :: FunPtr C_DiffFileCallback -> C_DiffFileCallback

dynamic_DiffFileCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffFileCallback
    -> Ggit.DiffDelta.DiffDelta
    {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -}
    -> Float
    {- ^ /@progress@/: the progress. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_DiffFileCallback __funPtr delta progress userData = liftIO $ do
    delta' <- unsafeManagedPtrGetPtr delta
    let progress' = realToFrac progress
    result <- (__dynamic_C_DiffFileCallback __funPtr) delta' progress' userData
    touchManagedPtr delta
    return result

foreign import ccall "wrapper"
    mk_DiffFileCallback :: C_DiffFileCallback -> IO (FunPtr C_DiffFileCallback)

type DiffFileCallback =
    Ggit.DiffDelta.DiffDelta ->
    Float ->
    IO Int32

noDiffFileCallback :: Maybe DiffFileCallback
noDiffFileCallback = Nothing

type DiffFileCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta ->
    Float ->
    Ptr () ->
    IO Int32

noDiffFileCallback_WithClosures :: Maybe DiffFileCallback_WithClosures
noDiffFileCallback_WithClosures = Nothing

drop_closures_DiffFileCallback :: DiffFileCallback -> DiffFileCallback_WithClosures
drop_closures_DiffFileCallback _f delta progress _ = _f delta progress

genClosure_DiffFileCallback :: DiffFileCallback -> IO Closure
genClosure_DiffFileCallback cb = do
    let cb' = drop_closures_DiffFileCallback cb
    let cb'' = wrap_DiffFileCallback Nothing cb'
    mk_DiffFileCallback cb'' >>= newCClosure


wrap_DiffFileCallback ::
    Maybe (Ptr (FunPtr C_DiffFileCallback)) ->
    DiffFileCallback_WithClosures ->
    Ptr Ggit.DiffDelta.DiffDelta ->
    CFloat ->
    Ptr () ->
    IO Int32
wrap_DiffFileCallback funptrptr _cb delta progress userData = do
    B.ManagedPtr.withTransient Ggit.DiffDelta.DiffDelta delta $ \delta' -> do
        let progress' = realToFrac progress
        result <- _cb  delta' progress' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback DiffBinaryCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go continue or a #GgitError in case there was an error.", sinceVersion = Nothing}, args = [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "binary", argType = TInterface (Name {namespace = "Ggit", name = "DiffBinary"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffBinary.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Called for each file.", sinceVersion = Nothing}}
type C_DiffBinaryCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffBinary.DiffBinary ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "delta", argType = TInterface (Name {namespace = "Ggit", name = "DiffDelta"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffDelta.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "binary", argType = TInterface (Name {namespace = "Ggit", name = "DiffBinary"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitDiffBinary.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffBinaryCallback :: FunPtr C_DiffBinaryCallback -> C_DiffBinaryCallback

dynamic_DiffBinaryCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffBinaryCallback
    -> Ggit.DiffDelta.DiffDelta
    {- ^ /@delta@/: a 'GI.Ggit.Structs.DiffDelta.DiffDelta'. -}
    -> Ggit.DiffBinary.DiffBinary
    {- ^ /@binary@/: a 'GI.Ggit.Structs.DiffBinary.DiffBinary'. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go continue or a 'GI.Ggit.Enums.Error' in case there was an error. -}
dynamic_DiffBinaryCallback __funPtr delta binary userData = liftIO $ do
    delta' <- unsafeManagedPtrGetPtr delta
    binary' <- unsafeManagedPtrGetPtr binary
    result <- (__dynamic_C_DiffBinaryCallback __funPtr) delta' binary' userData
    touchManagedPtr delta
    touchManagedPtr binary
    return result

foreign import ccall "wrapper"
    mk_DiffBinaryCallback :: C_DiffBinaryCallback -> IO (FunPtr C_DiffBinaryCallback)

type DiffBinaryCallback =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffBinary.DiffBinary ->
    IO Int32

noDiffBinaryCallback :: Maybe DiffBinaryCallback
noDiffBinaryCallback = Nothing

type DiffBinaryCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta ->
    Ggit.DiffBinary.DiffBinary ->
    Ptr () ->
    IO Int32

noDiffBinaryCallback_WithClosures :: Maybe DiffBinaryCallback_WithClosures
noDiffBinaryCallback_WithClosures = Nothing

drop_closures_DiffBinaryCallback :: DiffBinaryCallback -> DiffBinaryCallback_WithClosures
drop_closures_DiffBinaryCallback _f delta binary _ = _f delta binary

genClosure_DiffBinaryCallback :: DiffBinaryCallback -> IO Closure
genClosure_DiffBinaryCallback cb = do
    let cb' = drop_closures_DiffBinaryCallback cb
    let cb'' = wrap_DiffBinaryCallback Nothing cb'
    mk_DiffBinaryCallback cb'' >>= newCClosure


wrap_DiffBinaryCallback ::
    Maybe (Ptr (FunPtr C_DiffBinaryCallback)) ->
    DiffBinaryCallback_WithClosures ->
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffBinary.DiffBinary ->
    Ptr () ->
    IO Int32
wrap_DiffBinaryCallback funptrptr _cb delta binary userData = do
    B.ManagedPtr.withTransient Ggit.DiffDelta.DiffDelta delta $ \delta' -> do
        B.ManagedPtr.withTransient Ggit.DiffBinary.DiffBinary binary $ \binary' -> do
            result <- _cb  delta' binary' userData
            maybeReleaseFunPtr funptrptr
            return result


-- callback CredAcquireCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "url", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the resource for which we are demanding a credential.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "username_from_url", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The username that was embedded in a \"user@host\"\n                                  remote url, or NULL if not included.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allowed_types", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a bitmask stating which cred types are OK to return.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cred", argType = TInterface (Name {namespace = "Ggit", name = "Cred"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "newly created credential object.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Signature of a function which acquires a credential object.", sinceVersion = Nothing}}
type C_CredAcquireCallback =
    CString ->
    CString ->
    Word32 ->
    Ptr Ggit.Cred.Cred ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "url", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the resource for which we are demanding a credential.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "username_from_url", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The username that was embedded in a \"user@host\"\n                                  remote url, or NULL if not included.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allowed_types", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a bitmask stating which cred types are OK to return.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cred", argType = TInterface (Name {namespace = "Ggit", name = "Cred"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "newly created credential object.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CredAcquireCallback :: FunPtr C_CredAcquireCallback -> C_CredAcquireCallback

dynamic_CredAcquireCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Ggit.Cred.IsCred a) =>
    FunPtr C_CredAcquireCallback
    -> T.Text
    {- ^ /@url@/: the resource for which we are demanding a credential. -}
    -> Maybe (T.Text)
    {- ^ /@usernameFromUrl@/: The username that was embedded in a \"user/@host@/\"
                                  remote url, or NULL if not included. -}
    -> Word32
    {- ^ /@allowedTypes@/: a bitmask stating which cred types are OK to return. -}
    -> a
    {- ^ /@cred@/: newly created credential object. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
dynamic_CredAcquireCallback __funPtr url usernameFromUrl allowedTypes cred userData = liftIO $ do
    url' <- textToCString url
    maybeUsernameFromUrl <- case usernameFromUrl of
        Nothing -> return nullPtr
        Just jUsernameFromUrl -> do
            jUsernameFromUrl' <- textToCString jUsernameFromUrl
            return jUsernameFromUrl'
    cred' <- B.ManagedPtr.disownObject cred
    result <- (__dynamic_C_CredAcquireCallback __funPtr) url' maybeUsernameFromUrl allowedTypes cred' userData
    touchManagedPtr cred
    freeMem url'
    freeMem maybeUsernameFromUrl
    return result

foreign import ccall "wrapper"
    mk_CredAcquireCallback :: C_CredAcquireCallback -> IO (FunPtr C_CredAcquireCallback)

type CredAcquireCallback =
    T.Text ->
    Maybe T.Text ->
    Word32 ->
    Ggit.Cred.Cred ->
    IO Int32

noCredAcquireCallback :: Maybe CredAcquireCallback
noCredAcquireCallback = Nothing

type CredAcquireCallback_WithClosures =
    T.Text ->
    Maybe T.Text ->
    Word32 ->
    Ggit.Cred.Cred ->
    Ptr () ->
    IO Int32

noCredAcquireCallback_WithClosures :: Maybe CredAcquireCallback_WithClosures
noCredAcquireCallback_WithClosures = Nothing

drop_closures_CredAcquireCallback :: CredAcquireCallback -> CredAcquireCallback_WithClosures
drop_closures_CredAcquireCallback _f url usernameFromUrl allowedTypes cred _ = _f url usernameFromUrl allowedTypes cred

genClosure_CredAcquireCallback :: CredAcquireCallback -> IO Closure
genClosure_CredAcquireCallback cb = do
    let cb' = drop_closures_CredAcquireCallback cb
    let cb'' = wrap_CredAcquireCallback Nothing cb'
    mk_CredAcquireCallback cb'' >>= newCClosure


wrap_CredAcquireCallback ::
    Maybe (Ptr (FunPtr C_CredAcquireCallback)) ->
    CredAcquireCallback_WithClosures ->
    CString ->
    CString ->
    Word32 ->
    Ptr Ggit.Cred.Cred ->
    Ptr () ->
    IO Int32
wrap_CredAcquireCallback funptrptr _cb url usernameFromUrl allowedTypes cred userData = do
    url' <- cstringToText url
    maybeUsernameFromUrl <-
        if usernameFromUrl == nullPtr
        then return Nothing
        else do
            usernameFromUrl' <- cstringToText usernameFromUrl
            return $ Just usernameFromUrl'
    cred' <- (wrapObject Ggit.Cred.Cred) cred
    result <- _cb  url' maybeUsernameFromUrl allowedTypes cred' userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback ConfigMatchCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next config value or a #GgitError in case there was\n         an error.", sinceVersion = Nothing}, args = [Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving values from a #GgitConfig\nusing a regular expression. See ggit_config_match_foreach().", sinceVersion = Nothing}}
type C_ConfigMatchCallback =
    Ptr GLib.MatchInfo.MatchInfo ->
    CString ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "match_info", argType = TInterface (Name {namespace = "GLib", name = "MatchInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ConfigMatchCallback :: FunPtr C_ConfigMatchCallback -> C_ConfigMatchCallback

dynamic_ConfigMatchCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ConfigMatchCallback
    -> GLib.MatchInfo.MatchInfo
    {- ^ /@matchInfo@/: the match -}
    -> T.Text
    {- ^ /@value@/: the value -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next config value or a 'GI.Ggit.Enums.Error' in case there was
         an error. -}
dynamic_ConfigMatchCallback __funPtr matchInfo value userData = liftIO $ do
    matchInfo' <- unsafeManagedPtrGetPtr matchInfo
    value' <- textToCString value
    result <- (__dynamic_C_ConfigMatchCallback __funPtr) matchInfo' value' userData
    touchManagedPtr matchInfo
    freeMem value'
    return result

foreign import ccall "wrapper"
    mk_ConfigMatchCallback :: C_ConfigMatchCallback -> IO (FunPtr C_ConfigMatchCallback)

type ConfigMatchCallback =
    GLib.MatchInfo.MatchInfo ->
    T.Text ->
    IO Int32

noConfigMatchCallback :: Maybe ConfigMatchCallback
noConfigMatchCallback = Nothing

type ConfigMatchCallback_WithClosures =
    GLib.MatchInfo.MatchInfo ->
    T.Text ->
    Ptr () ->
    IO Int32

noConfigMatchCallback_WithClosures :: Maybe ConfigMatchCallback_WithClosures
noConfigMatchCallback_WithClosures = Nothing

drop_closures_ConfigMatchCallback :: ConfigMatchCallback -> ConfigMatchCallback_WithClosures
drop_closures_ConfigMatchCallback _f matchInfo value _ = _f matchInfo value

genClosure_ConfigMatchCallback :: ConfigMatchCallback -> IO Closure
genClosure_ConfigMatchCallback cb = do
    let cb' = drop_closures_ConfigMatchCallback cb
    let cb'' = wrap_ConfigMatchCallback Nothing cb'
    mk_ConfigMatchCallback cb'' >>= newCClosure


wrap_ConfigMatchCallback ::
    Maybe (Ptr (FunPtr C_ConfigMatchCallback)) ->
    ConfigMatchCallback_WithClosures ->
    Ptr GLib.MatchInfo.MatchInfo ->
    CString ->
    Ptr () ->
    IO Int32
wrap_ConfigMatchCallback funptrptr _cb matchInfo value userData = do
    B.ManagedPtr.withTransient GLib.MatchInfo.MatchInfo matchInfo $ \matchInfo' -> do
        value' <- cstringToText value
        result <- _cb  matchInfo' value' userData
        maybeReleaseFunPtr funptrptr
        return result


-- callback ConfigCallback
--          -> Callable {returnType = Just (TBasicType TInt), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "0 to go for the next config value or a #GgitError in case there was\n         an error.", sinceVersion = Nothing}, args = [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "ConfigEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfigEntry.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "The type of the callback functions for retrieving values from a #GgitConfig.\nSee ggit_config_foreach().", sinceVersion = Nothing}}
type C_ConfigCallback =
    Ptr Ggit.ConfigEntry.ConfigEntry ->
    Ptr () ->
    IO Int32

-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "ConfigEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitConfigEntry.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user-supplied data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ConfigCallback :: FunPtr C_ConfigCallback -> C_ConfigCallback

dynamic_ConfigCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ConfigCallback
    -> Ggit.ConfigEntry.ConfigEntry
    {- ^ /@entry@/: a 'GI.Ggit.Structs.ConfigEntry.ConfigEntry'. -}
    -> Ptr ()
    {- ^ /@userData@/: user-supplied data. -}
    -> m Int32
    {- ^ __Returns:__ 0 to go for the next config value or a 'GI.Ggit.Enums.Error' in case there was
         an error. -}
dynamic_ConfigCallback __funPtr entry userData = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- (__dynamic_C_ConfigCallback __funPtr) entry' userData
    touchManagedPtr entry
    return result

foreign import ccall "wrapper"
    mk_ConfigCallback :: C_ConfigCallback -> IO (FunPtr C_ConfigCallback)

type ConfigCallback =
    Ggit.ConfigEntry.ConfigEntry ->
    IO Int32

noConfigCallback :: Maybe ConfigCallback
noConfigCallback = Nothing

type ConfigCallback_WithClosures =
    Ggit.ConfigEntry.ConfigEntry ->
    Ptr () ->
    IO Int32

noConfigCallback_WithClosures :: Maybe ConfigCallback_WithClosures
noConfigCallback_WithClosures = Nothing

drop_closures_ConfigCallback :: ConfigCallback -> ConfigCallback_WithClosures
drop_closures_ConfigCallback _f entry _ = _f entry

genClosure_ConfigCallback :: ConfigCallback -> IO Closure
genClosure_ConfigCallback cb = do
    let cb' = drop_closures_ConfigCallback cb
    let cb'' = wrap_ConfigCallback Nothing cb'
    mk_ConfigCallback cb'' >>= newCClosure


wrap_ConfigCallback ::
    Maybe (Ptr (FunPtr C_ConfigCallback)) ->
    ConfigCallback_WithClosures ->
    Ptr Ggit.ConfigEntry.ConfigEntry ->
    Ptr () ->
    IO Int32
wrap_ConfigCallback funptrptr _cb entry userData = do
    B.ManagedPtr.withTransient Ggit.ConfigEntry.ConfigEntry entry $ \entry' -> do
        result <- _cb  entry' userData
        maybeReleaseFunPtr funptrptr
        return result