{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Soup.Interfaces.ProxyResolver ( -- * Exported types ProxyResolver(..) , noProxyResolver , IsProxyResolver , toProxyResolver , -- * Methods -- ** getProxyAsync #method:getProxyAsync# #if ENABLE_OVERLOADING ProxyResolverGetProxyAsyncMethodInfo , #endif proxyResolverGetProxyAsync , -- ** getProxySync #method:getProxySync# #if 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.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) -- | A convenience alias for `Nothing` :: `Maybe` `ProxyResolver`. noProxyResolver :: Maybe ProxyResolver noProxyResolver = Nothing #if 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 = c_soup_proxy_resolver_get_type -- | 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 = liftIO . unsafeCastTo ProxyResolver #if ENABLE_OVERLOADING instance O.HasAttributeList ProxyResolver type instance O.AttributeList ProxyResolver = ProxyResolverAttributeList type ProxyResolverAttributeList = ('[ ] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING #endif #if 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 "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 (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy 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 proxyResolver msg asyncContext cancellable callback = liftIO $ do proxyResolver' <- unsafeManagedPtrCastPtr proxyResolver msg' <- unsafeManagedPtrCastPtr msg asyncContext' <- unsafeManagedPtrGetPtr asyncContext maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_ProxyResolverCallback)) callback' <- Soup.Callbacks.mk_ProxyResolverCallback (Soup.Callbacks.wrap_ProxyResolverCallback (Just ptrcallback) (Soup.Callbacks.drop_closures_ProxyResolverCallback callback)) poke ptrcallback callback' let userData = nullPtr soup_proxy_resolver_get_proxy_async proxyResolver' msg' asyncContext' maybeCancellable callback' userData touchManagedPtr proxyResolver touchManagedPtr msg touchManagedPtr asyncContext whenJust cancellable touchManagedPtr return () #if 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 proxyResolver msg cancellable = liftIO $ do proxyResolver' <- unsafeManagedPtrCastPtr proxyResolver msg' <- unsafeManagedPtrCastPtr msg maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' addr <- allocMem :: IO (Ptr (Ptr Soup.Address.Address)) result <- soup_proxy_resolver_get_proxy_sync proxyResolver' msg' maybeCancellable addr addr' <- peek addr addr'' <- (newObject Soup.Address.Address) addr' touchManagedPtr proxyResolver touchManagedPtr msg whenJust cancellable touchManagedPtr freeMem addr return (result, addr'') #if 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