{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.OSTree.Interfaces.RepoFinder
    (

-- * Exported types
    RepoFinder(..)                          ,
    noRepoFinder                            ,
    IsRepoFinder                            ,
    toRepoFinder                            ,


 -- * Methods
-- ** resolveAllAsync #method:resolveAllAsync#

    repoFinderResolveAllAsync               ,


-- ** resolveAllFinish #method:resolveAllFinish#

    repoFinderResolveAllFinish              ,


-- ** resolveAsync #method:resolveAsync#

#if ENABLE_OVERLOADING
    RepoFinderResolveAsyncMethodInfo        ,
#endif
    repoFinderResolveAsync                  ,


-- ** resolveFinish #method:resolveFinish#

#if ENABLE_OVERLOADING
    RepoFinderResolveFinishMethodInfo       ,
#endif
    repoFinderResolveFinish                 ,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.OSTree.Objects.Repo as OSTree.Repo
import {-# SOURCE #-} qualified GI.OSTree.Structs.CollectionRef as OSTree.CollectionRef
import {-# SOURCE #-} qualified GI.OSTree.Structs.RepoFinderResult as OSTree.RepoFinderResult

-- interface RepoFinder 
-- | Memory-managed wrapper type.
newtype RepoFinder = RepoFinder (ManagedPtr RepoFinder)
-- | A convenience alias for `Nothing` :: `Maybe` `RepoFinder`.
noRepoFinder :: Maybe RepoFinder
noRepoFinder = Nothing

#if ENABLE_OVERLOADING
type instance O.SignalList RepoFinder = RepoFinderSignalList
type RepoFinderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "ostree_repo_finder_get_type"
    c_ostree_repo_finder_get_type :: IO GType

instance GObject RepoFinder where
    gobjectType = c_ostree_repo_finder_get_type


-- | Type class for types which can be safely cast to `RepoFinder`, for instance with `toRepoFinder`.
class (GObject o, O.IsDescendantOf RepoFinder o) => IsRepoFinder o
instance (GObject o, O.IsDescendantOf RepoFinder o) => IsRepoFinder o

instance O.HasParentTypes RepoFinder
type instance O.ParentTypes RepoFinder = '[GObject.Object.Object]

-- | Cast to `RepoFinder`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toRepoFinder :: (MonadIO m, IsRepoFinder o) => o -> m RepoFinder
toRepoFinder = liftIO . unsafeCastTo RepoFinder

#if ENABLE_OVERLOADING
instance O.HasAttributeList RepoFinder
type instance O.AttributeList RepoFinder = RepoFinderAttributeList
type RepoFinderAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveRepoFinderMethod (t :: Symbol) (o :: *) :: * where
    ResolveRepoFinderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveRepoFinderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveRepoFinderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveRepoFinderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveRepoFinderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveRepoFinderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveRepoFinderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveRepoFinderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveRepoFinderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveRepoFinderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveRepoFinderMethod "resolveAsync" o = RepoFinderResolveAsyncMethodInfo
    ResolveRepoFinderMethod "resolveFinish" o = RepoFinderResolveFinishMethodInfo
    ResolveRepoFinderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveRepoFinderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveRepoFinderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveRepoFinderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveRepoFinderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveRepoFinderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveRepoFinderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveRepoFinderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveRepoFinderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveRepoFinderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveRepoFinderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveRepoFinderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRepoFinderMethod t RepoFinder, O.MethodInfo info RepoFinder p) => OL.IsLabel t (RepoFinder -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- method RepoFinder::resolve_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "RepoFinder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeRepoFinder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "refs", argType = TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "CollectionRef"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "non-empty array of collection\8211ref pairs to find remotes for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent_repo", argType = TInterface (Name {namespace = "OSTree", name = "Repo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the local repository which the refs are being resolved for,\n   which provides configuration information and GPG keys", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "asynchronous completion callback", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_finder_resolve_async" ostree_repo_finder_resolve_async ::
    Ptr RepoFinder ->                       -- self : TInterface (Name {namespace = "OSTree", name = "RepoFinder"})
    Ptr (Ptr OSTree.CollectionRef.CollectionRef) -> -- refs : TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "CollectionRef"}))
    Ptr OSTree.Repo.Repo ->                 -- parent_repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Find reachable remote URIs which claim to provide any of the given /@refs@/. The
specific method for finding the remotes depends on the 'GI.OSTree.Interfaces.RepoFinder.RepoFinder'
implementation.

Any remote which is found and which claims to support any of the given /@refs@/
will be returned in the results. It is possible that a remote claims to
support a given ref, but turns out not to — it is not possible to verify this
until 'GI.OSTree.Objects.Repo.repoPullFromRemotesAsync' is called.

The returned results will be sorted with the most useful first — this is
typically the remote which claims to provide the most /@refs@/, at the lowest
latency.

Each result contains a mapping of /@refs@/ to the checksums of the commits
which the result provides. If the result provides the latest commit for a ref
across all of the results, the checksum will be set. Otherwise, if the
result provides an outdated commit, or doesn’t provide a given ref at all,
the checksum will not be set. Results which provide none of the requested
/@refs@/ may be listed with an empty refs map.

Pass the results to 'GI.OSTree.Objects.Repo.repoPullFromRemotesAsync' to pull the given
/@refs@/ from those remotes.

/Since: 2018.6/
-}
repoFinderResolveAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsRepoFinder a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@self@/: an 'GI.OSTree.Interfaces.RepoFinder.RepoFinder' -}
    -> [OSTree.CollectionRef.CollectionRef]
    {- ^ /@refs@/: non-empty array of collection–ref pairs to find remotes for -}
    -> b
    {- ^ /@parentRepo@/: the local repository which the refs are being resolved for,
   which provides configuration information and GPG keys -}
    -> Maybe (c)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable', or 'Nothing' -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: asynchronous completion callback -}
    -> m ()
repoFinderResolveAsync self refs parentRepo cancellable callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    refs' <- mapM unsafeManagedPtrGetPtr refs
    refs'' <- packZeroTerminatedPtrArray refs'
    parentRepo' <- unsafeManagedPtrCastPtr parentRepo
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    ostree_repo_finder_resolve_async self' refs'' parentRepo' maybeCancellable maybeCallback userData
    touchManagedPtr self
    mapM_ touchManagedPtr refs
    touchManagedPtr parentRepo
    whenJust cancellable touchManagedPtr
    freeMem refs''
    return ()

#if ENABLE_OVERLOADING
data RepoFinderResolveAsyncMethodInfo
instance (signature ~ ([OSTree.CollectionRef.CollectionRef] -> b -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsRepoFinder a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo RepoFinderResolveAsyncMethodInfo a signature where
    overloadedMethod _ = repoFinderResolveAsync

#endif

-- method RepoFinder::resolve_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "OSTree", name = "RepoFinder"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeRepoFinder", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GAsyncResult from the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TPtrArray (TInterface (Name {namespace = "OSTree", name = "RepoFinderResult"})))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_repo_finder_resolve_finish" ostree_repo_finder_resolve_finish ::
    Ptr RepoFinder ->                       -- self : TInterface (Name {namespace = "OSTree", name = "RepoFinder"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GPtrArray (Ptr OSTree.RepoFinderResult.RepoFinderResult)))

{- |
Get the results from a 'GI.OSTree.Interfaces.RepoFinder.repoFinderResolveAsync' operation.

/Since: 2018.6/
-}
repoFinderResolveFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsRepoFinder a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@self@/: an 'GI.OSTree.Interfaces.RepoFinder.RepoFinder' -}
    -> b
    {- ^ /@result@/: 'GI.Gio.Interfaces.AsyncResult.AsyncResult' from the callback -}
    -> m [OSTree.RepoFinderResult.RepoFinderResult]
    {- ^ __Returns:__ array of zero
   or more results /(Can throw 'Data.GI.Base.GError.GError')/ -}
repoFinderResolveFinish self result_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ ostree_repo_finder_resolve_finish self' result_'
        checkUnexpectedReturnNULL "repoFinderResolveFinish" result
        result' <- unpackGPtrArray result
        result'' <- mapM (wrapBoxed OSTree.RepoFinderResult.RepoFinderResult) result'
        unrefPtrArray result
        touchManagedPtr self
        touchManagedPtr result_
        return result''
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data RepoFinderResolveFinishMethodInfo
instance (signature ~ (b -> m [OSTree.RepoFinderResult.RepoFinderResult]), MonadIO m, IsRepoFinder a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo RepoFinderResolveFinishMethodInfo a signature where
    overloadedMethod _ = repoFinderResolveFinish

#endif

-- method RepoFinder::resolve_all_async
-- method type : MemberFunction
-- Args : [Arg {argCName = "finders", argType = TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "RepoFinder"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "non-empty array of #OstreeRepoFinders", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "refs", argType = TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "CollectionRef"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "non-empty array of collection\8211ref pairs to find remotes for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "parent_repo", argType = TInterface (Name {namespace = "OSTree", name = "Repo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the local repository which the refs are being resolved for,\n   which provides configuration information and GPG keys", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GCancellable, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "asynchronous completion callback", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_finder_resolve_all_async" ostree_repo_finder_resolve_all_async ::
    Ptr (Ptr RepoFinder) ->                 -- finders : TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "RepoFinder"}))
    Ptr (Ptr OSTree.CollectionRef.CollectionRef) -> -- refs : TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "CollectionRef"}))
    Ptr OSTree.Repo.Repo ->                 -- parent_repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
