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

A proxy object representing a collection of secrets in the Secret Service.
-}

module GI.Secret.Objects.Collection
    ( 

-- * Exported types
    Collection(..)                          ,
    IsCollection                            ,
    toCollection                            ,
    noCollection                            ,


 -- * Methods
-- ** create #method:create#
    collectionCreate                        ,


-- ** createFinish #method:createFinish#
    collectionCreateFinish                  ,


-- ** createSync #method:createSync#
    collectionCreateSync                    ,


-- ** delete #method:delete#
    CollectionDeleteMethodInfo              ,
    collectionDelete                        ,


-- ** deleteFinish #method:deleteFinish#
    CollectionDeleteFinishMethodInfo        ,
    collectionDeleteFinish                  ,


-- ** deleteSync #method:deleteSync#
    CollectionDeleteSyncMethodInfo          ,
    collectionDeleteSync                    ,


-- ** forAlias #method:forAlias#
    collectionForAlias                      ,


-- ** forAliasFinish #method:forAliasFinish#
    collectionForAliasFinish                ,


-- ** forAliasSync #method:forAliasSync#
    collectionForAliasSync                  ,


-- ** getCreated #method:getCreated#
    CollectionGetCreatedMethodInfo          ,
    collectionGetCreated                    ,


-- ** getFlags #method:getFlags#
    CollectionGetFlagsMethodInfo            ,
    collectionGetFlags                      ,


-- ** getItems #method:getItems#
    CollectionGetItemsMethodInfo            ,
    collectionGetItems                      ,


-- ** getLabel #method:getLabel#
    CollectionGetLabelMethodInfo            ,
    collectionGetLabel                      ,


-- ** getLocked #method:getLocked#
    CollectionGetLockedMethodInfo           ,
    collectionGetLocked                     ,


-- ** getModified #method:getModified#
    CollectionGetModifiedMethodInfo         ,
    collectionGetModified                   ,


-- ** getService #method:getService#
    CollectionGetServiceMethodInfo          ,
    collectionGetService                    ,


-- ** loadItems #method:loadItems#
    CollectionLoadItemsMethodInfo           ,
    collectionLoadItems                     ,


-- ** loadItemsFinish #method:loadItemsFinish#
    CollectionLoadItemsFinishMethodInfo     ,
    collectionLoadItemsFinish               ,


-- ** loadItemsSync #method:loadItemsSync#
    CollectionLoadItemsSyncMethodInfo       ,
    collectionLoadItemsSync                 ,


-- ** refresh #method:refresh#
    CollectionRefreshMethodInfo             ,
    collectionRefresh                       ,


-- ** search #method:search#
    CollectionSearchMethodInfo              ,
    collectionSearch                        ,


-- ** searchFinish #method:searchFinish#
    CollectionSearchFinishMethodInfo        ,
    collectionSearchFinish                  ,


-- ** searchSync #method:searchSync#
    CollectionSearchSyncMethodInfo          ,
    collectionSearchSync                    ,


-- ** setLabel #method:setLabel#
    CollectionSetLabelMethodInfo            ,
    collectionSetLabel                      ,


-- ** setLabelFinish #method:setLabelFinish#
    CollectionSetLabelFinishMethodInfo      ,
    collectionSetLabelFinish                ,


-- ** setLabelSync #method:setLabelSync#
    CollectionSetLabelSyncMethodInfo        ,
    collectionSetLabelSync                  ,




 -- * Properties
-- ** created #attr:created#
    CollectionCreatedPropertyInfo           ,
    collectionCreated                       ,
    constructCollectionCreated              ,
    getCollectionCreated                    ,
    setCollectionCreated                    ,


-- ** label #attr:label#
    CollectionLabelPropertyInfo             ,
    clearCollectionLabel                    ,
    collectionLabel                         ,
    constructCollectionLabel                ,
    getCollectionLabel                      ,
    setCollectionLabel                      ,


-- ** locked #attr:locked#
    CollectionLockedPropertyInfo            ,
    collectionLocked                        ,
    getCollectionLocked                     ,


-- ** modified #attr:modified#
    CollectionModifiedPropertyInfo          ,
    collectionModified                      ,
    constructCollectionModified             ,
    getCollectionModified                   ,
    setCollectionModified                   ,


-- ** service #attr:service#
    CollectionServicePropertyInfo           ,
    collectionService                       ,
    constructCollectionService              ,
    getCollectionService                    ,




    ) 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.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncInitable as Gio.AsyncInitable
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.DBusInterface as Gio.DBusInterface
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.DBusProxy as Gio.DBusProxy
import {-# SOURCE #-} qualified GI.Secret.Flags as Secret.Flags
import {-# SOURCE #-} qualified GI.Secret.Objects.Item as Secret.Item
import {-# SOURCE #-} qualified GI.Secret.Objects.Service as Secret.Service
import {-# SOURCE #-} qualified GI.Secret.Structs.Schema as Secret.Schema

newtype Collection = Collection (ManagedPtr Collection)
foreign import ccall "secret_collection_get_type"
    c_secret_collection_get_type :: IO GType

instance GObject Collection where
    gobjectType _ = c_secret_collection_get_type
    

class GObject o => IsCollection o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Collection a) =>
    IsCollection a
#endif
instance IsCollection Collection
instance Gio.DBusProxy.IsDBusProxy Collection
instance GObject.Object.IsObject Collection
instance Gio.AsyncInitable.IsAsyncInitable Collection
instance Gio.DBusInterface.IsDBusInterface Collection
instance Gio.Initable.IsInitable Collection

toCollection :: IsCollection o => o -> IO Collection
toCollection = unsafeCastTo Collection

noCollection :: Maybe Collection
noCollection = Nothing

type family ResolveCollectionMethod (t :: Symbol) (o :: *) :: * where
    ResolveCollectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCollectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCollectionMethod "call" o = Gio.DBusProxy.DBusProxyCallMethodInfo
    ResolveCollectionMethod "callFinish" o = Gio.DBusProxy.DBusProxyCallFinishMethodInfo
    ResolveCollectionMethod "callSync" o = Gio.DBusProxy.DBusProxyCallSyncMethodInfo
    ResolveCollectionMethod "callWithUnixFdList" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListMethodInfo
    ResolveCollectionMethod "callWithUnixFdListFinish" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListFinishMethodInfo
    ResolveCollectionMethod "callWithUnixFdListSync" o = Gio.DBusProxy.DBusProxyCallWithUnixFdListSyncMethodInfo
    ResolveCollectionMethod "delete" o = CollectionDeleteMethodInfo
    ResolveCollectionMethod "deleteFinish" o = CollectionDeleteFinishMethodInfo
    ResolveCollectionMethod "deleteSync" o = CollectionDeleteSyncMethodInfo
    ResolveCollectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCollectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCollectionMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveCollectionMethod "initAsync" o = Gio.AsyncInitable.AsyncInitableInitAsyncMethodInfo
    ResolveCollectionMethod "initFinish" o = Gio.AsyncInitable.AsyncInitableInitFinishMethodInfo
    ResolveCollectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCollectionMethod "loadItems" o = CollectionLoadItemsMethodInfo
    ResolveCollectionMethod "loadItemsFinish" o = CollectionLoadItemsFinishMethodInfo
    ResolveCollectionMethod "loadItemsSync" o = CollectionLoadItemsSyncMethodInfo
    ResolveCollectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCollectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCollectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCollectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCollectionMethod "refresh" o = CollectionRefreshMethodInfo
    ResolveCollectionMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveCollectionMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveCollectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCollectionMethod "search" o = CollectionSearchMethodInfo
    ResolveCollectionMethod "searchFinish" o = CollectionSearchFinishMethodInfo
    ResolveCollectionMethod "searchSync" o = CollectionSearchSyncMethodInfo
    ResolveCollectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCollectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCollectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCollectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCollectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCollectionMethod "getCachedProperty" o = Gio.DBusProxy.DBusProxyGetCachedPropertyMethodInfo
    ResolveCollectionMethod "getCachedPropertyNames" o = Gio.DBusProxy.DBusProxyGetCachedPropertyNamesMethodInfo
    ResolveCollectionMethod "getConnection" o = Gio.DBusProxy.DBusProxyGetConnectionMethodInfo
    ResolveCollectionMethod "getCreated" o = CollectionGetCreatedMethodInfo
    ResolveCollectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCollectionMethod "getDefaultTimeout" o = Gio.DBusProxy.DBusProxyGetDefaultTimeoutMethodInfo
    ResolveCollectionMethod "getFlags" o = CollectionGetFlagsMethodInfo
    ResolveCollectionMethod "getInfo" o = Gio.DBusInterface.DBusInterfaceGetInfoMethodInfo
    ResolveCollectionMethod "getInterfaceInfo" o = Gio.DBusProxy.DBusProxyGetInterfaceInfoMethodInfo
    ResolveCollectionMethod "getInterfaceName" o = Gio.DBusProxy.DBusProxyGetInterfaceNameMethodInfo
    ResolveCollectionMethod "getItems" o = CollectionGetItemsMethodInfo
    ResolveCollectionMethod "getLabel" o = CollectionGetLabelMethodInfo
    ResolveCollectionMethod "getLocked" o = CollectionGetLockedMethodInfo
    ResolveCollectionMethod "getModified" o = CollectionGetModifiedMethodInfo
    ResolveCollectionMethod "getName" o = Gio.DBusProxy.DBusProxyGetNameMethodInfo
    ResolveCollectionMethod "getNameOwner" o = Gio.DBusProxy.DBusProxyGetNameOwnerMethodInfo
    ResolveCollectionMethod "getObject" o = Gio.DBusInterface.DBusInterfaceGetObjectMethodInfo
    ResolveCollectionMethod "getObjectPath" o = Gio.DBusProxy.DBusProxyGetObjectPathMethodInfo
    ResolveCollectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCollectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCollectionMethod "getService" o = CollectionGetServiceMethodInfo
    ResolveCollectionMethod "setCachedProperty" o = Gio.DBusProxy.DBusProxySetCachedPropertyMethodInfo
    ResolveCollectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCollectionMethod "setDefaultTimeout" o = Gio.DBusProxy.DBusProxySetDefaultTimeoutMethodInfo
    ResolveCollectionMethod "setInterfaceInfo" o = Gio.DBusProxy.DBusProxySetInterfaceInfoMethodInfo
    ResolveCollectionMethod "setLabel" o = CollectionSetLabelMethodInfo
    ResolveCollectionMethod "setLabelFinish" o = CollectionSetLabelFinishMethodInfo
    ResolveCollectionMethod "setLabelSync" o = CollectionSetLabelSyncMethodInfo
    ResolveCollectionMethod "setObject" o = Gio.DBusInterface.DBusInterfaceSetObjectMethodInfo
    ResolveCollectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCollectionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCollectionMethod t Collection, O.MethodInfo info Collection p) => O.IsLabelProxy t (Collection -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveCollectionMethod t Collection, O.MethodInfo info Collection p) => O.IsLabel t (Collection -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- VVV Prop "created"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Nothing)

getCollectionCreated :: (MonadIO m, IsCollection o) => o -> m Word64
getCollectionCreated obj = liftIO $ getObjectPropertyUInt64 obj "created"

setCollectionCreated :: (MonadIO m, IsCollection o) => o -> Word64 -> m ()
setCollectionCreated obj val = liftIO $ setObjectPropertyUInt64 obj "created" val

constructCollectionCreated :: (IsCollection o) => Word64 -> IO (GValueConstruct o)
constructCollectionCreated val = constructObjectPropertyUInt64 "created" val

data CollectionCreatedPropertyInfo
instance AttrInfo CollectionCreatedPropertyInfo where
    type AttrAllowedOps CollectionCreatedPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint CollectionCreatedPropertyInfo = (~) Word64
    type AttrBaseTypeConstraint CollectionCreatedPropertyInfo = IsCollection
    type AttrGetType CollectionCreatedPropertyInfo = Word64
    type AttrLabel CollectionCreatedPropertyInfo = "created"
    type AttrOrigin CollectionCreatedPropertyInfo = Collection
    attrGet _ = getCollectionCreated
    attrSet _ = setCollectionCreated
    attrConstruct _ = constructCollectionCreated
    attrClear _ = undefined

-- VVV Prop "label"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

getCollectionLabel :: (MonadIO m, IsCollection o) => o -> m (Maybe T.Text)
getCollectionLabel obj = liftIO $ getObjectPropertyString obj "label"

setCollectionLabel :: (MonadIO m, IsCollection o) => o -> T.Text -> m ()
setCollectionLabel obj val = liftIO $ setObjectPropertyString obj "label" (Just val)

constructCollectionLabel :: (IsCollection o) => T.Text -> IO (GValueConstruct o)
constructCollectionLabel val = constructObjectPropertyString "label" (Just val)

clearCollectionLabel :: (MonadIO m, IsCollection o) => o -> m ()
clearCollectionLabel obj = liftIO $ setObjectPropertyString obj "label" (Nothing :: Maybe T.Text)

data CollectionLabelPropertyInfo
instance AttrInfo CollectionLabelPropertyInfo where
    type AttrAllowedOps CollectionLabelPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint CollectionLabelPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint CollectionLabelPropertyInfo = IsCollection
    type AttrGetType CollectionLabelPropertyInfo = (Maybe T.Text)
    type AttrLabel CollectionLabelPropertyInfo = "label"
    type AttrOrigin CollectionLabelPropertyInfo = Collection
    attrGet _ = getCollectionLabel
    attrSet _ = setCollectionLabel
    attrConstruct _ = constructCollectionLabel
    attrClear _ = clearCollectionLabel

-- VVV Prop "locked"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getCollectionLocked :: (MonadIO m, IsCollection o) => o -> m Bool
getCollectionLocked obj = liftIO $ getObjectPropertyBool obj "locked"

data CollectionLockedPropertyInfo
instance AttrInfo CollectionLockedPropertyInfo where
    type AttrAllowedOps CollectionLockedPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint CollectionLockedPropertyInfo = (~) ()
    type AttrBaseTypeConstraint CollectionLockedPropertyInfo = IsCollection
    type AttrGetType CollectionLockedPropertyInfo = Bool
    type AttrLabel CollectionLockedPropertyInfo = "locked"
    type AttrOrigin CollectionLockedPropertyInfo = Collection
    attrGet _ = getCollectionLocked
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "modified"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Nothing)

getCollectionModified :: (MonadIO m, IsCollection o) => o -> m Word64
getCollectionModified obj = liftIO $ getObjectPropertyUInt64 obj "modified"

setCollectionModified :: (MonadIO m, IsCollection o) => o -> Word64 -> m ()
setCollectionModified obj val = liftIO $ setObjectPropertyUInt64 obj "modified" val

constructCollectionModified :: (IsCollection o) => Word64 -> IO (GValueConstruct o)
constructCollectionModified val = constructObjectPropertyUInt64 "modified" val

data CollectionModifiedPropertyInfo
instance AttrInfo CollectionModifiedPropertyInfo where
    type AttrAllowedOps CollectionModifiedPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint CollectionModifiedPropertyInfo = (~) Word64
    type AttrBaseTypeConstraint CollectionModifiedPropertyInfo = IsCollection
    type AttrGetType CollectionModifiedPropertyInfo = Word64
    type AttrLabel CollectionModifiedPropertyInfo = "modified"
    type AttrOrigin CollectionModifiedPropertyInfo = Collection
    attrGet _ = getCollectionModified
    attrSet _ = setCollectionModified
    attrConstruct _ = constructCollectionModified
    attrClear _ = undefined

-- VVV Prop "service"
   -- Type: TInterface (Name {namespace = "Secret", name = "Service"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

getCollectionService :: (MonadIO m, IsCollection o) => o -> m Secret.Service.Service
getCollectionService obj = liftIO $ checkUnexpectedNothing "getCollectionService" $ getObjectPropertyObject obj "service" Secret.Service.Service

constructCollectionService :: (IsCollection o, Secret.Service.IsService a) => a -> IO (GValueConstruct o)
constructCollectionService val = constructObjectPropertyObject "service" (Just val)

data CollectionServicePropertyInfo
instance AttrInfo CollectionServicePropertyInfo where
    type AttrAllowedOps CollectionServicePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint CollectionServicePropertyInfo = Secret.Service.IsService
    type AttrBaseTypeConstraint CollectionServicePropertyInfo = IsCollection
    type AttrGetType CollectionServicePropertyInfo = Secret.Service.Service
    type AttrLabel CollectionServicePropertyInfo = "service"
    type AttrOrigin CollectionServicePropertyInfo = Collection
    attrGet _ = getCollectionService
    attrSet _ = undefined
    attrConstruct _ = constructCollectionService
    attrClear _ = undefined

instance O.HasAttributeList Collection
type instance O.AttributeList Collection = CollectionAttributeList
type CollectionAttributeList = ('[ '("created", CollectionCreatedPropertyInfo), '("gBusType", Gio.DBusProxy.DBusProxyGBusTypePropertyInfo), '("gConnection", Gio.DBusProxy.DBusProxyGConnectionPropertyInfo), '("gDefaultTimeout", Gio.DBusProxy.DBusProxyGDefaultTimeoutPropertyInfo), '("gFlags", Gio.DBusProxy.DBusProxyGFlagsPropertyInfo), '("gInterfaceInfo", Gio.DBusProxy.DBusProxyGInterfaceInfoPropertyInfo), '("gInterfaceName", Gio.DBusProxy.DBusProxyGInterfaceNamePropertyInfo), '("gName", Gio.DBusProxy.DBusProxyGNamePropertyInfo), '("gNameOwner", Gio.DBusProxy.DBusProxyGNameOwnerPropertyInfo), '("gObjectPath", Gio.DBusProxy.DBusProxyGObjectPathPropertyInfo), '("label", CollectionLabelPropertyInfo), '("locked", CollectionLockedPropertyInfo), '("modified", CollectionModifiedPropertyInfo), '("service", CollectionServicePropertyInfo)] :: [(Symbol, *)])

collectionCreated :: AttrLabelProxy "created"
collectionCreated = AttrLabelProxy

collectionLabel :: AttrLabelProxy "label"
collectionLabel = AttrLabelProxy

collectionLocked :: AttrLabelProxy "locked"
collectionLocked = AttrLabelProxy

collectionModified :: AttrLabelProxy "modified"
collectionModified = AttrLabelProxy

collectionService :: AttrLabelProxy "service"
collectionService = AttrLabelProxy

type instance O.SignalList Collection = CollectionSignalList
type CollectionSignalList = ('[ '("gPropertiesChanged", Gio.DBusProxy.DBusProxyGPropertiesChangedSignalInfo), '("gSignal", Gio.DBusProxy.DBusProxyGSignalSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Collection::delete
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", 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 "optional cancellation object", 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 "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 3, 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 the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_delete" secret_collection_delete :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    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 ()

{- |
Delete this collection.

This method returns immediately and completes asynchronously. The secret
service may prompt the user. 'GI.Secret.Objects.Service.servicePrompt' will be used to handle
any prompts that show up.
-}
collectionDelete ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a collection -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionDelete self cancellable callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_delete self' maybeCancellable maybeCallback userData
    touchManagedPtr self
    whenJust cancellable touchManagedPtr
    return ()

data CollectionDeleteMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionDeleteMethodInfo a signature where
    overloadedMethod _ = collectionDelete

-- method Collection::delete_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", 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 "asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_delete_finish" secret_collection_delete_finish :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Complete operation to delete this collection.
-}
collectionDeleteFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@self@/: a collection -}
    -> b
    {- ^ /@result@/: asynchronous result passed to the callback -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionDeleteFinish self result_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ secret_collection_delete_finish self' result_'
        touchManagedPtr self
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data CollectionDeleteFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo CollectionDeleteFinishMethodInfo a signature where
    overloadedMethod _ = collectionDeleteFinish

-- method Collection::delete_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_delete_sync" secret_collection_delete_sync :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Delete this collection.

This method may block indefinitely and should not be used in user
interface threads. The secret service may prompt the user.
'GI.Secret.Objects.Service.servicePrompt' will be used to handle any prompts that show up.
-}
collectionDeleteSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a collection -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionDeleteSync self cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ secret_collection_delete_sync self' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data CollectionDeleteSyncMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionDeleteSyncMethodInfo a signature where
    overloadedMethod _ = collectionDeleteSync

-- method Collection::get_created
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_created" secret_collection_get_created :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO Word64

{- |
Get the created date and time of the collection. The return value is
the number of seconds since the unix epoch, January 1st 1970.
-}
collectionGetCreated ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m Word64
    {- ^ __Returns:__ the created date and time -}
collectionGetCreated self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_created self'
    touchManagedPtr self
    return result

data CollectionGetCreatedMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetCreatedMethodInfo a signature where
    overloadedMethod _ = collectionGetCreated

-- method Collection::get_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the secret collection proxy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "CollectionFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_flags" secret_collection_get_flags :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO CUInt

{- |
Get the flags representing what features of the 'GI.Secret.Objects.Collection.Collection' proxy
have been initialized.

Use 'GI.Secret.Objects.Collection.collectionLoadItems'  to initialize further features
and change the flags.
-}
collectionGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: the secret collection proxy -}
    -> m [Secret.Flags.CollectionFlags]
    {- ^ __Returns:__ the flags for features initialized -}
collectionGetFlags self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_flags self'
    let result' = wordToGFlags result
    touchManagedPtr self
    return result'

data CollectionGetFlagsMethodInfo
instance (signature ~ (m [Secret.Flags.CollectionFlags]), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetFlagsMethodInfo a signature where
    overloadedMethod _ = collectionGetFlags

-- method Collection::get_items
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Secret", name = "Item"})))
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_items" secret_collection_get_items :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO (Ptr (GList (Ptr Secret.Item.Item)))

{- |
Get the list of items in this collection.
-}
collectionGetItems ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m [Secret.Item.Item]
    {- ^ __Returns:__ a list of items,
when done, the list should be freed with g_list_free, and each item should
be released with 'GI.GObject.Objects.Object.objectUnref' -}
collectionGetItems self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_items self'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Secret.Item.Item) result'
    g_list_free result
    touchManagedPtr self
    return result''

data CollectionGetItemsMethodInfo
instance (signature ~ (m [Secret.Item.Item]), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetItemsMethodInfo a signature where
    overloadedMethod _ = collectionGetItems

-- method Collection::get_label
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_label" secret_collection_get_label :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO CString

{- |
Get the label of this collection.
-}
collectionGetLabel ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m T.Text
    {- ^ __Returns:__ the label, which should be freed with 'GI.GLib.Functions.free' -}
collectionGetLabel self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_label self'
    checkUnexpectedReturnNULL "collectionGetLabel" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

data CollectionGetLabelMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetLabelMethodInfo a signature where
    overloadedMethod _ = collectionGetLabel

-- method Collection::get_locked
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_locked" secret_collection_get_locked :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO CInt

{- |
Get whether the collection is locked or not.

Use 'GI.Secret.Objects.Service.serviceLock' or 'GI.Secret.Objects.Service.serviceUnlock' to lock or unlock the
collection.
-}
collectionGetLocked ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m Bool
    {- ^ __Returns:__ whether the collection is locked or not -}
collectionGetLocked self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_locked self'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

data CollectionGetLockedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetLockedMethodInfo a signature where
    overloadedMethod _ = collectionGetLocked

-- method Collection::get_modified
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_modified" secret_collection_get_modified :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO Word64

{- |
Get the modified date and time of the collection. The return value is
the number of seconds since the unix epoch, January 1st 1970.
-}
collectionGetModified ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m Word64
    {- ^ __Returns:__ the modified date and time -}
collectionGetModified self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_modified self'
    touchManagedPtr self
    return result

data CollectionGetModifiedMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetModifiedMethodInfo a signature where
    overloadedMethod _ = collectionGetModified

-- method Collection::get_service
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "Service"}))
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_get_service" secret_collection_get_service :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO (Ptr Secret.Service.Service)

{- |
Get the Secret Service object that this collection was created with.
-}
collectionGetService ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: a collection -}
    -> m Secret.Service.Service
    {- ^ __Returns:__ the Secret Service object -}
