{- |
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.Objects.CookieJar
    (

-- * Exported types
    CookieJar(..)                           ,
    IsCookieJar                             ,
    toCookieJar                             ,
    noCookieJar                             ,


 -- * Methods
-- ** addCookie #method:addCookie#

#if ENABLE_OVERLOADING
    CookieJarAddCookieMethodInfo            ,
#endif
    cookieJarAddCookie                      ,


-- ** addCookieWithFirstParty #method:addCookieWithFirstParty#

#if ENABLE_OVERLOADING
    CookieJarAddCookieWithFirstPartyMethodInfo,
#endif
    cookieJarAddCookieWithFirstParty        ,


-- ** allCookies #method:allCookies#

#if ENABLE_OVERLOADING
    CookieJarAllCookiesMethodInfo           ,
#endif
    cookieJarAllCookies                     ,


-- ** deleteCookie #method:deleteCookie#

#if ENABLE_OVERLOADING
    CookieJarDeleteCookieMethodInfo         ,
#endif
    cookieJarDeleteCookie                   ,


-- ** getAcceptPolicy #method:getAcceptPolicy#

#if ENABLE_OVERLOADING
    CookieJarGetAcceptPolicyMethodInfo      ,
#endif
    cookieJarGetAcceptPolicy                ,


-- ** getCookieList #method:getCookieList#

#if ENABLE_OVERLOADING
    CookieJarGetCookieListMethodInfo        ,
#endif
    cookieJarGetCookieList                  ,


-- ** getCookies #method:getCookies#

#if ENABLE_OVERLOADING
    CookieJarGetCookiesMethodInfo           ,
#endif
    cookieJarGetCookies                     ,


-- ** isPersistent #method:isPersistent#

#if ENABLE_OVERLOADING
    CookieJarIsPersistentMethodInfo         ,
#endif
    cookieJarIsPersistent                   ,


-- ** new #method:new#

    cookieJarNew                            ,


-- ** save #method:save#

#if ENABLE_OVERLOADING
    CookieJarSaveMethodInfo                 ,
#endif
    cookieJarSave                           ,


-- ** setAcceptPolicy #method:setAcceptPolicy#

#if ENABLE_OVERLOADING
    CookieJarSetAcceptPolicyMethodInfo      ,
#endif
    cookieJarSetAcceptPolicy                ,


-- ** setCookie #method:setCookie#

#if ENABLE_OVERLOADING
    CookieJarSetCookieMethodInfo            ,
#endif
    cookieJarSetCookie                      ,


-- ** setCookieWithFirstParty #method:setCookieWithFirstParty#

#if ENABLE_OVERLOADING
    CookieJarSetCookieWithFirstPartyMethodInfo,
#endif
    cookieJarSetCookieWithFirstParty        ,




 -- * Properties
-- ** acceptPolicy #attr:acceptPolicy#
{- | The policy the jar should follow to accept or reject cookies

/Since: 2.30/
-}
#if ENABLE_OVERLOADING
    CookieJarAcceptPolicyPropertyInfo       ,
#endif
    constructCookieJarAcceptPolicy          ,
#if ENABLE_OVERLOADING
    cookieJarAcceptPolicy                   ,
#endif
    getCookieJarAcceptPolicy                ,
    setCookieJarAcceptPolicy                ,


-- ** readOnly #attr:readOnly#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    CookieJarReadOnlyPropertyInfo           ,
#endif
    constructCookieJarReadOnly              ,
#if ENABLE_OVERLOADING
    cookieJarReadOnly                       ,
#endif
    getCookieJarReadOnly                    ,




 -- * Signals
-- ** changed #signal:changed#

    C_CookieJarChangedCallback              ,
    CookieJarChangedCallback                ,
#if ENABLE_OVERLOADING
    CookieJarChangedSignalInfo              ,
#endif
    afterCookieJarChanged                   ,
    genClosure_CookieJarChanged             ,
    mk_CookieJarChangedCallback             ,
    noCookieJarChangedCallback              ,
    onCookieJarChanged                      ,
    wrap_CookieJarChangedCallback           ,




    ) 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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Interfaces.SessionFeature as Soup.SessionFeature
import {-# SOURCE #-} qualified GI.Soup.Structs.Cookie as Soup.Cookie
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI

-- | Memory-managed wrapper type.
newtype CookieJar = CookieJar (ManagedPtr CookieJar)
foreign import ccall "soup_cookie_jar_get_type"
    c_soup_cookie_jar_get_type :: IO GType

instance GObject CookieJar where
    gobjectType = c_soup_cookie_jar_get_type


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

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

-- | Cast to `CookieJar`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toCookieJar :: (MonadIO m, IsCookieJar o) => o -> m CookieJar
toCookieJar = liftIO . unsafeCastTo CookieJar

-- | A convenience alias for `Nothing` :: `Maybe` `CookieJar`.
noCookieJar :: Maybe CookieJar
noCookieJar = Nothing

#if ENABLE_OVERLOADING
type family ResolveCookieJarMethod (t :: Symbol) (o :: *) :: * where
    ResolveCookieJarMethod "addCookie" o = CookieJarAddCookieMethodInfo
    ResolveCookieJarMethod "addCookieWithFirstParty" o = CookieJarAddCookieWithFirstPartyMethodInfo
    ResolveCookieJarMethod "addFeature" o = Soup.SessionFeature.SessionFeatureAddFeatureMethodInfo
    ResolveCookieJarMethod "allCookies" o = CookieJarAllCookiesMethodInfo
    ResolveCookieJarMethod "attach" o = Soup.SessionFeature.SessionFeatureAttachMethodInfo
    ResolveCookieJarMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCookieJarMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCookieJarMethod "deleteCookie" o = CookieJarDeleteCookieMethodInfo
    ResolveCookieJarMethod "detach" o = Soup.SessionFeature.SessionFeatureDetachMethodInfo
    ResolveCookieJarMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCookieJarMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCookieJarMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveCookieJarMethod "hasFeature" o = Soup.SessionFeature.SessionFeatureHasFeatureMethodInfo
    ResolveCookieJarMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCookieJarMethod "isPersistent" o = CookieJarIsPersistentMethodInfo
    ResolveCookieJarMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCookieJarMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCookieJarMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCookieJarMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCookieJarMethod "removeFeature" o = Soup.SessionFeature.SessionFeatureRemoveFeatureMethodInfo
    ResolveCookieJarMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCookieJarMethod "save" o = CookieJarSaveMethodInfo
    ResolveCookieJarMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCookieJarMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCookieJarMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCookieJarMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCookieJarMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCookieJarMethod "getAcceptPolicy" o = CookieJarGetAcceptPolicyMethodInfo
    ResolveCookieJarMethod "getCookieList" o = CookieJarGetCookieListMethodInfo
    ResolveCookieJarMethod "getCookies" o = CookieJarGetCookiesMethodInfo
    ResolveCookieJarMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCookieJarMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCookieJarMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCookieJarMethod "setAcceptPolicy" o = CookieJarSetAcceptPolicyMethodInfo
    ResolveCookieJarMethod "setCookie" o = CookieJarSetCookieMethodInfo
    ResolveCookieJarMethod "setCookieWithFirstParty" o = CookieJarSetCookieWithFirstPartyMethodInfo
    ResolveCookieJarMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCookieJarMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveCookieJarMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCookieJarMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCookieJarMethod t CookieJar, O.MethodInfo info CookieJar p) => OL.IsLabel t (CookieJar -> 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

-- signal CookieJar::changed
{- |
Emitted when /@jar@/ changes. If a cookie has been added,
/@newCookie@/ will contain the newly-added cookie and
/@oldCookie@/ will be 'Nothing'. If a cookie has been deleted,
/@oldCookie@/ will contain the to-be-deleted cookie and
/@newCookie@/ will be 'Nothing'. If a cookie has been changed,
/@oldCookie@/ will contain its old value, and /@newCookie@/ its
new value.
-}
type CookieJarChangedCallback =
    Soup.Cookie.Cookie
    {- ^ /@oldCookie@/: the old 'GI.Soup.Structs.Cookie.Cookie' value -}
    -> Soup.Cookie.Cookie
    {- ^ /@newCookie@/: the new 'GI.Soup.Structs.Cookie.Cookie' value -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `CookieJarChangedCallback`@.
noCookieJarChangedCallback :: Maybe CookieJarChangedCallback
noCookieJarChangedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_CookieJarChangedCallback =
    Ptr () ->                               -- object
    Ptr Soup.Cookie.Cookie ->
    Ptr Soup.Cookie.Cookie ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_CookieJarChangedCallback`.
foreign import ccall "wrapper"
    mk_CookieJarChangedCallback :: C_CookieJarChangedCallback -> IO (FunPtr C_CookieJarChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_CookieJarChanged :: MonadIO m => CookieJarChangedCallback -> m (GClosure C_CookieJarChangedCallback)
genClosure_CookieJarChanged cb = liftIO $ do
    let cb' = wrap_CookieJarChangedCallback cb
    mk_CookieJarChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `CookieJarChangedCallback` into a `C_CookieJarChangedCallback`.
wrap_CookieJarChangedCallback ::
    CookieJarChangedCallback ->
    C_CookieJarChangedCallback
wrap_CookieJarChangedCallback _cb _ oldCookie newCookie _ = do
    B.ManagedPtr.withTransient Soup.Cookie.Cookie oldCookie $ \oldCookie' -> do
        B.ManagedPtr.withTransient Soup.Cookie.Cookie newCookie $ \newCookie' -> do
            _cb  oldCookie' newCookie'


{- |
Connect a signal handler for the “@changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' cookieJar #changed callback
@
-}
onCookieJarChanged :: (IsCookieJar a, MonadIO m) => a -> CookieJarChangedCallback -> m SignalHandlerId
onCookieJarChanged obj cb = liftIO $ do
    let cb' = wrap_CookieJarChangedCallback cb
    cb'' <- mk_CookieJarChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' cookieJar #changed callback
@
-}
afterCookieJarChanged :: (IsCookieJar a, MonadIO m) => a -> CookieJarChangedCallback -> m SignalHandlerId
afterCookieJarChanged obj cb = liftIO $ do
    let cb' = wrap_CookieJarChangedCallback cb
    cb'' <- mk_CookieJarChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectAfter


-- VVV Prop "accept-policy"
   -- Type: TInterface (Name {namespace = "Soup", name = "CookieJarAcceptPolicy"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@accept-policy@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' cookieJar #acceptPolicy
@
-}
getCookieJarAcceptPolicy :: (MonadIO m, IsCookieJar o) => o -> m Soup.Enums.CookieJarAcceptPolicy
getCookieJarAcceptPolicy obj = liftIO $ B.Properties.getObjectPropertyEnum obj "accept-policy"

{- |
Set the value of the “@accept-policy@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' cookieJar [ #acceptPolicy 'Data.GI.Base.Attributes.:=' value ]
@
-}
setCookieJarAcceptPolicy :: (MonadIO m, IsCookieJar o) => o -> Soup.Enums.CookieJarAcceptPolicy -> m ()
setCookieJarAcceptPolicy obj val = liftIO $ B.Properties.setObjectPropertyEnum obj "accept-policy" val

{- |
Construct a `GValueConstruct` with valid value for the “@accept-policy@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructCookieJarAcceptPolicy :: (IsCookieJar o) => Soup.Enums.CookieJarAcceptPolicy -> IO (GValueConstruct o)
constructCookieJarAcceptPolicy val = B.Properties.constructObjectPropertyEnum "accept-policy" val

#if ENABLE_OVERLOADING
data CookieJarAcceptPolicyPropertyInfo
instance AttrInfo CookieJarAcceptPolicyPropertyInfo where
    type AttrAllowedOps CookieJarAcceptPolicyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint CookieJarAcceptPolicyPropertyInfo = (~) Soup.Enums.CookieJarAcceptPolicy
    type AttrBaseTypeConstraint CookieJarAcceptPolicyPropertyInfo = IsCookieJar
    type AttrGetType CookieJarAcceptPolicyPropertyInfo = Soup.Enums.CookieJarAcceptPolicy
    type AttrLabel CookieJarAcceptPolicyPropertyInfo = "accept-policy"
    type AttrOrigin CookieJarAcceptPolicyPropertyInfo = CookieJar
    attrGet _ = getCookieJarAcceptPolicy
    attrSet _ = setCookieJarAcceptPolicy
    attrConstruct _ = constructCookieJarAcceptPolicy
    attrClear _ = undefined
#endif

-- VVV Prop "read-only"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@read-only@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' cookieJar #readOnly
@
-}
getCookieJarReadOnly :: (MonadIO m, IsCookieJar o) => o -> m Bool
getCookieJarReadOnly obj = liftIO $ B.Properties.getObjectPropertyBool obj "read-only"

{- |
Construct a `GValueConstruct` with valid value for the “@read-only@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructCookieJarReadOnly :: (IsCookieJar o) => Bool -> IO (GValueConstruct o)
constructCookieJarReadOnly val = B.Properties.constructObjectPropertyBool "read-only" val

#if ENABLE_OVERLOADING
data CookieJarReadOnlyPropertyInfo
instance AttrInfo CookieJarReadOnlyPropertyInfo where
    type AttrAllowedOps CookieJarReadOnlyPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint CookieJarReadOnlyPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint CookieJarReadOnlyPropertyInfo = IsCookieJar
    type AttrGetType CookieJarReadOnlyPropertyInfo = Bool
    type AttrLabel CookieJarReadOnlyPropertyInfo = "read-only"
    type AttrOrigin CookieJarReadOnlyPropertyInfo = CookieJar
    attrGet _ = getCookieJarReadOnly
    attrSet _ = undefined
    attrConstruct _ = constructCookieJarReadOnly
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList CookieJar
type instance O.AttributeList CookieJar = CookieJarAttributeList
type CookieJarAttributeList = ('[ '("acceptPolicy", CookieJarAcceptPolicyPropertyInfo), '("readOnly", CookieJarReadOnlyPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
cookieJarAcceptPolicy :: AttrLabelProxy "acceptPolicy"
cookieJarAcceptPolicy = AttrLabelProxy

cookieJarReadOnly :: AttrLabelProxy "readOnly"
cookieJarReadOnly = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data CookieJarChangedSignalInfo
instance SignalInfo CookieJarChangedSignalInfo where
    type HaskellCallbackType CookieJarChangedSignalInfo = CookieJarChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_CookieJarChangedCallback cb
        cb'' <- mk_CookieJarChangedCallback cb'
        connectSignalFunPtr obj "changed" cb'' connectMode

type instance O.SignalList CookieJar = CookieJarSignalList
type CookieJarSignalList = ('[ '("changed", CookieJarChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "soup_cookie_jar_new" soup_cookie_jar_new ::
    IO (Ptr CookieJar)

{- |
Creates a new 'GI.Soup.Objects.CookieJar.CookieJar'. The base 'GI.Soup.Objects.CookieJar.CookieJar' class does
not support persistent storage of cookies; use a subclass for that.

/Since: 2.24/
-}
cookieJarNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m CookieJar
    {- ^ __Returns:__ a new 'GI.Soup.Objects.CookieJar.CookieJar' -}
cookieJarNew  = liftIO $ do
    result <- soup_cookie_jar_new
    checkUnexpectedReturnNULL "cookieJarNew" result
    result' <- (wrapObject CookieJar) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method CookieJar::add_cookie
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cookie", argType = TInterface (Name {namespace = "Soup", name = "Cookie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_add_cookie" soup_cookie_jar_add_cookie ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.Cookie.Cookie ->               -- cookie : TInterface (Name {namespace = "Soup", name = "Cookie"})
    IO ()

{- |
Adds /@cookie@/ to /@jar@/, emitting the \'changed\' signal if we are modifying
an existing cookie or adding a valid new cookie (\'valid\' means
that the cookie\'s expire date is not in the past).

/@cookie@/ will be \'stolen\' by the jar, so don\'t free it afterwards.

/Since: 2.26/
-}
cookieJarAddCookie ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.Cookie.Cookie
    {- ^ /@cookie@/: a 'GI.Soup.Structs.Cookie.Cookie' -}
    -> m ()
cookieJarAddCookie jar cookie = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    cookie' <- B.ManagedPtr.disownBoxed cookie
    soup_cookie_jar_add_cookie jar' cookie'
    touchManagedPtr jar
    touchManagedPtr cookie
    return ()

#if ENABLE_OVERLOADING
data CookieJarAddCookieMethodInfo
instance (signature ~ (Soup.Cookie.Cookie -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarAddCookieMethodInfo a signature where
    overloadedMethod _ = cookieJarAddCookie

#endif

-- method CookieJar::add_cookie_with_first_party
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "first_party", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI for the main document", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cookie", argType = TInterface (Name {namespace = "Soup", name = "Cookie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_add_cookie_with_first_party" soup_cookie_jar_add_cookie_with_first_party ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.URI.URI ->                     -- first_party : TInterface (Name {namespace = "Soup", name = "URI"})
    Ptr Soup.Cookie.Cookie ->               -- cookie : TInterface (Name {namespace = "Soup", name = "Cookie"})
    IO ()

{- |
Adds /@cookie@/ to /@jar@/, emitting the \'changed\' signal if we are modifying
an existing cookie or adding a valid new cookie (\'valid\' means
that the cookie\'s expire date is not in the past).

/@firstParty@/ will be used to reject cookies coming from third party
resources in case such a security policy is set in the /@jar@/.

/@cookie@/ will be \'stolen\' by the jar, so don\'t free it afterwards.

/Since: 2.40/
-}
cookieJarAddCookieWithFirstParty ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.URI.URI
    {- ^ /@firstParty@/: the URI for the main document -}
    -> Soup.Cookie.Cookie
    {- ^ /@cookie@/: a 'GI.Soup.Structs.Cookie.Cookie' -}
    -> m ()
cookieJarAddCookieWithFirstParty jar firstParty cookie = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    firstParty' <- unsafeManagedPtrGetPtr firstParty
    cookie' <- B.ManagedPtr.disownBoxed cookie
    soup_cookie_jar_add_cookie_with_first_party jar' firstParty' cookie'
    touchManagedPtr jar
    touchManagedPtr firstParty
    touchManagedPtr cookie
    return ()

#if ENABLE_OVERLOADING
data CookieJarAddCookieWithFirstPartyMethodInfo
instance (signature ~ (Soup.URI.URI -> Soup.Cookie.Cookie -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarAddCookieWithFirstPartyMethodInfo a signature where
    overloadedMethod _ = cookieJarAddCookieWithFirstParty

#endif

-- method CookieJar::all_cookies
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})))
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_all_cookies" soup_cookie_jar_all_cookies ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    IO (Ptr (GSList (Ptr Soup.Cookie.Cookie)))

{- |
Constructs a 'GI.GLib.Structs.SList.SList' with every cookie inside the /@jar@/.
The cookies in the list are a copy of the original, so
you have to free them when you are done with them.

/Since: 2.26/
-}
cookieJarAllCookies ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> m [Soup.Cookie.Cookie]
    {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList'
with all the cookies in the /@jar@/. -}
cookieJarAllCookies jar = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    result <- soup_cookie_jar_all_cookies jar'
    result' <- unpackGSList result
    result'' <- mapM (wrapBoxed Soup.Cookie.Cookie) result'
    g_slist_free result
    touchManagedPtr jar
    return result''

#if ENABLE_OVERLOADING
data CookieJarAllCookiesMethodInfo
instance (signature ~ (m [Soup.Cookie.Cookie]), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarAllCookiesMethodInfo a signature where
    overloadedMethod _ = cookieJarAllCookies

#endif

-- method CookieJar::delete_cookie
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cookie", argType = TInterface (Name {namespace = "Soup", name = "Cookie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_delete_cookie" soup_cookie_jar_delete_cookie ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.Cookie.Cookie ->               -- cookie : TInterface (Name {namespace = "Soup", name = "Cookie"})
    IO ()

{- |
Deletes /@cookie@/ from /@jar@/, emitting the \'changed\' signal.

/Since: 2.26/
-}
cookieJarDeleteCookie ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.Cookie.Cookie
    {- ^ /@cookie@/: a 'GI.Soup.Structs.Cookie.Cookie' -}
    -> m ()
cookieJarDeleteCookie jar cookie = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    cookie' <- unsafeManagedPtrGetPtr cookie
    soup_cookie_jar_delete_cookie jar' cookie'
    touchManagedPtr jar
    touchManagedPtr cookie
    return ()

#if ENABLE_OVERLOADING
data CookieJarDeleteCookieMethodInfo
instance (signature ~ (Soup.Cookie.Cookie -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarDeleteCookieMethodInfo a signature where
    overloadedMethod _ = cookieJarDeleteCookie

#endif

-- method CookieJar::get_accept_policy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "CookieJarAcceptPolicy"}))
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_get_accept_policy" soup_cookie_jar_get_accept_policy ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    IO CUInt

{- |
Gets /@jar@/\'s 'GI.Soup.Enums.CookieJarAcceptPolicy'

/Since: 2.30/
-}
cookieJarGetAcceptPolicy ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> m Soup.Enums.CookieJarAcceptPolicy
    {- ^ __Returns:__ the 'GI.Soup.Enums.CookieJarAcceptPolicy' set in the /@jar@/ -}
cookieJarGetAcceptPolicy jar = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    result <- soup_cookie_jar_get_accept_policy jar'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr jar
    return result'

#if ENABLE_OVERLOADING
data CookieJarGetAcceptPolicyMethodInfo
instance (signature ~ (m Soup.Enums.CookieJarAcceptPolicy), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarGetAcceptPolicyMethodInfo a signature where
    overloadedMethod _ = cookieJarGetAcceptPolicy

#endif

-- method CookieJar::get_cookie_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "for_http", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether or not the return value is being passed directly\nto an HTTP operation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Soup", name = "Cookie"})))
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_get_cookie_list" soup_cookie_jar_get_cookie_list ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    CInt ->                                 -- for_http : TBasicType TBoolean
    IO (Ptr (GSList (Ptr Soup.Cookie.Cookie)))

{- |
Retrieves the list of cookies that would be sent with a request to /@uri@/
as a 'GI.GLib.Structs.SList.SList' of 'GI.Soup.Structs.Cookie.Cookie' objects.

If /@forHttp@/ is 'True', the return value will include cookies marked
\"HttpOnly\" (that is, cookies that the server wishes to keep hidden
from client-side scripting operations such as the JavaScript
document.cookies property). Since 'GI.Soup.Objects.CookieJar.CookieJar' sets the Cookie
header itself when making the actual HTTP request, you should
almost certainly be setting /@forHttp@/ to 'False' if you are calling
this.

/Since: 2.40/
-}
cookieJarGetCookieList ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' -}
    -> Bool
    {- ^ /@forHttp@/: whether or not the return value is being passed directly
to an HTTP operation -}
    -> m [Soup.Cookie.Cookie]
    {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList'
with the cookies in the /@jar@/ that would be sent with a request to /@uri@/. -}
cookieJarGetCookieList jar uri forHttp = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    uri' <- unsafeManagedPtrGetPtr uri
    let forHttp' = (fromIntegral . fromEnum) forHttp
    result <- soup_cookie_jar_get_cookie_list jar' uri' forHttp'
    result' <- unpackGSList result
    result'' <- mapM (wrapBoxed Soup.Cookie.Cookie) result'
    g_slist_free result
    touchManagedPtr jar
    touchManagedPtr uri
    return result''

#if ENABLE_OVERLOADING
data CookieJarGetCookieListMethodInfo
instance (signature ~ (Soup.URI.URI -> Bool -> m [Soup.Cookie.Cookie]), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarGetCookieListMethodInfo a signature where
    overloadedMethod _ = cookieJarGetCookieList

#endif

-- method CookieJar::get_cookies
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupURI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "for_http", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether or not the return value is being passed directly\nto an HTTP operation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_get_cookies" soup_cookie_jar_get_cookies ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    CInt ->                                 -- for_http : TBasicType TBoolean
    IO CString

{- |
Retrieves (in Cookie-header form) the list of cookies that would
be sent with a request to /@uri@/.

If /@forHttp@/ is 'True', the return value will include cookies marked
\"HttpOnly\" (that is, cookies that the server wishes to keep hidden
from client-side scripting operations such as the JavaScript
document.cookies property). Since 'GI.Soup.Objects.CookieJar.CookieJar' sets the Cookie
header itself when making the actual HTTP request, you should
almost certainly be setting /@forHttp@/ to 'False' if you are calling
this.

/Since: 2.24/
-}
cookieJarGetCookies ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: a 'GI.Soup.Structs.URI.URI' -}
    -> Bool
    {- ^ /@forHttp@/: whether or not the return value is being passed directly
to an HTTP operation -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the cookies, in string form, or 'Nothing' if
there are no cookies for /@uri@/. -}
cookieJarGetCookies jar uri forHttp = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    uri' <- unsafeManagedPtrGetPtr uri
    let forHttp' = (fromIntegral . fromEnum) forHttp
    result <- soup_cookie_jar_get_cookies jar' uri' forHttp'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr jar
    touchManagedPtr uri
    return maybeResult

#if ENABLE_OVERLOADING
data CookieJarGetCookiesMethodInfo
instance (signature ~ (Soup.URI.URI -> Bool -> m (Maybe T.Text)), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarGetCookiesMethodInfo a signature where
    overloadedMethod _ = cookieJarGetCookies

#endif

-- method CookieJar::is_persistent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_is_persistent" soup_cookie_jar_is_persistent ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    IO CInt

{- |
Gets whether /@jar@/ stores cookies persistenly.

/Since: 2.40/
-}
cookieJarIsPersistent ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@jar@/ storage is persistent or 'False' otherwise. -}
cookieJarIsPersistent jar = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    result <- soup_cookie_jar_is_persistent jar'
    let result' = (/= 0) result
    touchManagedPtr jar
    return result'

#if ENABLE_OVERLOADING
data CookieJarIsPersistentMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarIsPersistentMethodInfo a signature where
    overloadedMethod _ = cookieJarIsPersistent

#endif

-- method CookieJar::save
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_save" soup_cookie_jar_save ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    IO ()

{-# DEPRECATED cookieJarSave ["This is a no-op."] #-}
{- |
This function exists for backward compatibility, but does not do
anything any more; cookie jars are saved automatically when they
are changed.

/Since: 2.24/
-}
cookieJarSave ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> m ()
cookieJarSave jar = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    soup_cookie_jar_save jar'
    touchManagedPtr jar
    return ()

#if ENABLE_OVERLOADING
data CookieJarSaveMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarSaveMethodInfo a signature where
    overloadedMethod _ = cookieJarSave

#endif

-- method CookieJar::set_accept_policy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "policy", argType = TInterface (Name {namespace = "Soup", name = "CookieJarAcceptPolicy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJarAcceptPolicy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_set_accept_policy" soup_cookie_jar_set_accept_policy ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    CUInt ->                                -- policy : TInterface (Name {namespace = "Soup", name = "CookieJarAcceptPolicy"})
    IO ()

{- |
Sets /@policy@/ as the cookie acceptance policy for /@jar@/.

/Since: 2.30/
-}
cookieJarSetAcceptPolicy ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.Enums.CookieJarAcceptPolicy
    {- ^ /@policy@/: a 'GI.Soup.Enums.CookieJarAcceptPolicy' -}
    -> m ()
cookieJarSetAcceptPolicy jar policy = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    let policy' = (fromIntegral . fromEnum) policy
    soup_cookie_jar_set_accept_policy jar' policy'
    touchManagedPtr jar
    return ()

#if ENABLE_OVERLOADING
data CookieJarSetAcceptPolicyMethodInfo
instance (signature ~ (Soup.Enums.CookieJarAcceptPolicy -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarSetAcceptPolicyMethodInfo a signature where
    overloadedMethod _ = cookieJarSetAcceptPolicy

#endif

-- method CookieJar::set_cookie
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI setting the cookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cookie", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stringified cookie to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_set_cookie" soup_cookie_jar_set_cookie ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    CString ->                              -- cookie : TBasicType TUTF8
    IO ()

{- |
Adds /@cookie@/ to /@jar@/, exactly as though it had appeared in a
Set-Cookie header returned from a request to /@uri@/.

Keep in mind that if the 'GI.Soup.Enums.CookieJarAcceptPolicy'
'GI.Soup.Enums.CookieJarAcceptPolicyNoThirdParty' is set you\'ll need to use
'GI.Soup.Objects.CookieJar.cookieJarSetCookieWithFirstParty', otherwise the jar
will have no way of knowing if the cookie is being set by a third
party or not.

/Since: 2.24/
-}
cookieJarSetCookie ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: the URI setting the cookie -}
    -> T.Text
    {- ^ /@cookie@/: the stringified cookie to set -}
    -> m ()
cookieJarSetCookie jar uri cookie = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    uri' <- unsafeManagedPtrGetPtr uri
    cookie' <- textToCString cookie
    soup_cookie_jar_set_cookie jar' uri' cookie'
    touchManagedPtr jar
    touchManagedPtr uri
    freeMem cookie'
    return ()

#if ENABLE_OVERLOADING
data CookieJarSetCookieMethodInfo
instance (signature ~ (Soup.URI.URI -> T.Text -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarSetCookieMethodInfo a signature where
    overloadedMethod _ = cookieJarSetCookie

#endif

-- method CookieJar::set_cookie_with_first_party
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "jar", argType = TInterface (Name {namespace = "Soup", name = "CookieJar"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupCookieJar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI setting the cookie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "first_party", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI for the main document", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cookie", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stringified cookie to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_cookie_jar_set_cookie_with_first_party" soup_cookie_jar_set_cookie_with_first_party ::
    Ptr CookieJar ->                        -- jar : TInterface (Name {namespace = "Soup", name = "CookieJar"})
    Ptr Soup.URI.URI ->                     -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
    Ptr Soup.URI.URI ->                     -- first_party : TInterface (Name {namespace = "Soup", name = "URI"})
    CString ->                              -- cookie : TBasicType TUTF8
    IO ()

{- |
Adds /@cookie@/ to /@jar@/, exactly as though it had appeared in a
Set-Cookie header returned from a request to /@uri@/. /@firstParty@/
will be used to reject cookies coming from third party resources in
case such a security policy is set in the /@jar@/.

/Since: 2.30/
-}
cookieJarSetCookieWithFirstParty ::
    (B.CallStack.HasCallStack, MonadIO m, IsCookieJar a) =>
    a
    {- ^ /@jar@/: a 'GI.Soup.Objects.CookieJar.CookieJar' -}
    -> Soup.URI.URI
    {- ^ /@uri@/: the URI setting the cookie -}
    -> Soup.URI.URI
    {- ^ /@firstParty@/: the URI for the main document -}
    -> T.Text
    {- ^ /@cookie@/: the stringified cookie to set -}
    -> m ()
cookieJarSetCookieWithFirstParty jar uri firstParty cookie = liftIO $ do
    jar' <- unsafeManagedPtrCastPtr jar
    uri' <- unsafeManagedPtrGetPtr uri
    firstParty' <- unsafeManagedPtrGetPtr firstParty
    cookie' <- textToCString cookie
    soup_cookie_jar_set_cookie_with_first_party jar' uri' firstParty' cookie'
    touchManagedPtr jar
    touchManagedPtr uri
    touchManagedPtr firstParty
    freeMem cookie'
    return ()

#if ENABLE_OVERLOADING
data CookieJarSetCookieWithFirstPartyMethodInfo
instance (signature ~ (Soup.URI.URI -> Soup.URI.URI -> T.Text -> m ()), MonadIO m, IsCookieJar a) => O.MethodInfo CookieJarSetCookieWithFirstPartyMethodInfo a signature where
    overloadedMethod _ = cookieJarSetCookieWithFirstParty

#endif