{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Soup.Objects.SessionAsync
    ( 

-- * Exported types
    SessionAsync(..)                        ,
    IsSessionAsync                          ,
    toSessionAsync                          ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveSessionAsyncMethod               ,
#endif


-- ** new #method:new#

    sessionAsyncNew                         ,




    ) 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.BasicTypes as B.Types
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Session as Soup.Session

-- | Memory-managed wrapper type.
newtype SessionAsync = SessionAsync (SP.ManagedPtr SessionAsync)
    deriving (SessionAsync -> SessionAsync -> Bool
(SessionAsync -> SessionAsync -> Bool)
-> (SessionAsync -> SessionAsync -> Bool) -> Eq SessionAsync
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionAsync -> SessionAsync -> Bool
$c/= :: SessionAsync -> SessionAsync -> Bool
== :: SessionAsync -> SessionAsync -> Bool
$c== :: SessionAsync -> SessionAsync -> Bool
Eq)

instance SP.ManagedPtrNewtype SessionAsync where
    toManagedPtr :: SessionAsync -> ManagedPtr SessionAsync
toManagedPtr (SessionAsync ManagedPtr SessionAsync
p) = ManagedPtr SessionAsync
p

foreign import ccall "soup_session_async_get_type"
    c_soup_session_async_get_type :: IO B.Types.GType

instance B.Types.TypedObject SessionAsync where
    glibType :: IO GType
glibType = IO GType
c_soup_session_async_get_type

instance B.Types.GObject SessionAsync

-- | Convert 'SessionAsync' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue SessionAsync where
    toGValue :: SessionAsync -> IO GValue
toGValue SessionAsync
o = do
        GType
gtype <- IO GType
c_soup_session_async_get_type
        SessionAsync -> (Ptr SessionAsync -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SessionAsync
o (GType
-> (GValue -> Ptr SessionAsync -> IO ())
-> Ptr SessionAsync
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SessionAsync -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO SessionAsync
fromGValue GValue
gv = do
        Ptr SessionAsync
ptr <- GValue -> IO (Ptr SessionAsync)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr SessionAsync)
        (ManagedPtr SessionAsync -> SessionAsync)
-> Ptr SessionAsync -> IO SessionAsync
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SessionAsync -> SessionAsync
SessionAsync Ptr SessionAsync
ptr
        
    

-- | Type class for types which can be safely cast to `SessionAsync`, for instance with `toSessionAsync`.
class (SP.GObject o, O.IsDescendantOf SessionAsync o) => IsSessionAsync o
instance (SP.GObject o, O.IsDescendantOf SessionAsync o) => IsSessionAsync o

instance O.HasParentTypes SessionAsync
type instance O.ParentTypes SessionAsync = '[Soup.Session.Session, GObject.Object.Object]

-- | Cast to `SessionAsync`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toSessionAsync :: (MonadIO m, IsSessionAsync o) => o -> m SessionAsync
toSessionAsync :: o -> m SessionAsync
toSessionAsync = IO SessionAsync -> m SessionAsync
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SessionAsync -> m SessionAsync)
-> (o -> IO SessionAsync) -> o -> m SessionAsync
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SessionAsync -> SessionAsync) -> o -> IO SessionAsync
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr SessionAsync -> SessionAsync
SessionAsync