collectionGetService self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- secret_collection_get_service self'
    checkUnexpectedReturnNULL "collectionGetService" result
    result' <- (newObject Secret.Service.Service) result
    touchManagedPtr self
    return result'

data CollectionGetServiceMethodInfo
instance (signature ~ (m Secret.Service.Service), MonadIO m, IsCollection a) => O.MethodInfo CollectionGetServiceMethodInfo a signature where
    overloadedMethod _ = collectionGetService

-- method Collection::load_items
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the secret collection", 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 "optional cancellation object", 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 "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to be passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_load_items" secret_collection_load_items :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    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 ()

{- |
Ensure that the 'GI.Secret.Objects.Collection.Collection' proxy has loaded all the items present
in the Secret Service. This affects the result of
'GI.Secret.Objects.Collection.collectionGetItems'.

For collections returned from 'GI.Secret.Objects.Service.serviceGetCollections' the items
will have already been loaded.

This method will return immediately and complete asynchronously.
-}
collectionLoadItems ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: the secret collection -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionLoadItems self cancellable callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_load_items self' maybeCancellable maybeCallback userData
    touchManagedPtr self
    whenJust cancellable touchManagedPtr
    return ()

data CollectionLoadItemsMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionLoadItemsMethodInfo a signature where
    overloadedMethod _ = collectionLoadItems

