{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- 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(..)                       ,
    IsProxyResolver                         ,
    toProxyResolver                         ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addFeature]("GI.Soup.Interfaces.SessionFeature#g:method:addFeature"), [attach]("GI.Soup.Interfaces.SessionFeature#g:method:attach"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [detach]("GI.Soup.Interfaces.SessionFeature#g:method:detach"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasFeature]("GI.Soup.Interfaces.SessionFeature#g:method:hasFeature"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [removeFeature]("GI.Soup.Interfaces.SessionFeature#g:method:removeFeature"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getProxyAsync]("GI.Soup.Interfaces.ProxyResolver#g:method:getProxyAsync"), [getProxySync]("GI.Soup.Interfaces.ProxyResolver#g:method:getProxySync"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
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 GHC.Records as R

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 (SP.ManagedPtr ProxyResolver)
    deriving (ProxyResolver -> ProxyResolver -> Bool
(ProxyResolver -> ProxyResolver -> Bool)
-> (ProxyResolver -> ProxyResolver -> Bool) -> Eq ProxyResolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProxyResolver -> ProxyResolver -> Bool
== :: ProxyResolver -> ProxyResolver -> Bool
$c/= :: ProxyResolver -> ProxyResolver -> Bool
/= :: ProxyResolver -> ProxyResolver -> Bool
Eq)

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

foreign import ccall "soup_proxy_resolver_get_type"
    c_soup_proxy_resolver_get_type :: IO B.Types.GType

instance B.Types.TypedObject ProxyResolver where
    glibType :: IO GType
glibType = IO GType
c_soup_proxy_resolver_get_type

instance B.Types.GObject ProxyResolver

-- | Type class for types which can be safely cast to `ProxyResolver`, for instance with `toProxyResolver`.
class (SP.GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance (SP.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 :: (MIO.MonadIO m, IsProxyResolver o) => o -> m ProxyResolver
toProxyResolver :: forall (m :: * -> *) o.
(MonadIO m, IsProxyResolver o) =>
o -> m ProxyResolver
toProxyResolver = IO ProxyResolver -> m ProxyResolver
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ProxyResolver -> ProxyResolver
ProxyResolver

-- | Convert 'ProxyResolver' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe ProxyResolver) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_proxy_resolver_get_type
    gvalueSet_ :: Ptr GValue -> Maybe ProxyResolver -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ProxyResolver
P.Nothing = Ptr GValue -> Ptr ProxyResolver -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ProxyResolver
forall a. Ptr a
FP.nullPtr :: FP.Ptr ProxyResolver)
    gvalueSet_ Ptr GValue
gv (P.Just ProxyResolver
obj) = ProxyResolver -> (Ptr ProxyResolver -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ProxyResolver
obj (Ptr GValue -> Ptr ProxyResolver -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe ProxyResolver)
gvalueGet_ Ptr GValue
gv = do
        Ptr ProxyResolver
ptr <- Ptr GValue -> IO (Ptr ProxyResolver)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ProxyResolver)
        if Ptr ProxyResolver
ptr Ptr ProxyResolver -> Ptr ProxyResolver -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ProxyResolver
forall a. Ptr a
FP.nullPtr
        then ProxyResolver -> Maybe ProxyResolver
forall a. a -> Maybe a
P.Just (ProxyResolver -> Maybe ProxyResolver)
-> IO ProxyResolver -> IO (Maybe ProxyResolver)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
        else Maybe ProxyResolver -> IO (Maybe ProxyResolver)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ProxyResolver
forall a. Maybe a
P.Nothing
        
    

#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.OverloadedMethod 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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveProxyResolverMethod t ProxyResolver, O.OverloadedMethod info ProxyResolver p, R.HasField t ProxyResolver p) => R.HasField t ProxyResolver p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveProxyResolverMethod t ProxyResolver, O.OverloadedMethodInfo info ProxyResolver) => OL.IsLabel t (O.MethodProxy info ProxyResolver) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#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 :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsProxyResolver a, IsMessage b,
 IsCancellable c) =>
a -> b -> MainContext -> Maybe c -> ProxyResolverCallback -> m ()
proxyResolverGetProxyAsync a
proxyResolver b
msg MainContext
asyncContext Maybe c
cancellable ProxyResolverCallback
callback = IO () -> m ()
forall a. IO a -> m a
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
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just 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 a. a -> IO a
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 a. a -> IO a
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.OverloadedMethod ProxyResolverGetProxyAsyncMethodInfo a signature where
    overloadedMethod = proxyResolverGetProxyAsync

instance O.OverloadedMethodInfo ProxyResolverGetProxyAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Soup.Interfaces.ProxyResolver.proxyResolverGetProxyAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Interfaces-ProxyResolver.html#v: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 :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsProxyResolver a, IsMessage b,
 IsCancellable c) =>
a -> b -> Maybe c -> m (Word32, Address)
proxyResolverGetProxySync a
proxyResolver b
msg Maybe c
cancellable = IO (Word32, Address) -> m (Word32, Address)
forall a. IO a -> m a
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
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just 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 a. a -> IO a
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)
callocMem :: 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 a. a -> IO a
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.OverloadedMethod ProxyResolverGetProxySyncMethodInfo a signature where
    overloadedMethod = proxyResolverGetProxySync

instance O.OverloadedMethodInfo ProxyResolverGetProxySyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Soup.Interfaces.ProxyResolver.proxyResolverGetProxySync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Interfaces-ProxyResolver.html#v:proxyResolverGetProxySync"
        })


#endif

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

#endif