A version of 'GI.OSTree.Interfaces.RepoFinder.repoFinderResolveAsync' which queries one or more
/@finders@/ in parallel and combines the results.

/Since: 2018.6/
-}
repoFinderResolveAllAsync ::
    (B.CallStack.HasCallStack, MonadIO m, OSTree.Repo.IsRepo a, Gio.Cancellable.IsCancellable b) =>
    [RepoFinder]
    {- ^ /@finders@/: non-empty array of @/OstreeRepoFinders/@ -}
    -> [OSTree.CollectionRef.CollectionRef]
    {- ^ /@refs@/: non-empty array of collection–ref pairs to find remotes for -}
    -> a
    {- ^ /@parentRepo@/: the local repository which the refs are being resolved for,
   which provides configuration information and GPG keys -}
    -> Maybe (b)
    {- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable', or 'Nothing' -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: asynchronous completion callback -}
    -> m ()
repoFinderResolveAllAsync finders refs parentRepo cancellable callback = liftIO $ do
    finders' <- mapM unsafeManagedPtrCastPtr finders
    finders'' <- packZeroTerminatedPtrArray finders'
    refs' <- mapM unsafeManagedPtrGetPtr refs
    refs'' <- packZeroTerminatedPtrArray refs'
    parentRepo' <- unsafeManagedPtrCastPtr parentRepo
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    ostree_repo_finder_resolve_all_async finders'' refs'' parentRepo' maybeCancellable maybeCallback userData
    mapM_ touchManagedPtr finders
    mapM_ touchManagedPtr refs
    touchManagedPtr parentRepo
    whenJust cancellable touchManagedPtr
    freeMem finders''
    freeMem refs''
    return ()

#if ENABLE_OVERLOADING
#endif

-- method RepoFinder::resolve_all_finish
-- method type : MemberFunction
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GAsyncResult from the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TPtrArray (TInterface (Name {namespace = "OSTree", name = "RepoFinderResult"})))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_repo_finder_resolve_all_finish" ostree_repo_finder_resolve_all_finish ::
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GPtrArray (Ptr OSTree.RepoFinderResult.RepoFinderResult)))

{- |
Get the results from a 'GI.OSTree.Functions.repoFinderResolveAllAsync' operation.

/Since: 2018.6/
-}
repoFinderResolveAllFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    {- ^ /@result@/: 'GI.Gio.Interfaces.AsyncResult.AsyncResult' from the callback -}
    -> m [OSTree.RepoFinderResult.RepoFinderResult]
    {- ^ __Returns:__ array of zero
   or more results /(Can throw 'Data.GI.Base.GError.GError')/ -}
repoFinderResolveAllFinish result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ ostree_repo_finder_resolve_all_finish result_'
        checkUnexpectedReturnNULL "repoFinderResolveAllFinish" result
        result' <- unpackGPtrArray result
        result'' <- mapM (wrapBoxed OSTree.RepoFinderResult.RepoFinderResult) result'
        unrefPtrArray result
        touchManagedPtr result_
        return result''
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
#endif