{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.WebKit2.Structs.Credential ( -- * Exported types Credential(..) , noCredential , -- * Methods -- ** copy #method:copy# #if ENABLE_OVERLOADING CredentialCopyMethodInfo , #endif credentialCopy , -- ** free #method:free# #if ENABLE_OVERLOADING CredentialFreeMethodInfo , #endif credentialFree , -- ** getPassword #method:getPassword# #if ENABLE_OVERLOADING CredentialGetPasswordMethodInfo , #endif credentialGetPassword , -- ** getPersistence #method:getPersistence# #if ENABLE_OVERLOADING CredentialGetPersistenceMethodInfo , #endif credentialGetPersistence , -- ** getUsername #method:getUsername# #if ENABLE_OVERLOADING CredentialGetUsernameMethodInfo , #endif credentialGetUsername , -- ** hasPassword #method:hasPassword# #if ENABLE_OVERLOADING CredentialHasPasswordMethodInfo , #endif credentialHasPassword , -- ** new #method:new# credentialNew , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import {-# SOURCE #-} qualified GI.WebKit2.Enums as WebKit2.Enums -- | Memory-managed wrapper type. newtype Credential = Credential (ManagedPtr Credential) foreign import ccall "webkit_credential_get_type" c_webkit_credential_get_type :: IO GType instance BoxedObject Credential where boxedType _ = c_webkit_credential_get_type -- | A convenience alias for `Nothing` :: `Maybe` `Credential`. noCredential :: Maybe Credential noCredential = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList Credential type instance O.AttributeList Credential = CredentialAttributeList type CredentialAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method Credential::new -- method type : Constructor -- Args : [Arg {argCName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The username for the new credential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The password for the new credential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "persistence", argType = TInterface (Name {namespace = "WebKit2", name = "CredentialPersistence"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #WebKitCredentialPersistence of the new credential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "Credential"})) -- throws : False -- Skip return : False foreign import ccall "webkit_credential_new" webkit_credential_new :: CString -> -- username : TBasicType TUTF8 CString -> -- password : TBasicType TUTF8 CUInt -> -- persistence : TInterface (Name {namespace = "WebKit2", name = "CredentialPersistence"}) IO (Ptr Credential) {- | Create a new credential from the provided username, password and persistence mode. /Since: 2.2/ -} credentialNew :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@username@/: The username for the new credential -} -> T.Text {- ^ /@password@/: The password for the new credential -} -> WebKit2.Enums.CredentialPersistence {- ^ /@persistence@/: The 'GI.WebKit2.Enums.CredentialPersistence' of the new credential -} -> m Credential {- ^ __Returns:__ A 'GI.WebKit2.Structs.Credential.Credential'. -} credentialNew username password persistence = liftIO $ do username' <- textToCString username password' <- textToCString password let persistence' = (fromIntegral . fromEnum) persistence result <- webkit_credential_new username' password' persistence' checkUnexpectedReturnNULL "credentialNew" result result' <- (wrapBoxed Credential) result freeMem username' freeMem password' return result' #if ENABLE_OVERLOADING #endif -- method Credential::copy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCredential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "Credential"})) -- throws : False -- Skip return : False foreign import ccall "webkit_credential_copy" webkit_credential_copy :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO (Ptr Credential) {- | Make a copy of the 'GI.WebKit2.Structs.Credential.Credential'. /Since: 2.2/ -} credentialCopy :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: a 'GI.WebKit2.Structs.Credential.Credential' -} -> m Credential {- ^ __Returns:__ A copy of passed in 'GI.WebKit2.Structs.Credential.Credential' -} credentialCopy credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential result <- webkit_credential_copy credential' checkUnexpectedReturnNULL "credentialCopy" result result' <- (wrapBoxed Credential) result touchManagedPtr credential return result' #if ENABLE_OVERLOADING data CredentialCopyMethodInfo instance (signature ~ (m Credential), MonadIO m) => O.MethodInfo CredentialCopyMethodInfo Credential signature where overloadedMethod _ = credentialCopy #endif -- method Credential::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitCredential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "webkit_credential_free" webkit_credential_free :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO () {- | Free the 'GI.WebKit2.Structs.Credential.Credential'. /Since: 2.2/ -} credentialFree :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: A 'GI.WebKit2.Structs.Credential.Credential' -} -> m () credentialFree credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential webkit_credential_free credential' touchManagedPtr credential return () #if ENABLE_OVERLOADING data CredentialFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo CredentialFreeMethodInfo Credential signature where overloadedMethod _ = credentialFree #endif -- method Credential::get_password -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCredential", 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 "webkit_credential_get_password" webkit_credential_get_password :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO CString {- | Get the password currently held by this 'GI.WebKit2.Structs.Credential.Credential'. /Since: 2.2/ -} credentialGetPassword :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: a 'GI.WebKit2.Structs.Credential.Credential' -} -> m T.Text {- ^ __Returns:__ The password stored in the 'GI.WebKit2.Structs.Credential.Credential'. -} credentialGetPassword credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential result <- webkit_credential_get_password credential' checkUnexpectedReturnNULL "credentialGetPassword" result result' <- cstringToText result touchManagedPtr credential return result' #if ENABLE_OVERLOADING data CredentialGetPasswordMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredentialGetPasswordMethodInfo Credential signature where overloadedMethod _ = credentialGetPassword #endif -- method Credential::get_persistence -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCredential", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "CredentialPersistence"})) -- throws : False -- Skip return : False foreign import ccall "webkit_credential_get_persistence" webkit_credential_get_persistence :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO CUInt {- | Get the persistence mode currently held by this 'GI.WebKit2.Structs.Credential.Credential'. /Since: 2.2/ -} credentialGetPersistence :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: a 'GI.WebKit2.Structs.Credential.Credential' -} -> m WebKit2.Enums.CredentialPersistence {- ^ __Returns:__ The 'GI.WebKit2.Enums.CredentialPersistence' stored in the 'GI.WebKit2.Structs.Credential.Credential'. -} credentialGetPersistence credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential result <- webkit_credential_get_persistence credential' let result' = (toEnum . fromIntegral) result touchManagedPtr credential return result' #if ENABLE_OVERLOADING data CredentialGetPersistenceMethodInfo instance (signature ~ (m WebKit2.Enums.CredentialPersistence), MonadIO m) => O.MethodInfo CredentialGetPersistenceMethodInfo Credential signature where overloadedMethod _ = credentialGetPersistence #endif -- method Credential::get_username -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCredential", 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 "webkit_credential_get_username" webkit_credential_get_username :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO CString {- | Get the username currently held by this 'GI.WebKit2.Structs.Credential.Credential'. /Since: 2.2/ -} credentialGetUsername :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: a 'GI.WebKit2.Structs.Credential.Credential' -} -> m T.Text {- ^ __Returns:__ The username stored in the 'GI.WebKit2.Structs.Credential.Credential'. -} credentialGetUsername credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential result <- webkit_credential_get_username credential' checkUnexpectedReturnNULL "credentialGetUsername" result result' <- cstringToText result touchManagedPtr credential return result' #if ENABLE_OVERLOADING data CredentialGetUsernameMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredentialGetUsernameMethodInfo Credential signature where overloadedMethod _ = credentialGetUsername #endif -- method Credential::has_password -- method type : OrdinaryMethod -- Args : [Arg {argCName = "credential", argType = TInterface (Name {namespace = "WebKit2", name = "Credential"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitCredential", 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 "webkit_credential_has_password" webkit_credential_has_password :: Ptr Credential -> -- credential : TInterface (Name {namespace = "WebKit2", name = "Credential"}) IO CInt {- | Determine whether this credential has a password stored. /Since: 2.2/ -} credentialHasPassword :: (B.CallStack.HasCallStack, MonadIO m) => Credential {- ^ /@credential@/: a 'GI.WebKit2.Structs.Credential.Credential' -} -> m Bool {- ^ __Returns:__ 'True' if the credential has a password or 'False' otherwise. -} credentialHasPassword credential = liftIO $ do credential' <- unsafeManagedPtrGetPtr credential result <- webkit_credential_has_password credential' let result' = (/= 0) result touchManagedPtr credential return result' #if ENABLE_OVERLOADING data CredentialHasPasswordMethodInfo instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo CredentialHasPasswordMethodInfo Credential signature where overloadedMethod _ = credentialHasPassword #endif #if ENABLE_OVERLOADING type family ResolveCredentialMethod (t :: Symbol) (o :: *) :: * where ResolveCredentialMethod "copy" o = CredentialCopyMethodInfo ResolveCredentialMethod "free" o = CredentialFreeMethodInfo ResolveCredentialMethod "hasPassword" o = CredentialHasPasswordMethodInfo ResolveCredentialMethod "getPassword" o = CredentialGetPasswordMethodInfo ResolveCredentialMethod "getPersistence" o = CredentialGetPersistenceMethodInfo ResolveCredentialMethod "getUsername" o = CredentialGetUsernameMethodInfo ResolveCredentialMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveCredentialMethod t Credential, O.MethodInfo info Credential p) => OL.IsLabel t (Credential -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif