{-# 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.Interfaces.ProxyResolver
    ( 

-- * Exported types
    ProxyResolver(..)                       ,
    noProxyResolver                         ,
    IsProxyResolver                         ,
    toProxyResolver                         ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveProxyResolverMethod              ,
#endif


-- ** getProxyAsync #method:getProxyAsync#

#if defined(ENABLE_OVERLOADING)
    ProxyResolverGetProxyAsyncMethodInfo    ,
#endif
    proxyResolverGetProxyAsync              ,


-- ** getProxySync #method:getProxySync#

#if defined(ENABLE_OVERLOADING)
    ProxyResolverGetProxySyncMethodInfo     ,
#endif
    proxyResolverGetProxySync               ,




    ) 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.GI.Base.Signals as B.Signals
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.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message

-- interface ProxyResolver 
-- | Memory-managed wrapper type.
newtype ProxyResolver = ProxyResolver (ManagedPtr ProxyResolver)
    deriving (ProxyResolver -> ProxyResolver -> Bool
(ProxyResolver -> ProxyResolver -> Bool)
-> (ProxyResolver -> ProxyResolver -> Bool) -> Eq ProxyResolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProxyResolver -> ProxyResolver -> Bool
$c/= :: ProxyResolver -> ProxyResolver -> Bool
== :: ProxyResolver -> ProxyResolver -> Bool
$c== :: ProxyResolver -> ProxyResolver -> Bool
Eq)
-- | A convenience alias for `Nothing` :: `Maybe` `ProxyResolver`.
noProxyResolver :: Maybe ProxyResolver
noProxyResolver :: Maybe ProxyResolver
noProxyResolver = Maybe ProxyResolver
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ProxyResolver = ProxyResolverSignalList
type ProxyResolverSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "soup_proxy_resolver_get_type"
    c_soup_proxy_resolver_get_type :: IO GType

instance GObject ProxyResolver where
    gobjectType :: IO GType
gobjectType = IO GType
c_soup_proxy_resolver_get_type
    

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

-- | Type class for types which can be safely cast to `ProxyResolver`, for instance with `toProxyResolver`.
class (GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance (GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o

instance O.HasParentTypes ProxyResolver
type instance O.ParentTypes ProxyResolver = '[Soup.SessionFeature.SessionFeature, GObject.Object.Object]

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

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ProxyResolver
type instance O.AttributeList ProxyResolver = ProxyResolverAttributeList
type ProxyResolverAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveProxyResolverMethod (t :: Symbol) (o :: *) :: * where
    ResolveProxyResolverMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
    ResolveProxyResolverMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
    ResolveProxyResolverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveProxyResolverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveProxyResolverMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
    ResolveProxyResolverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveProxyResolverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveProxyResolverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveProxyResolverMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
    ResolveProxyResolverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveProxyResolverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveProxyResolverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveProxyResolverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveProxyResolverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveProxyResolverMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
    ResolveProxyResolverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveProxyResolverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveProxyResolverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveProxyResolverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveProxyResolverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveProxyResolverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveProxyResolverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveProxyResolverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveProxyResolverMethod "getProxyAsync" o = ProxyResolverGetProxyAsyncMethodInfo
    ResolveProxyResolverMethod "getProxySync" o = ProxyResolverGetProxySyncMethodInfo
    ResolveProxyResolverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveProxyResolverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveProxyResolverMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveProxyResolverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveProxyResolverMethod l o = O.MethodResolutionFailed l o

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

#endif

-- method ProxyResolver::get_proxy_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "proxy_resolver"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ProxyResolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "async_context"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "MainContext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface
--                 Name { namespace = "Soup" , name = "ProxyResolverCallback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_proxy_resolver_get_proxy_async" soup_proxy_resolver_get_proxy_async :: 
    Ptr ProxyResolver ->                    -- proxy_resolver : TInterface (Name {namespace = "Soup", name = "ProxyResolver"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr GLib.MainContext.MainContext ->     -- async_context : TInterface (Name {namespace = "GLib", name = "MainContext"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Soup.Callbacks.C_ProxyResolverCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "ProxyResolverCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{-# DEPRECATED proxyResolverGetProxyAsync ["(Since version 2.28)","Use SoupProxyURIResolver.get_proxy_uri_async instead"] #-}
-- | /No description available in the introspection data./
proxyResolverGetProxyAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
    a
    -> b
    -> GLib.MainContext.MainContext
    -> Maybe (c)
    -> Soup.Callbacks.ProxyResolverCallback
    -> m ()
proxyResolverGetProxyAsync :: a -> b -> MainContext -> Maybe c -> ProxyResolverCallback -> m ()
proxyResolverGetProxyAsync proxyResolver :: a
proxyResolver msg :: b
msg asyncContext :: MainContext
asyncContext cancellable :: Maybe c
cancellable callback :: ProxyResolverCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr ProxyResolver
proxyResolver' <- a -> IO (Ptr ProxyResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
proxyResolver
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    Ptr MainContext
asyncContext' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
asyncContext
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback <- IO (Ptr (FunPtr C_ProxyResolverCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_ProxyResolverCallback))
    FunPtr C_ProxyResolverCallback
callback' <- C_ProxyResolverCallback -> IO (FunPtr C_ProxyResolverCallback)
Soup.Callbacks.mk_ProxyResolverCallback (Maybe (Ptr (FunPtr C_ProxyResolverCallback))
-> ProxyResolverCallback_WithClosures -> C_ProxyResolverCallback
Soup.Callbacks.wrap_ProxyResolverCallback (Ptr (FunPtr C_ProxyResolverCallback)
-> Maybe (Ptr (FunPtr C_ProxyResolverCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback) (ProxyResolverCallback -> ProxyResolverCallback_WithClosures
Soup.Callbacks.drop_closures_ProxyResolverCallback ProxyResolverCallback
callback))
    Ptr (FunPtr C_ProxyResolverCallback)
-> FunPtr C_ProxyResolverCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_ProxyResolverCallback)
ptrcallback FunPtr C_ProxyResolverCallback
callback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr ProxyResolver
-> Ptr Message
-> Ptr MainContext
-> Ptr Cancellable
-> FunPtr C_ProxyResolverCallback
-> Ptr ()
-> IO ()
soup_proxy_resolver_get_proxy_async Ptr ProxyResolver
proxyResolver' Ptr Message
msg' Ptr MainContext
asyncContext' Ptr Cancellable
maybeCancellable FunPtr C_ProxyResolverCallback
callback' Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
proxyResolver
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
asyncContext
    Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ProxyResolverGetProxyAsyncMethodInfo
instance (signature ~ (b -> GLib.MainContext.MainContext -> Maybe (c) -> Soup.Callbacks.ProxyResolverCallback -> m ()), MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo ProxyResolverGetProxyAsyncMethodInfo a signature where
    overloadedMethod = proxyResolverGetProxyAsync

#endif

-- method ProxyResolver::get_proxy_sync
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "proxy_resolver"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "ProxyResolver" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "addr"
--           , argType =
--               TInterface Name { namespace = "Soup" , name = "Address" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "soup_proxy_resolver_get_proxy_sync" soup_proxy_resolver_get_proxy_sync :: 
    Ptr ProxyResolver ->                    -- proxy_resolver : TInterface (Name {namespace = "Soup", name = "ProxyResolver"})
    Ptr Soup.Message.Message ->             -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr Soup.Address.Address) ->       -- addr : TInterface (Name {namespace = "Soup", name = "Address"})
    IO Word32

{-# DEPRECATED proxyResolverGetProxySync ["(Since version 2.28)","Use SoupProxyURIResolver.@/get_proxy_uri_sync()/@ instead"] #-}
-- | /No description available in the introspection data./
proxyResolverGetProxySync ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) =>
    a
    -> b
    -> Maybe (c)
    -> m ((Word32, Soup.Address.Address))
proxyResolverGetProxySync :: a -> b -> Maybe c -> m (Word32, Address)
proxyResolverGetProxySync proxyResolver :: a
proxyResolver msg :: b
msg cancellable :: Maybe c
cancellable = IO (Word32, Address) -> m (Word32, Address)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Word32, Address) -> m (Word32, Address))
-> IO (Word32, Address) -> m (Word32, Address)
forall a b. (a -> b) -> a -> b
$ do
    Ptr ProxyResolver
proxyResolver' <- a -> IO (Ptr ProxyResolver)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
proxyResolver
    Ptr Message
msg' <- b -> IO (Ptr Message)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
msg
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    Ptr (Ptr Address)
addr <- IO (Ptr (Ptr Address))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Soup.Address.Address))
    Word32
result <- Ptr ProxyResolver
-> Ptr Message -> Ptr Cancellable -> Ptr (Ptr Address) -> IO Word32
soup_proxy_resolver_get_proxy_sync Ptr ProxyResolver
proxyResolver' Ptr Message
msg' Ptr Cancellable
maybeCancellable Ptr (Ptr Address)
addr
    Ptr Address
addr' <- Ptr (Ptr Address) -> IO (Ptr Address)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Address)
addr
    Address
addr'' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Address -> Address
Soup.Address.Address) Ptr Address
addr'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
proxyResolver
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
msg
    Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Ptr (Ptr Address) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Address)
addr
    (Word32, Address) -> IO (Word32, Address)
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32
result, Address
addr'')

#if defined(ENABLE_OVERLOADING)
data ProxyResolverGetProxySyncMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ((Word32, Soup.Address.Address))), MonadIO m, IsProxyResolver a, Soup.Message.IsMessage b, Gio.Cancellable.IsCancellable c) => O.MethodInfo ProxyResolverGetProxySyncMethodInfo a signature where
    overloadedMethod = proxyResolverGetProxySync

#endif