#if defined(ENABLE_OVERLOADING)
type family ResolveSessionAsyncMethod (t :: Symbol) (o :: *) :: * where
    ResolveSessionAsyncMethod "abort" o = Soup.Session.SessionAbortMethodInfo
    ResolveSessionAsyncMethod "addFeature" o = Soup.Session.SessionAddFeatureMethodInfo
    ResolveSessionAsyncMethod "addFeatureByType" o = Soup.Session.SessionAddFeatureByTypeMethodInfo
    ResolveSessionAsyncMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSessionAsyncMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSessionAsyncMethod "cancelMessage" o = Soup.Session.SessionCancelMessageMethodInfo
    ResolveSessionAsyncMethod "connectAsync" o = Soup.Session.SessionConnectAsyncMethodInfo
    ResolveSessionAsyncMethod "connectFinish" o = Soup.Session.SessionConnectFinishMethodInfo
    ResolveSessionAsyncMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSessionAsyncMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSessionAsyncMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSessionAsyncMethod "hasFeature" o = Soup.Session.SessionHasFeatureMethodInfo
    ResolveSessionAsyncMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSessionAsyncMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSessionAsyncMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSessionAsyncMethod "pauseMessage" o = Soup.Session.SessionPauseMessageMethodInfo
    ResolveSessionAsyncMethod "prefetchDns" o = Soup.Session.SessionPrefetchDnsMethodInfo
    ResolveSessionAsyncMethod "prepareForUri" o = Soup.Session.SessionPrepareForUriMethodInfo
    ResolveSessionAsyncMethod "queueMessage" o = Soup.Session.SessionQueueMessageMethodInfo
    ResolveSessionAsyncMethod "redirectMessage" o = Soup.Session.SessionRedirectMessageMethodInfo
    ResolveSessionAsyncMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSessionAsyncMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSessionAsyncMethod "removeFeature" o = Soup.Session.SessionRemoveFeatureMethodInfo
    ResolveSessionAsyncMethod "removeFeatureByType" o = Soup.Session.SessionRemoveFeatureByTypeMethodInfo
    ResolveSessionAsyncMethod "request" o = Soup.Session.SessionRequestMethodInfo
    ResolveSessionAsyncMethod "requestHttp" o = Soup.Session.SessionRequestHttpMethodInfo
    ResolveSessionAsyncMethod "requestHttpUri" o = Soup.Session.SessionRequestHttpUriMethodInfo
    ResolveSessionAsyncMethod "requestUri" o = Soup.Session.SessionRequestUriMethodInfo
    ResolveSessionAsyncMethod "requeueMessage" o = Soup.Session.SessionRequeueMessageMethodInfo
    ResolveSessionAsyncMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSessionAsyncMethod "send" o = Soup.Session.SessionSendMethodInfo
    ResolveSessionAsyncMethod "sendAsync" o = Soup.Session.SessionSendAsyncMethodInfo
    ResolveSessionAsyncMethod "sendFinish" o = Soup.Session.SessionSendFinishMethodInfo
    ResolveSessionAsyncMethod "sendMessage" o = Soup.Session.SessionSendMessageMethodInfo
    ResolveSessionAsyncMethod "stealConnection" o = Soup.Session.SessionStealConnectionMethodInfo
    ResolveSessionAsyncMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSessionAsyncMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSessionAsyncMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSessionAsyncMethod "unpauseMessage" o = Soup.Session.SessionUnpauseMessageMethodInfo
    ResolveSessionAsyncMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSessionAsyncMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSessionAsyncMethod "websocketConnectAsync" o = Soup.Session.SessionWebsocketConnectAsyncMethodInfo
    ResolveSessionAsyncMethod "websocketConnectFinish" o = Soup.Session.SessionWebsocketConnectFinishMethodInfo
    ResolveSessionAsyncMethod "wouldRedirect" o = Soup.Session.SessionWouldRedirectMethodInfo
    ResolveSessionAsyncMethod "getAsyncContext" o = Soup.Session.SessionGetAsyncContextMethodInfo
    ResolveSessionAsyncMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSessionAsyncMethod "getFeature" o = Soup.Session.SessionGetFeatureMethodInfo
    ResolveSessionAsyncMethod "getFeatureForMessage" o = Soup.Session.SessionGetFeatureForMessageMethodInfo
    ResolveSessionAsyncMethod "getFeatures" o = Soup.Session.SessionGetFeaturesMethodInfo
    ResolveSessionAsyncMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSessionAsyncMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSessionAsyncMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSessionAsyncMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSessionAsyncMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSessionAsyncMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSessionAsyncMethod t SessionAsync, O.MethodInfo info SessionAsync p) => OL.IsLabel t (SessionAsync -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SessionAsync
type instance O.AttributeList SessionAsync = SessionAsyncAttributeList
type SessionAsyncAttributeList = ('[ '("acceptLanguage", Soup.Session.SessionAcceptLanguagePropertyInfo), '("acceptLanguageAuto", Soup.Session.SessionAcceptLanguageAutoPropertyInfo), '("asyncContext", Soup.Session.SessionAsyncContextPropertyInfo), '("httpAliases", Soup.Session.SessionHttpAliasesPropertyInfo), '("httpsAliases", Soup.Session.SessionHttpsAliasesPropertyInfo), '("idleTimeout", Soup.Session.SessionIdleTimeoutPropertyInfo), '("localAddress", Soup.Session.SessionLocalAddressPropertyInfo), '("maxConns", Soup.Session.SessionMaxConnsPropertyInfo), '("maxConnsPerHost", Soup.Session.SessionMaxConnsPerHostPropertyInfo), '("proxyResolver", Soup.Session.SessionProxyResolverPropertyInfo), '("proxyUri", Soup.Session.SessionProxyUriPropertyInfo), '("sslCaFile", Soup.Session.SessionSslCaFilePropertyInfo), '("sslStrict", Soup.Session.SessionSslStrictPropertyInfo), '("sslUseSystemCaFile", Soup.Session.SessionSslUseSystemCaFilePropertyInfo), '("timeout", Soup.Session.SessionTimeoutPropertyInfo), '("tlsDatabase", Soup.Session.SessionTlsDatabasePropertyInfo), '("tlsInteraction", Soup.Session.SessionTlsInteractionPropertyInfo), '("useNtlm", Soup.Session.SessionUseNtlmPropertyInfo), '("useThreadContext", Soup.Session.SessionUseThreadContextPropertyInfo), '("userAgent", Soup.Session.SessionUserAgentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SessionAsync = SessionAsyncSignalList
type SessionAsyncSignalList = ('[ '("authenticate", Soup.Session.SessionAuthenticateSignalInfo), '("connectionCreated", Soup.Session.SessionConnectionCreatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("requestQueued", Soup.Session.SessionRequestQueuedSignalInfo), '("requestStarted", Soup.Session.SessionRequestStartedSignalInfo), '("requestUnqueued", Soup.Session.SessionRequestUnqueuedSignalInfo), '("tunneling", Soup.Session.SessionTunnelingSignalInfo)] :: [(Symbol, *)])

#endif

-- method SessionAsync::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Soup" , name = "SessionAsync" })
-- throws : False
-- Skip return : False

foreign import ccall "soup_session_async_new" soup_session_async_new :: 
    IO (Ptr SessionAsync)

{-# DEPRECATED sessionAsyncNew ["t'GI.Soup.Objects.SessionAsync.SessionAsync' is deprecated; use a plain","t'GI.Soup.Objects.Session.Session', created with 'GI.Soup.Objects.Session.sessionNew'. See the \\<link","linkend=\\\"libsoup-session-porting\\\">porting guide\\<\\/link>."] #-}
-- | Creates an asynchronous t'GI.Soup.Objects.Session.Session' with the default options.
sessionAsyncNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SessionAsync
    -- ^ __Returns:__ the new session.
sessionAsyncNew :: m SessionAsync
sessionAsyncNew  = IO SessionAsync -> m SessionAsync
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SessionAsync -> m SessionAsync)
-> IO SessionAsync -> m SessionAsync
forall a b. (a -> b) -> a -> b
$ do
    Ptr SessionAsync
result <- IO (Ptr SessionAsync)
soup_session_async_new
    Text -> Ptr SessionAsync -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sessionAsyncNew" Ptr SessionAsync
result
    SessionAsync
result' <- ((ManagedPtr SessionAsync -> SessionAsync)
-> Ptr SessionAsync -> IO SessionAsync
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SessionAsync -> SessionAsync
SessionAsync) Ptr SessionAsync
result
    SessionAsync -> IO SessionAsync
forall (m :: * -> *) a. Monad m => a -> m a
return SessionAsync
result'

#if defined(ENABLE_OVERLOADING)
#endif