-- method Collection::load_items_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the secret collection", 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 "the asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_load_items_finish" secret_collection_load_items_finish :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Complete an asynchronous operation to ensure that the 'GI.Secret.Objects.Collection.Collection' proxy
has loaded all the items present in the Secret Service.
-}
collectionLoadItemsFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@self@/: the secret collection -}
    -> b
    {- ^ /@result@/: the asynchronous result passed to the callback -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionLoadItemsFinish self result_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ secret_collection_load_items_finish self' result_'
        touchManagedPtr self
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data CollectionLoadItemsFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo CollectionLoadItemsFinishMethodInfo a signature where
    overloadedMethod _ = collectionLoadItemsFinish

-- method Collection::load_items_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the secret collection", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_load_items_sync" secret_collection_load_items_sync :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Ensure that the 'GI.Secret.Objects.Collection.Collection' proxy has loaded all the items present
in the Secret Service. This affects the result of
'GI.Secret.Objects.Collection.collectionGetItems'.

For collections returned from 'GI.Secret.Objects.Service.serviceGetCollections' the items
will have already been loaded.

This method may block indefinitely and should not be used in user interface
threads.
-}
collectionLoadItemsSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: the secret collection -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionLoadItemsSync self cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ secret_collection_load_items_sync self' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        return ()
     ) (do
        return ()
     )

data CollectionLoadItemsSyncMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionLoadItemsSyncMethodInfo a signature where
    overloadedMethod _ = collectionLoadItemsSync

-- method Collection::refresh
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_refresh" secret_collection_refresh :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    IO ()

{- |
Refresh the properties on this collection. This fires off a request to
refresh, and the properties will be updated later.

Calling this method is not normally necessary, as the secret service
will notify the client when properties change.
-}
collectionRefresh ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a) =>
    a
    {- ^ /@self@/: the collection -}
    -> m ()
collectionRefresh self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    secret_collection_refresh self'
    touchManagedPtr self
    return ()

data CollectionRefreshMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCollection a) => O.MethodInfo CollectionRefreshMethodInfo a signature where
    overloadedMethod _ = collectionRefresh

-- method Collection::search
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a secret collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the schema for the attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "search for items matching these attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "SearchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "search option flags", 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 "optional cancellation object", 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 "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 6, 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 the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_search" secret_collection_search :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Secret.Schema.Schema ->             -- schema : TInterface (Name {namespace = "Secret", name = "Schema"})
    Ptr (GHashTable CString CString) ->     -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8)
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "SearchFlags"})
    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 ()

{- |
Search for items matching the /@attributes@/ in the /@collection@/.
The /@attributes@/ should be a table of string keys and string values.

If 'GI.Secret.Flags.SearchFlagsAll' is set in /@flags@/, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.

If 'GI.Secret.Flags.SearchFlagsUnlock' is set in /@flags@/, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.

If 'GI.Secret.Flags.SearchFlagsLoadSecrets' is set in /@flags@/, then the items will have
their secret values loaded and available via 'GI.Secret.Objects.Item.itemGetSecret'.

This function returns immediately and completes asynchronously.
-}
collectionSearch ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a secret collection -}
    -> Maybe (Secret.Schema.Schema)
    {- ^ /@schema@/: the schema for the attributes -}
    -> Map.Map T.Text T.Text
    {- ^ /@attributes@/: search for items matching these attributes -}
    -> [Secret.Flags.SearchFlags]
    {- ^ /@flags@/: search option flags -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionSearch self schema attributes flags cancellable callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeSchema <- case schema of
        Nothing -> return nullPtr
        Just jSchema -> do
            jSchema' <- unsafeManagedPtrGetPtr jSchema
            return jSchema'
    let attributes' = Map.toList attributes
    attributes'' <- mapFirstA textToCString attributes'
    attributes''' <- mapSecondA textToCString attributes''
    let attributes'''' = mapFirst cstringPackPtr attributes'''
    let attributes''''' = mapSecond cstringPackPtr attributes''''
    attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_search self' maybeSchema attributes'''''' flags' maybeCancellable maybeCallback userData
    touchManagedPtr self
    whenJust schema touchManagedPtr
    whenJust cancellable touchManagedPtr
    unrefGHashTable attributes''''''
    return ()

data CollectionSearchMethodInfo
instance (signature ~ (Maybe (Secret.Schema.Schema) -> Map.Map T.Text T.Text -> [Secret.Flags.SearchFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionSearchMethodInfo a signature where
    overloadedMethod _ = collectionSearch

-- method Collection::search_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the secret collection", 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 "asynchronous result passed to callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Secret", name = "Item"})))
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_search_finish" secret_collection_search_finish :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Secret.Item.Item)))

{- |
Complete asynchronous operation to search for items in a collection.
-}
collectionSearchFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@self@/: the secret collection -}
    -> b
    {- ^ /@result@/: asynchronous result passed to callback -}
    -> m [Secret.Item.Item]
    {- ^ __Returns:__ 
         a list of items that matched the search /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionSearchFinish self result_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ secret_collection_search_finish self' result_'
        result' <- unpackGList result
        result'' <- mapM (wrapObject Secret.Item.Item) result'
        g_list_free result
        touchManagedPtr self
        touchManagedPtr result_
        return result''
     ) (do
        return ()
     )

data CollectionSearchFinishMethodInfo
instance (signature ~ (b -> m [Secret.Item.Item]), MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo CollectionSearchFinishMethodInfo a signature where
    overloadedMethod _ = collectionSearchFinish

-- method Collection::search_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a secret collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the schema for the attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "search for items matching these attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "SearchFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "search option flags", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Secret", name = "Item"})))
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_search_sync" secret_collection_search_sync :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Secret.Schema.Schema ->             -- schema : TInterface (Name {namespace = "Secret", name = "Schema"})
    Ptr (GHashTable CString CString) ->     -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8)
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "SearchFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GList (Ptr Secret.Item.Item)))

{- |
Search for items matching the /@attributes@/ in the /@collection@/.
The /@attributes@/ should be a table of string keys and string values.

If 'GI.Secret.Flags.SearchFlagsAll' is set in /@flags@/, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.

If 'GI.Secret.Flags.SearchFlagsUnlock' is set in /@flags@/, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.

If 'GI.Secret.Flags.SearchFlagsLoadSecrets' is set in /@flags@/, then the items will have
their secret values loaded and available via 'GI.Secret.Objects.Item.itemGetSecret'.

This function may block indefinetely. Use the asynchronous version
in user interface threads.
-}
collectionSearchSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a secret collection -}
    -> Maybe (Secret.Schema.Schema)
    {- ^ /@schema@/: the schema for the attributes -}
    -> Map.Map T.Text T.Text
    {- ^ /@attributes@/: search for items matching these attributes -}
    -> [Secret.Flags.SearchFlags]
    {- ^ /@flags@/: search option flags -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m [Secret.Item.Item]
    {- ^ __Returns:__ 
         a list of items that matched the search /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionSearchSync self schema attributes flags cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeSchema <- case schema of
        Nothing -> return nullPtr
        Just jSchema -> do
            jSchema' <- unsafeManagedPtrGetPtr jSchema
            return jSchema'
    let attributes' = Map.toList attributes
    attributes'' <- mapFirstA textToCString attributes'
    attributes''' <- mapSecondA textToCString attributes''
    let attributes'''' = mapFirst cstringPackPtr attributes'''
    let attributes''''' = mapSecond cstringPackPtr attributes''''
    attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes'''''
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ secret_collection_search_sync self' maybeSchema attributes'''''' flags' maybeCancellable
        result' <- unpackGList result
        result'' <- mapM (wrapObject Secret.Item.Item) result'
        g_list_free result
        touchManagedPtr self
        whenJust schema touchManagedPtr
        whenJust cancellable touchManagedPtr
        unrefGHashTable attributes''''''
        return result''
     ) (do
        unrefGHashTable attributes''''''
     )

data CollectionSearchSyncMethodInfo
instance (signature ~ (Maybe (Secret.Schema.Schema) -> Map.Map T.Text T.Text -> [Secret.Flags.SearchFlags] -> Maybe (b) -> m [Secret.Item.Item]), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionSearchSyncMethodInfo a signature where
    overloadedMethod _ = collectionSearchSync

-- method Collection::set_label
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a new label", 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 "optional cancellation object", 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 "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, 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 the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_set_label" secret_collection_set_label :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    CString ->                              -- label : TBasicType TUTF8
    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 ()

{- |
Set the label of this collection.

This function returns immediately and completes asynchronously.
-}
collectionSetLabel ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a collection -}
    -> T.Text
    {- ^ /@label@/: a new label -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionSetLabel self label cancellable callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    label' <- textToCString label
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_set_label self' label' maybeCancellable maybeCallback userData
    touchManagedPtr self
    whenJust cancellable touchManagedPtr
    freeMem label'
    return ()

data CollectionSetLabelMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionSetLabelMethodInfo a signature where
    overloadedMethod _ = collectionSetLabel

-- method Collection::set_label_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", 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 "asynchronous result passed to callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_set_label_finish" secret_collection_set_label_finish :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Complete asynchronous operation to set the label of this collection.
-}
collectionSetLabelFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@self@/: a collection -}
    -> b
    {- ^ /@result@/: asynchronous result passed to callback -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionSetLabelFinish self result_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ secret_collection_set_label_finish self' result_'
        touchManagedPtr self
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data CollectionSetLabelFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCollection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo CollectionSetLabelFinishMethodInfo a signature where
    overloadedMethod _ = collectionSetLabelFinish

-- method Collection::set_label_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Secret", name = "Collection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a new label", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_set_label_sync" secret_collection_set_label_sync :: 
    Ptr Collection ->                       -- self : TInterface (Name {namespace = "Secret", name = "Collection"})
    CString ->                              -- label : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Set the label of this collection.

This function may block indefinetely. Use the asynchronous version
in user interface threads.
-}
collectionSetLabelSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@self@/: a collection -}
    -> T.Text
    {- ^ /@label@/: a new label -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionSetLabelSync self label cancellable = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    label' <- textToCString label
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        _ <- propagateGError $ secret_collection_set_label_sync self' label' maybeCancellable
        touchManagedPtr self
        whenJust cancellable touchManagedPtr
        freeMem label'
        return ()
     ) (do
        freeMem label'
     )

data CollectionSetLabelSyncMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m ()), MonadIO m, IsCollection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo CollectionSetLabelSyncMethodInfo a signature where
    overloadedMethod _ = collectionSetLabelSync

-- method Collection::create
-- method type : MemberFunction
-- Args : [Arg {argCName = "service", argType = TInterface (Name {namespace = "Secret", name = "Service"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a secret service object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "label for the new collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alias", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "alias to assign to the collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "CollectionCreateFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "currently unused", 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 "optional cancellation object", 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 "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 6, 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 the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_create" secret_collection_create :: 
    Ptr Secret.Service.Service ->           -- service : TInterface (Name {namespace = "Secret", name = "Service"})
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- alias : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "CollectionCreateFlags"})
    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 ()

{- |
Create a new collection in the secret service.

This method returns immediately and completes asynchronously. The secret
service may prompt the user. 'GI.Secret.Objects.Service.servicePrompt' will be used to handle
any prompts that are required.

An /@alias@/ is a well-known tag for a collection, such as \'default\' (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an /@alias@/, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.

If /@service@/ is NULL, then 'GI.Secret.Objects.Service.serviceGet' will be called to get
the default 'GI.Secret.Objects.Service.Service' proxy.
-}
collectionCreate ::
    (B.CallStack.HasCallStack, MonadIO m, Secret.Service.IsService a, Gio.Cancellable.IsCancellable b) =>
    Maybe (a)
    {- ^ /@service@/: a secret service object -}
    -> T.Text
    {- ^ /@label@/: label for the new collection -}
    -> Maybe (T.Text)
    {- ^ /@alias@/: alias to assign to the collection -}
    -> [Secret.Flags.CollectionCreateFlags]
    {- ^ /@flags@/: currently unused -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionCreate service label alias flags cancellable callback = liftIO $ do
    maybeService <- case service of
        Nothing -> return nullPtr
        Just jService -> do
            jService' <- unsafeManagedPtrCastPtr jService
            return jService'
    label' <- textToCString label
    maybeAlias <- case alias of
        Nothing -> return nullPtr
        Just jAlias -> do
            jAlias' <- textToCString jAlias
            return jAlias'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_create maybeService label' maybeAlias flags' maybeCancellable maybeCallback userData
    whenJust service touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem label'
    freeMem maybeAlias
    return ()

-- method Collection::create_finish
-- method type : MemberFunction
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "Collection"}))
-- throws : True
-- Skip return : False

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

{- |
Finish operation to create a new collection in the secret service.
-}
collectionCreateFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    {- ^ /@result@/: the asynchronous result passed to the callback -}
    -> m Collection
    {- ^ __Returns:__ the new collection, which should be unreferenced
         with 'GI.GObject.Objects.Object.objectUnref' /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionCreateFinish result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ secret_collection_create_finish result_'
        checkUnexpectedReturnNULL "collectionCreateFinish" result
        result' <- (wrapObject Collection) result
        touchManagedPtr result_
        return result'
     ) (do
        return ()
     )

-- method Collection::create_sync
-- method type : MemberFunction
-- Args : [Arg {argCName = "service", argType = TInterface (Name {namespace = "Secret", name = "Service"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a secret service object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "label for the new collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alias", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "alias to assign to the collection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "CollectionCreateFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "currently unused", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "Collection"}))
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_create_sync" secret_collection_create_sync :: 
    Ptr Secret.Service.Service ->           -- service : TInterface (Name {namespace = "Secret", name = "Service"})
    CString ->                              -- label : TBasicType TUTF8
    CString ->                              -- alias : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "CollectionCreateFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Collection)

{- |
Create a new collection in the secret service.

This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. 'GI.Secret.Objects.Service.servicePrompt'
will be used to handle any prompts that are required.

An /@alias@/ is a well-known tag for a collection, such as \'default\' (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an /@alias@/, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.

If /@service@/ is NULL, then 'GI.Secret.Objects.Service.serviceGetSync' will be called to get
the default 'GI.Secret.Objects.Service.Service' proxy.
-}
collectionCreateSync ::
    (B.CallStack.HasCallStack, MonadIO m, Secret.Service.IsService a, Gio.Cancellable.IsCancellable b) =>
    Maybe (a)
    {- ^ /@service@/: a secret service object -}
    -> T.Text
    {- ^ /@label@/: label for the new collection -}
    -> Maybe (T.Text)
    {- ^ /@alias@/: alias to assign to the collection -}
    -> [Secret.Flags.CollectionCreateFlags]
    {- ^ /@flags@/: currently unused -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m Collection
    {- ^ __Returns:__ the new collection, which should be unreferenced
         with 'GI.GObject.Objects.Object.objectUnref' /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionCreateSync service label alias flags cancellable = liftIO $ do
    maybeService <- case service of
        Nothing -> return nullPtr
        Just jService -> do
            jService' <- unsafeManagedPtrCastPtr jService
            return jService'
    label' <- textToCString label
    maybeAlias <- case alias of
        Nothing -> return nullPtr
        Just jAlias -> do
            jAlias' <- textToCString jAlias
            return jAlias'
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ secret_collection_create_sync maybeService label' maybeAlias flags' maybeCancellable
        checkUnexpectedReturnNULL "collectionCreateSync" result
        result' <- (wrapObject Collection) result
        whenJust service touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem label'
        freeMem maybeAlias
        return result'
     ) (do
        freeMem label'
        freeMem maybeAlias
     )

-- method Collection::for_alias
-- method type : MemberFunction
-- Args : [Arg {argCName = "service", argType = TInterface (Name {namespace = "Secret", name = "Service"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a secret service object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alias", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the alias to lookup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "CollectionFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "options for the collection initialization", 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 "optional cancellation object", 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 "called when the operation completes", 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 the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_collection_for_alias" secret_collection_for_alias :: 
    Ptr Secret.Service.Service ->           -- service : TInterface (Name {namespace = "Secret", name = "Service"})
    CString ->                              -- alias : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "CollectionFlags"})
    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 ()

{- |
Lookup which collection is assigned to this alias. Aliases help determine
well known collections, such as \'default\'.

If /@service@/ is NULL, then 'GI.Secret.Objects.Service.serviceGet' will be called to get
the default 'GI.Secret.Objects.Service.Service' proxy.

This method will return immediately and complete asynchronously.
-}
collectionForAlias ::
    (B.CallStack.HasCallStack, MonadIO m, Secret.Service.IsService a, Gio.Cancellable.IsCancellable b) =>
    Maybe (a)
    {- ^ /@service@/: a secret service object -}
    -> T.Text
    {- ^ /@alias@/: the alias to lookup -}
    -> [Secret.Flags.CollectionFlags]
    {- ^ /@flags@/: options for the collection initialization -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: called when the operation completes -}
    -> m ()
collectionForAlias service alias flags cancellable callback = liftIO $ do
    maybeService <- case service of
        Nothing -> return nullPtr
        Just jService -> do
            jService' <- unsafeManagedPtrCastPtr jService
            return jService'
    alias' <- textToCString alias
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            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
    secret_collection_for_alias maybeService alias' flags' maybeCancellable maybeCallback userData
    whenJust service touchManagedPtr
    whenJust cancellable touchManagedPtr
    freeMem alias'
    return ()

-- method Collection::for_alias_finish
-- method type : MemberFunction
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "asynchronous result passed to callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "Collection"}))
-- throws : True
-- Skip return : False

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

{- |
Finish an asynchronous operation to lookup which collection is assigned
to an alias.
-}
collectionForAliasFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    {- ^ /@result@/: asynchronous result passed to callback -}
    -> m Collection
    {- ^ __Returns:__ the collection, or 'Nothing' if none assigned to the alias /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionForAliasFinish result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        result <- propagateGError $ secret_collection_for_alias_finish result_'
        checkUnexpectedReturnNULL "collectionForAliasFinish" result
        result' <- (wrapObject Collection) result
        touchManagedPtr result_
        return result'
     ) (do
        return ()
     )

-- method Collection::for_alias_sync
-- method type : MemberFunction
-- Args : [Arg {argCName = "service", argType = TInterface (Name {namespace = "Secret", name = "Service"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a secret service object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alias", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the alias to lookup", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Secret", name = "CollectionFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "options for the collection initialization", 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 "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Secret", name = "Collection"}))
-- throws : True
-- Skip return : False

foreign import ccall "secret_collection_for_alias_sync" secret_collection_for_alias_sync :: 
    Ptr Secret.Service.Service ->           -- service : TInterface (Name {namespace = "Secret", name = "Service"})
    CString ->                              -- alias : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Secret", name = "CollectionFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Collection)

{- |
Lookup which collection is assigned to this alias. Aliases help determine
well known collections, such as \'default\'.

If /@service@/ is NULL, then 'GI.Secret.Objects.Service.serviceGetSync' will be called to get
the default 'GI.Secret.Objects.Service.Service' proxy.

This method may block and should not be used in user interface threads.
-}
collectionForAliasSync ::
    (B.CallStack.HasCallStack, MonadIO m, Secret.Service.IsService a, Gio.Cancellable.IsCancellable b) =>
    Maybe (a)
    {- ^ /@service@/: a secret service object -}
    -> T.Text
    {- ^ /@alias@/: the alias to lookup -}
    -> [Secret.Flags.CollectionFlags]
    {- ^ /@flags@/: options for the collection initialization -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional cancellation object -}
    -> m Collection
    {- ^ __Returns:__ the collection, or 'Nothing' if none assigned to the alias /(Can throw 'Data.GI.Base.GError.GError')/ -}
collectionForAliasSync service alias flags cancellable = liftIO $ do
    maybeService <- case service of
        Nothing -> return nullPtr
        Just jService -> do
            jService' <- unsafeManagedPtrCastPtr jService
            return jService'
    alias' <- textToCString alias
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    onException (do
        result <- propagateGError $ secret_collection_for_alias_sync maybeService alias' flags' maybeCancellable
        checkUnexpectedReturnNULL "collectionForAliasSync" result
        result' <- (wrapObject Collection) result
        whenJust service touchManagedPtr
        whenJust cancellable touchManagedPtr
        freeMem alias'
        return result'
     ) (do
        freeMem alias'
     )