gi-webkit2-0.2.8.12: GI/WebKit2/Structs/Credential.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.WebKit2.Structs.Credential
(
-- * Exported types
Credential(..) ,
noCredential ,
-- * Methods
-- ** credentialCopy
credentialCopy ,
-- ** credentialFree
credentialFree ,
-- ** credentialGetPassword
credentialGetPassword ,
-- ** credentialGetPersistence
credentialGetPersistence ,
-- ** credentialGetUsername
credentialGetUsername ,
-- ** credentialHasPassword
credentialHasPassword ,
-- ** credentialNew
credentialNew ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.WebKit2.Types
import GI.WebKit2.Callbacks
newtype Credential = Credential (ForeignPtr 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
noCredential :: Maybe Credential
noCredential = Nothing
-- method Credential::new
-- method type : Constructor
-- Args : [Arg {argName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "persistence", argType = TInterface "WebKit2" "CredentialPersistence", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "persistence", argType = TInterface "WebKit2" "CredentialPersistence", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "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 "WebKit2" "CredentialPersistence"
IO (Ptr Credential)
credentialNew ::
(MonadIO m) =>
T.Text -> -- username
T.Text -> -- password
CredentialPersistence -> -- persistence
m 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 "webkit_credential_new" result
result' <- (wrapBoxed Credential) result
freeMem username'
freeMem password'
return result'
-- method Credential::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "Credential"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_copy" webkit_credential_copy ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO (Ptr Credential)
credentialCopy ::
(MonadIO m) =>
Credential -> -- _obj
m Credential
credentialCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- webkit_credential_copy _obj'
checkUnexpectedReturnNULL "webkit_credential_copy" result
result' <- (wrapBoxed Credential) result
touchManagedPtr _obj
return result'
-- method Credential::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_free" webkit_credential_free ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO ()
credentialFree ::
(MonadIO m) =>
Credential -> -- _obj
m ()
credentialFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
webkit_credential_free _obj'
touchManagedPtr _obj
return ()
-- method Credential::get_password
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_get_password" webkit_credential_get_password ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO CString
credentialGetPassword ::
(MonadIO m) =>
Credential -> -- _obj
m T.Text
credentialGetPassword _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- webkit_credential_get_password _obj'
checkUnexpectedReturnNULL "webkit_credential_get_password" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method Credential::get_persistence
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "CredentialPersistence"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_get_persistence" webkit_credential_get_persistence ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO CUInt
credentialGetPersistence ::
(MonadIO m) =>
Credential -> -- _obj
m CredentialPersistence
credentialGetPersistence _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- webkit_credential_get_persistence _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method Credential::get_username
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_get_username" webkit_credential_get_username ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO CString
credentialGetUsername ::
(MonadIO m) =>
Credential -> -- _obj
m T.Text
credentialGetUsername _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- webkit_credential_get_username _obj'
checkUnexpectedReturnNULL "webkit_credential_get_username" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method Credential::has_password
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "webkit_credential_has_password" webkit_credential_has_password ::
Ptr Credential -> -- _obj : TInterface "WebKit2" "Credential"
IO CInt
credentialHasPassword ::
(MonadIO m) =>
Credential -> -- _obj
m Bool
credentialHasPassword _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- webkit_credential_has_password _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'