gi-webkit2-0.2.10.12: GI/WebKit2/Objects/AuthenticationRequest.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.Objects.AuthenticationRequest
(
-- * Exported types
AuthenticationRequest(..) ,
AuthenticationRequestK ,
toAuthenticationRequest ,
noAuthenticationRequest ,
-- * Methods
-- ** authenticationRequestAuthenticate
authenticationRequestAuthenticate ,
-- ** authenticationRequestCanSaveCredentials
authenticationRequestCanSaveCredentials ,
-- ** authenticationRequestCancel
authenticationRequestCancel ,
-- ** authenticationRequestGetHost
authenticationRequestGetHost ,
-- ** authenticationRequestGetPort
authenticationRequestGetPort ,
-- ** authenticationRequestGetProposedCredential
authenticationRequestGetProposedCredential,
-- ** authenticationRequestGetRealm
authenticationRequestGetRealm ,
-- ** authenticationRequestGetScheme
authenticationRequestGetScheme ,
-- ** authenticationRequestIsForProxy
authenticationRequestIsForProxy ,
-- ** authenticationRequestIsRetry
authenticationRequestIsRetry ,
-- * Signals
-- ** Cancelled
AuthenticationRequestCancelledCallback ,
AuthenticationRequestCancelledCallbackC ,
AuthenticationRequestCancelledSignalInfo,
afterAuthenticationRequestCancelled ,
authenticationRequestCancelledCallbackWrapper,
authenticationRequestCancelledClosure ,
mkAuthenticationRequestCancelledCallback,
noAuthenticationRequestCancelledCallback,
onAuthenticationRequestCancelled ,
) 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
import qualified GI.GObject as GObject
newtype AuthenticationRequest = AuthenticationRequest (ForeignPtr AuthenticationRequest)
foreign import ccall "webkit_authentication_request_get_type"
c_webkit_authentication_request_get_type :: IO GType
type instance ParentTypes AuthenticationRequest = AuthenticationRequestParentTypes
type AuthenticationRequestParentTypes = '[GObject.Object]
instance GObject AuthenticationRequest where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_webkit_authentication_request_get_type
class GObject o => AuthenticationRequestK o
instance (GObject o, IsDescendantOf AuthenticationRequest o) => AuthenticationRequestK o
toAuthenticationRequest :: AuthenticationRequestK o => o -> IO AuthenticationRequest
toAuthenticationRequest = unsafeCastTo AuthenticationRequest
noAuthenticationRequest :: Maybe AuthenticationRequest
noAuthenticationRequest = Nothing
-- signal AuthenticationRequest::cancelled
type AuthenticationRequestCancelledCallback =
IO ()
noAuthenticationRequestCancelledCallback :: Maybe AuthenticationRequestCancelledCallback
noAuthenticationRequestCancelledCallback = Nothing
type AuthenticationRequestCancelledCallbackC =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkAuthenticationRequestCancelledCallback :: AuthenticationRequestCancelledCallbackC -> IO (FunPtr AuthenticationRequestCancelledCallbackC)
authenticationRequestCancelledClosure :: AuthenticationRequestCancelledCallback -> IO Closure
authenticationRequestCancelledClosure cb = newCClosure =<< mkAuthenticationRequestCancelledCallback wrapped
where wrapped = authenticationRequestCancelledCallbackWrapper cb
authenticationRequestCancelledCallbackWrapper ::
AuthenticationRequestCancelledCallback ->
Ptr () ->
Ptr () ->
IO ()
authenticationRequestCancelledCallbackWrapper _cb _ _ = do
_cb
onAuthenticationRequestCancelled :: (GObject a, MonadIO m) => a -> AuthenticationRequestCancelledCallback -> m SignalHandlerId
onAuthenticationRequestCancelled obj cb = liftIO $ connectAuthenticationRequestCancelled obj cb SignalConnectBefore
afterAuthenticationRequestCancelled :: (GObject a, MonadIO m) => a -> AuthenticationRequestCancelledCallback -> m SignalHandlerId
afterAuthenticationRequestCancelled obj cb = connectAuthenticationRequestCancelled obj cb SignalConnectAfter
connectAuthenticationRequestCancelled :: (GObject a, MonadIO m) =>
a -> AuthenticationRequestCancelledCallback -> SignalConnectMode -> m SignalHandlerId
connectAuthenticationRequestCancelled obj cb after = liftIO $ do
cb' <- mkAuthenticationRequestCancelledCallback (authenticationRequestCancelledCallbackWrapper cb)
connectSignalFunPtr obj "cancelled" cb' after
type instance AttributeList AuthenticationRequest = AuthenticationRequestAttributeList
type AuthenticationRequestAttributeList = ('[ ] :: [(Symbol, *)])
data AuthenticationRequestCancelledSignalInfo
instance SignalInfo AuthenticationRequestCancelledSignalInfo where
type HaskellCallbackType AuthenticationRequestCancelledSignalInfo = AuthenticationRequestCancelledCallback
connectSignal _ = connectAuthenticationRequestCancelled
type instance SignalList AuthenticationRequest = AuthenticationRequestSignalList
type AuthenticationRequestSignalList = ('[ '("cancelled", AuthenticationRequestCancelledSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method AuthenticationRequest::authenticate
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "credential", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "credential", argType = TInterface "WebKit2" "Credential", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_authenticate" webkit_authentication_request_authenticate ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
Ptr Credential -> -- credential : TInterface "WebKit2" "Credential"
IO ()
authenticationRequestAuthenticate ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
Maybe (Credential) -> -- credential
m ()
authenticationRequestAuthenticate _obj credential = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCredential <- case credential of
Nothing -> return nullPtr
Just jCredential -> do
let jCredential' = unsafeManagedPtrGetPtr jCredential
return jCredential'
webkit_authentication_request_authenticate _obj' maybeCredential
touchManagedPtr _obj
whenJust credential touchManagedPtr
return ()
-- method AuthenticationRequest::can_save_credentials
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_can_save_credentials" webkit_authentication_request_can_save_credentials ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CInt
authenticationRequestCanSaveCredentials ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m Bool
authenticationRequestCanSaveCredentials _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_can_save_credentials _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::cancel
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_cancel" webkit_authentication_request_cancel ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO ()
authenticationRequestCancel ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m ()
authenticationRequestCancel _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
webkit_authentication_request_cancel _obj'
touchManagedPtr _obj
return ()
-- method AuthenticationRequest::get_host
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_get_host" webkit_authentication_request_get_host ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CString
authenticationRequestGetHost ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m T.Text
authenticationRequestGetHost _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_host _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_host" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::get_port
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_get_port" webkit_authentication_request_get_port ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO Word32
authenticationRequestGetPort ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m Word32
authenticationRequestGetPort _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_port _obj'
touchManagedPtr _obj
return result
-- method AuthenticationRequest::get_proposed_credential
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", 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_authentication_request_get_proposed_credential" webkit_authentication_request_get_proposed_credential ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO (Ptr Credential)
authenticationRequestGetProposedCredential ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m Credential
authenticationRequestGetProposedCredential _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_proposed_credential _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_proposed_credential" result
result' <- (wrapBoxed Credential) result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::get_realm
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_get_realm" webkit_authentication_request_get_realm ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CString
authenticationRequestGetRealm ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m T.Text
authenticationRequestGetRealm _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_realm _obj'
checkUnexpectedReturnNULL "webkit_authentication_request_get_realm" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::get_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit2" "AuthenticationScheme"
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_get_scheme" webkit_authentication_request_get_scheme ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CUInt
authenticationRequestGetScheme ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m AuthenticationScheme
authenticationRequestGetScheme _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_get_scheme _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::is_for_proxy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_is_for_proxy" webkit_authentication_request_is_for_proxy ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CInt
authenticationRequestIsForProxy ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m Bool
authenticationRequestIsForProxy _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_is_for_proxy _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method AuthenticationRequest::is_retry
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "AuthenticationRequest", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "webkit_authentication_request_is_retry" webkit_authentication_request_is_retry ::
Ptr AuthenticationRequest -> -- _obj : TInterface "WebKit2" "AuthenticationRequest"
IO CInt
authenticationRequestIsRetry ::
(MonadIO m, AuthenticationRequestK a) =>
a -> -- _obj
m Bool
authenticationRequestIsRetry _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- webkit_authentication_request_is_retry _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'