{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Represents a git fetch options. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Ggit.Structs.FetchOptions ( -- * Exported types FetchOptions(..) , noFetchOptions , -- * Methods -- ** copy #method:copy# #if ENABLE_OVERLOADING FetchOptionsCopyMethodInfo , #endif fetchOptionsCopy , -- ** free #method:free# #if ENABLE_OVERLOADING FetchOptionsFreeMethodInfo , #endif fetchOptionsFree , -- ** getDownloadTags #method:getDownloadTags# #if ENABLE_OVERLOADING FetchOptionsGetDownloadTagsMethodInfo , #endif fetchOptionsGetDownloadTags , -- ** getRemoteCallbacks #method:getRemoteCallbacks# #if ENABLE_OVERLOADING FetchOptionsGetRemoteCallbacksMethodInfo, #endif fetchOptionsGetRemoteCallbacks , -- ** new #method:new# fetchOptionsNew , -- ** setDownloadTags #method:setDownloadTags# #if ENABLE_OVERLOADING FetchOptionsSetDownloadTagsMethodInfo , #endif fetchOptionsSetDownloadTags , -- ** setRemoteCallbacks #method:setRemoteCallbacks# #if ENABLE_OVERLOADING FetchOptionsSetRemoteCallbacksMethodInfo, #endif fetchOptionsSetRemoteCallbacks , ) 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 {-# SOURCE #-} qualified GI.Ggit.Enums as Ggit.Enums import {-# SOURCE #-} qualified GI.Ggit.Objects.RemoteCallbacks as Ggit.RemoteCallbacks -- | Memory-managed wrapper type. newtype FetchOptions = FetchOptions (ManagedPtr FetchOptions) foreign import ccall "ggit_fetch_options_get_type" c_ggit_fetch_options_get_type :: IO GType instance BoxedObject FetchOptions where boxedType _ = c_ggit_fetch_options_get_type -- | A convenience alias for `Nothing` :: `Maybe` `FetchOptions`. noFetchOptions :: Maybe FetchOptions noFetchOptions = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList FetchOptions type instance O.AttributeList FetchOptions = FetchOptionsAttributeList type FetchOptionsAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method FetchOptions::new -- method type : Constructor -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "FetchOptions"})) -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_new" ggit_fetch_options_new :: IO (Ptr FetchOptions) {- | Creates a new 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} fetchOptionsNew :: (B.CallStack.HasCallStack, MonadIO m) => m FetchOptions {- ^ __Returns:__ a newly allocated 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} fetchOptionsNew = liftIO $ do result <- ggit_fetch_options_new checkUnexpectedReturnNULL "fetchOptionsNew" result result' <- (wrapBoxed FetchOptions) result return result' #if ENABLE_OVERLOADING #endif -- method FetchOptions::copy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "fetch_options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "FetchOptions"})) -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_copy" ggit_fetch_options_copy :: Ptr FetchOptions -> -- fetch_options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) IO (Ptr FetchOptions) {- | Copies /@fetchOptions@/ into a newly allocated 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} fetchOptionsCopy :: (B.CallStack.HasCallStack, MonadIO m) => FetchOptions {- ^ /@fetchOptions@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> m (Maybe FetchOptions) {- ^ __Returns:__ a newly allocated 'GI.Ggit.Structs.FetchOptions.FetchOptions' or 'Nothing'. -} fetchOptionsCopy fetchOptions = liftIO $ do fetchOptions' <- unsafeManagedPtrGetPtr fetchOptions result <- ggit_fetch_options_copy fetchOptions' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (wrapBoxed FetchOptions) result' return result'' touchManagedPtr fetchOptions return maybeResult #if ENABLE_OVERLOADING data FetchOptionsCopyMethodInfo instance (signature ~ (m (Maybe FetchOptions)), MonadIO m) => O.MethodInfo FetchOptionsCopyMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsCopy #endif -- method FetchOptions::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "fetch_options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_free" ggit_fetch_options_free :: Ptr FetchOptions -> -- fetch_options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) IO () {- | Frees /@fetchOptions@/. -} fetchOptionsFree :: (B.CallStack.HasCallStack, MonadIO m) => FetchOptions {- ^ /@fetchOptions@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> m () fetchOptionsFree fetchOptions = liftIO $ do fetchOptions' <- unsafeManagedPtrGetPtr fetchOptions ggit_fetch_options_free fetchOptions' touchManagedPtr fetchOptions return () #if ENABLE_OVERLOADING data FetchOptionsFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo FetchOptionsFreeMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsFree #endif -- method FetchOptions::get_download_tags -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "RemoteDownloadTagsType"})) -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_get_download_tags" ggit_fetch_options_get_download_tags :: Ptr FetchOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) IO CUInt {- | Get how tags are being handled when fetching\/downloading. -} fetchOptionsGetDownloadTags :: (B.CallStack.HasCallStack, MonadIO m) => FetchOptions {- ^ /@options@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> m Ggit.Enums.RemoteDownloadTagsType {- ^ __Returns:__ a 'GI.Ggit.Enums.RemoteDownloadTagsType'. -} fetchOptionsGetDownloadTags options = liftIO $ do options' <- unsafeManagedPtrGetPtr options result <- ggit_fetch_options_get_download_tags options' let result' = (toEnum . fromIntegral) result touchManagedPtr options return result' #if ENABLE_OVERLOADING data FetchOptionsGetDownloadTagsMethodInfo instance (signature ~ (m Ggit.Enums.RemoteDownloadTagsType), MonadIO m) => O.MethodInfo FetchOptionsGetDownloadTagsMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsGetDownloadTags #endif -- method FetchOptions::get_remote_callbacks -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Ggit", name = "RemoteCallbacks"})) -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_get_remote_callbacks" ggit_fetch_options_get_remote_callbacks :: Ptr FetchOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) IO (Ptr Ggit.RemoteCallbacks.RemoteCallbacks) {- | Get the remote callbacks object or 'Nothing' if not set. -} fetchOptionsGetRemoteCallbacks :: (B.CallStack.HasCallStack, MonadIO m) => FetchOptions {- ^ /@options@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> m (Maybe Ggit.RemoteCallbacks.RemoteCallbacks) {- ^ __Returns:__ the remote callbacks or 'Nothing'. -} fetchOptionsGetRemoteCallbacks options = liftIO $ do options' <- unsafeManagedPtrGetPtr options result <- ggit_fetch_options_get_remote_callbacks options' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject Ggit.RemoteCallbacks.RemoteCallbacks) result' return result'' touchManagedPtr options return maybeResult #if ENABLE_OVERLOADING data FetchOptionsGetRemoteCallbacksMethodInfo instance (signature ~ (m (Maybe Ggit.RemoteCallbacks.RemoteCallbacks)), MonadIO m) => O.MethodInfo FetchOptionsGetRemoteCallbacksMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsGetRemoteCallbacks #endif -- method FetchOptions::set_download_tags -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "download_tags", argType = TInterface (Name {namespace = "Ggit", name = "RemoteDownloadTagsType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitRemoteDownloadTagsType.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_set_download_tags" ggit_fetch_options_set_download_tags :: Ptr FetchOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) CUInt -> -- download_tags : TInterface (Name {namespace = "Ggit", name = "RemoteDownloadTagsType"}) IO () {- | Set how tags are being handled when fetching\/downloading. -} fetchOptionsSetDownloadTags :: (B.CallStack.HasCallStack, MonadIO m) => FetchOptions {- ^ /@options@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> Ggit.Enums.RemoteDownloadTagsType {- ^ /@downloadTags@/: a 'GI.Ggit.Enums.RemoteDownloadTagsType'. -} -> m () fetchOptionsSetDownloadTags options downloadTags = liftIO $ do options' <- unsafeManagedPtrGetPtr options let downloadTags' = (fromIntegral . fromEnum) downloadTags ggit_fetch_options_set_download_tags options' downloadTags' touchManagedPtr options return () #if ENABLE_OVERLOADING data FetchOptionsSetDownloadTagsMethodInfo instance (signature ~ (Ggit.Enums.RemoteDownloadTagsType -> m ()), MonadIO m) => O.MethodInfo FetchOptionsSetDownloadTagsMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsSetDownloadTags #endif -- method FetchOptions::set_remote_callbacks -- method type : OrdinaryMethod -- Args : [Arg {argCName = "options", argType = TInterface (Name {namespace = "Ggit", name = "FetchOptions"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitFetchOptions.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callbacks", argType = TInterface (Name {namespace = "Ggit", name = "RemoteCallbacks"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GgitRemoteCallbacks or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "ggit_fetch_options_set_remote_callbacks" ggit_fetch_options_set_remote_callbacks :: Ptr FetchOptions -> -- options : TInterface (Name {namespace = "Ggit", name = "FetchOptions"}) Ptr Ggit.RemoteCallbacks.RemoteCallbacks -> -- callbacks : TInterface (Name {namespace = "Ggit", name = "RemoteCallbacks"}) IO () {- | Set the fetch options object. -} fetchOptionsSetRemoteCallbacks :: (B.CallStack.HasCallStack, MonadIO m, Ggit.RemoteCallbacks.IsRemoteCallbacks a) => FetchOptions {- ^ /@options@/: a 'GI.Ggit.Structs.FetchOptions.FetchOptions'. -} -> Maybe (a) {- ^ /@callbacks@/: a 'GI.Ggit.Objects.RemoteCallbacks.RemoteCallbacks' or 'Nothing'. -} -> m () fetchOptionsSetRemoteCallbacks options callbacks = liftIO $ do options' <- unsafeManagedPtrGetPtr options maybeCallbacks <- case callbacks of Nothing -> return nullPtr Just jCallbacks -> do jCallbacks' <- unsafeManagedPtrCastPtr jCallbacks return jCallbacks' ggit_fetch_options_set_remote_callbacks options' maybeCallbacks touchManagedPtr options whenJust callbacks touchManagedPtr return () #if ENABLE_OVERLOADING data FetchOptionsSetRemoteCallbacksMethodInfo instance (signature ~ (Maybe (a) -> m ()), MonadIO m, Ggit.RemoteCallbacks.IsRemoteCallbacks a) => O.MethodInfo FetchOptionsSetRemoteCallbacksMethodInfo FetchOptions signature where overloadedMethod _ = fetchOptionsSetRemoteCallbacks #endif #if ENABLE_OVERLOADING type family ResolveFetchOptionsMethod (t :: Symbol) (o :: *) :: * where ResolveFetchOptionsMethod "copy" o = FetchOptionsCopyMethodInfo ResolveFetchOptionsMethod "free" o = FetchOptionsFreeMethodInfo ResolveFetchOptionsMethod "getDownloadTags" o = FetchOptionsGetDownloadTagsMethodInfo ResolveFetchOptionsMethod "getRemoteCallbacks" o = FetchOptionsGetRemoteCallbacksMethodInfo ResolveFetchOptionsMethod "setDownloadTags" o = FetchOptionsSetDownloadTagsMethodInfo ResolveFetchOptionsMethod "setRemoteCallbacks" o = FetchOptionsSetRemoteCallbacksMethodInfo ResolveFetchOptionsMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveFetchOptionsMethod t FetchOptions, O.MethodInfo info FetchOptions p) => OL.IsLabel t (FetchOptions -> 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