gi-soup-2.4.18: GI/Soup/Objects/MultipartInputStream.hs
{- |
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.MultipartInputStream
(
-- * Exported types
MultipartInputStream(..) ,
IsMultipartInputStream ,
toMultipartInputStream ,
noMultipartInputStream ,
-- * Methods
-- ** getHeaders #method:getHeaders#
#if ENABLE_OVERLOADING
MultipartInputStreamGetHeadersMethodInfo,
#endif
multipartInputStreamGetHeaders ,
-- ** new #method:new#
multipartInputStreamNew ,
-- ** nextPart #method:nextPart#
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartMethodInfo ,
#endif
multipartInputStreamNextPart ,
-- ** nextPartAsync #method:nextPartAsync#
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartAsyncMethodInfo,
#endif
multipartInputStreamNextPartAsync ,
-- ** nextPartFinish #method:nextPartFinish#
#if ENABLE_OVERLOADING
MultipartInputStreamNextPartFinishMethodInfo,
#endif
multipartInputStreamNextPartFinish ,
-- * Properties
-- ** message #attr:message#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
MultipartInputStreamMessagePropertyInfo ,
#endif
constructMultipartInputStreamMessage ,
getMultipartInputStreamMessage ,
#if ENABLE_OVERLOADING
multipartInputStreamMessage ,
#endif
) 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 qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.PollableInputStream as Gio.PollableInputStream
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.FilterInputStream as Gio.FilterInputStream
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders
-- | Memory-managed wrapper type.
newtype MultipartInputStream = MultipartInputStream (ManagedPtr MultipartInputStream)
foreign import ccall "soup_multipart_input_stream_get_type"
c_soup_multipart_input_stream_get_type :: IO GType
instance GObject MultipartInputStream where
gobjectType = c_soup_multipart_input_stream_get_type
-- | Type class for types which can be safely cast to `MultipartInputStream`, for instance with `toMultipartInputStream`.
class (GObject o, O.IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o
instance (GObject o, O.IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o
instance O.HasParentTypes MultipartInputStream
type instance O.ParentTypes MultipartInputStream = '[Gio.FilterInputStream.FilterInputStream, Gio.InputStream.InputStream, GObject.Object.Object, Gio.PollableInputStream.PollableInputStream]
-- | Cast to `MultipartInputStream`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMultipartInputStream :: (MonadIO m, IsMultipartInputStream o) => o -> m MultipartInputStream
toMultipartInputStream = liftIO . unsafeCastTo MultipartInputStream
-- | A convenience alias for `Nothing` :: `Maybe` `MultipartInputStream`.
noMultipartInputStream :: Maybe MultipartInputStream
noMultipartInputStream = Nothing
#if ENABLE_OVERLOADING
type family ResolveMultipartInputStreamMethod (t :: Symbol) (o :: *) :: * where
ResolveMultipartInputStreamMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMultipartInputStreamMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMultipartInputStreamMethod "canPoll" o = Gio.PollableInputStream.PollableInputStreamCanPollMethodInfo
ResolveMultipartInputStreamMethod "clearPending" o = Gio.InputStream.InputStreamClearPendingMethodInfo
ResolveMultipartInputStreamMethod "close" o = Gio.InputStream.InputStreamCloseMethodInfo
ResolveMultipartInputStreamMethod "closeAsync" o = Gio.InputStream.InputStreamCloseAsyncMethodInfo
ResolveMultipartInputStreamMethod "closeFinish" o = Gio.InputStream.InputStreamCloseFinishMethodInfo
ResolveMultipartInputStreamMethod "createSource" o = Gio.PollableInputStream.PollableInputStreamCreateSourceMethodInfo
ResolveMultipartInputStreamMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMultipartInputStreamMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMultipartInputStreamMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMultipartInputStreamMethod "hasPending" o = Gio.InputStream.InputStreamHasPendingMethodInfo
ResolveMultipartInputStreamMethod "isClosed" o = Gio.InputStream.InputStreamIsClosedMethodInfo
ResolveMultipartInputStreamMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMultipartInputStreamMethod "isReadable" o = Gio.PollableInputStream.PollableInputStreamIsReadableMethodInfo
ResolveMultipartInputStreamMethod "nextPart" o = MultipartInputStreamNextPartMethodInfo
ResolveMultipartInputStreamMethod "nextPartAsync" o = MultipartInputStreamNextPartAsyncMethodInfo
ResolveMultipartInputStreamMethod "nextPartFinish" o = MultipartInputStreamNextPartFinishMethodInfo
ResolveMultipartInputStreamMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMultipartInputStreamMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMultipartInputStreamMethod "read" o = Gio.InputStream.InputStreamReadMethodInfo
ResolveMultipartInputStreamMethod "readAll" o = Gio.InputStream.InputStreamReadAllMethodInfo
ResolveMultipartInputStreamMethod "readAllAsync" o = Gio.InputStream.InputStreamReadAllAsyncMethodInfo
ResolveMultipartInputStreamMethod "readAllFinish" o = Gio.InputStream.InputStreamReadAllFinishMethodInfo
ResolveMultipartInputStreamMethod "readAsync" o = Gio.InputStream.InputStreamReadAsyncMethodInfo
ResolveMultipartInputStreamMethod "readBytes" o = Gio.InputStream.InputStreamReadBytesMethodInfo
ResolveMultipartInputStreamMethod "readBytesAsync" o = Gio.InputStream.InputStreamReadBytesAsyncMethodInfo
ResolveMultipartInputStreamMethod "readBytesFinish" o = Gio.InputStream.InputStreamReadBytesFinishMethodInfo
ResolveMultipartInputStreamMethod "readFinish" o = Gio.InputStream.InputStreamReadFinishMethodInfo
ResolveMultipartInputStreamMethod "readNonblocking" o = Gio.PollableInputStream.PollableInputStreamReadNonblockingMethodInfo
ResolveMultipartInputStreamMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMultipartInputStreamMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMultipartInputStreamMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMultipartInputStreamMethod "skip" o = Gio.InputStream.InputStreamSkipMethodInfo
ResolveMultipartInputStreamMethod "skipAsync" o = Gio.InputStream.InputStreamSkipAsyncMethodInfo
ResolveMultipartInputStreamMethod "skipFinish" o = Gio.InputStream.InputStreamSkipFinishMethodInfo
ResolveMultipartInputStreamMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMultipartInputStreamMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMultipartInputStreamMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMultipartInputStreamMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMultipartInputStreamMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMultipartInputStreamMethod "getBaseStream" o = Gio.FilterInputStream.FilterInputStreamGetBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "getCloseBaseStream" o = Gio.FilterInputStream.FilterInputStreamGetCloseBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMultipartInputStreamMethod "getHeaders" o = MultipartInputStreamGetHeadersMethodInfo
ResolveMultipartInputStreamMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMultipartInputStreamMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMultipartInputStreamMethod "setCloseBaseStream" o = Gio.FilterInputStream.FilterInputStreamSetCloseBaseStreamMethodInfo
ResolveMultipartInputStreamMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMultipartInputStreamMethod "setPending" o = Gio.InputStream.InputStreamSetPendingMethodInfo
ResolveMultipartInputStreamMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMultipartInputStreamMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMultipartInputStreamMethod t MultipartInputStream, O.MethodInfo info MultipartInputStream p) => OL.IsLabel t (MultipartInputStream -> 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
-- VVV Prop "message"
-- Type: TInterface (Name {namespace = "Soup", name = "Message"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@message@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' multipartInputStream #message
@
-}
getMultipartInputStreamMessage :: (MonadIO m, IsMultipartInputStream o) => o -> m (Maybe Soup.Message.Message)
getMultipartInputStreamMessage obj = liftIO $ B.Properties.getObjectPropertyObject obj "message" Soup.Message.Message
{- |
Construct a `GValueConstruct` with valid value for the “@message@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructMultipartInputStreamMessage :: (IsMultipartInputStream o, Soup.Message.IsMessage a) => a -> IO (GValueConstruct o)
constructMultipartInputStreamMessage val = B.Properties.constructObjectPropertyObject "message" (Just val)
#if ENABLE_OVERLOADING
data MultipartInputStreamMessagePropertyInfo
instance AttrInfo MultipartInputStreamMessagePropertyInfo where
type AttrAllowedOps MultipartInputStreamMessagePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint MultipartInputStreamMessagePropertyInfo = Soup.Message.IsMessage
type AttrBaseTypeConstraint MultipartInputStreamMessagePropertyInfo = IsMultipartInputStream
type AttrGetType MultipartInputStreamMessagePropertyInfo = (Maybe Soup.Message.Message)
type AttrLabel MultipartInputStreamMessagePropertyInfo = "message"
type AttrOrigin MultipartInputStreamMessagePropertyInfo = MultipartInputStream
attrGet _ = getMultipartInputStreamMessage
attrSet _ = undefined
attrConstruct _ = constructMultipartInputStreamMessage
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList MultipartInputStream
type instance O.AttributeList MultipartInputStream = MultipartInputStreamAttributeList
type MultipartInputStreamAttributeList = ('[ '("baseStream", Gio.FilterInputStream.FilterInputStreamBaseStreamPropertyInfo), '("closeBaseStream", Gio.FilterInputStream.FilterInputStreamCloseBaseStreamPropertyInfo), '("message", MultipartInputStreamMessagePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
multipartInputStreamMessage :: AttrLabelProxy "message"
multipartInputStreamMessage = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList MultipartInputStream = MultipartInputStreamSignalList
type MultipartInputStreamSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method MultipartInputStream::new
-- method type : Constructor
-- Args : [Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMessage the response is related to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "base_stream", argType = TInterface (Name {namespace = "Gio", name = "InputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GInputStream returned by sending the request.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "MultipartInputStream"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_multipart_input_stream_new" soup_multipart_input_stream_new ::
Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
Ptr Gio.InputStream.InputStream -> -- base_stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
IO (Ptr MultipartInputStream)
{- |
Creates a new 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream' that wraps the
'GI.Gio.Objects.InputStream.InputStream' obtained by sending the 'GI.Soup.Objects.Request.Request'. Reads should
not be done directly through this object, use the input streams
returned by 'GI.Soup.Objects.MultipartInputStream.multipartInputStreamNextPart' or its async
counterpart instead.
/Since: 2.40/
-}
multipartInputStreamNew ::
(B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a, Gio.InputStream.IsInputStream b) =>
a
{- ^ /@msg@/: the 'GI.Soup.Objects.Message.Message' the response is related to. -}
-> b
{- ^ /@baseStream@/: the 'GI.Gio.Objects.InputStream.InputStream' returned by sending the request. -}
-> m MultipartInputStream
{- ^ __Returns:__ a new 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream' -}
multipartInputStreamNew msg baseStream = liftIO $ do
msg' <- unsafeManagedPtrCastPtr msg
baseStream' <- unsafeManagedPtrCastPtr baseStream
result <- soup_multipart_input_stream_new msg' baseStream'
checkUnexpectedReturnNULL "multipartInputStreamNew" result
result' <- (wrapObject MultipartInputStream) result
touchManagedPtr msg
touchManagedPtr baseStream
return result'
#if ENABLE_OVERLOADING
#endif
-- method MultipartInputStream::get_headers
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "MultipartInputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipartInputStream.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "MessageHeaders"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_multipart_input_stream_get_headers" soup_multipart_input_stream_get_headers ::
Ptr MultipartInputStream -> -- multipart : TInterface (Name {namespace = "Soup", name = "MultipartInputStream"})
IO (Ptr Soup.MessageHeaders.MessageHeaders)
{- |
Obtains the headers for the part currently being processed. Note
that the 'GI.Soup.Structs.MessageHeaders.MessageHeaders' that are returned are owned by the
'GI.Soup.Objects.MultipartInputStream.MultipartInputStream' and will be replaced when a call is made
to 'GI.Soup.Objects.MultipartInputStream.multipartInputStreamNextPart' or its async
counterpart, so if keeping the headers is required, a copy must be
made.
Note that if a part had no headers at all an empty 'GI.Soup.Structs.MessageHeaders.MessageHeaders'
will be returned.
/Since: 2.40/
-}
multipartInputStreamGetHeaders ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a) =>
a
{- ^ /@multipart@/: a 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream'. -}
-> m (Maybe Soup.MessageHeaders.MessageHeaders)
{- ^ __Returns:__ a 'GI.Soup.Structs.MessageHeaders.MessageHeaders'
containing the headers for the part currently being processed or
'Nothing' if the headers failed to parse. -}
multipartInputStreamGetHeaders multipart = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
result <- soup_multipart_input_stream_get_headers multipart'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newBoxed Soup.MessageHeaders.MessageHeaders) result'
return result''
touchManagedPtr multipart
return maybeResult
#if ENABLE_OVERLOADING
data MultipartInputStreamGetHeadersMethodInfo
instance (signature ~ (m (Maybe Soup.MessageHeaders.MessageHeaders)), MonadIO m, IsMultipartInputStream a) => O.MethodInfo MultipartInputStreamGetHeadersMethodInfo a signature where
overloadedMethod _ = multipartInputStreamGetHeaders
#endif
-- method MultipartInputStream::next_part
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "MultipartInputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMultipartInputStream", 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 = Just "a #GCancellable", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "InputStream"}))
-- throws : True
-- Skip return : False
foreign import ccall "soup_multipart_input_stream_next_part" soup_multipart_input_stream_next_part ::
Ptr MultipartInputStream -> -- multipart : TInterface (Name {namespace = "Soup", name = "MultipartInputStream"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
Ptr (Ptr GError) -> -- error
IO (Ptr Gio.InputStream.InputStream)
{- |
Obtains an input stream for the next part. When dealing with a
multipart response the input stream needs to be wrapped in a
'GI.Soup.Objects.MultipartInputStream.MultipartInputStream' and this function or its async
counterpart need to be called to obtain the first part for
reading.
After calling this function,
'GI.Soup.Objects.MultipartInputStream.multipartInputStreamGetHeaders' can be used to obtain the
headers for the first part. A read of 0 bytes indicates the end of
the part; a new call to this function should be done at that point,
to obtain the next part.
/Since: 2.40/
-}
multipartInputStreamNextPart ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@multipart@/: the 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream' -}
-> Maybe (b)
{- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable' -}
-> m (Maybe Gio.InputStream.InputStream)
{- ^ __Returns:__ a new 'GI.Gio.Objects.InputStream.InputStream', or
'Nothing' if there are no more parts /(Can throw 'Data.GI.Base.GError.GError')/ -}
multipartInputStreamNextPart multipart cancellable = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ soup_multipart_input_stream_next_part multipart' maybeCancellable
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.InputStream.InputStream) result'
return result''
touchManagedPtr multipart
whenJust cancellable touchManagedPtr
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartMethodInfo
instance (signature ~ (Maybe (b) -> m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MultipartInputStreamNextPartMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPart
#endif
-- method MultipartInputStream::next_part_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "MultipartInputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMultipartInputStream.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "io_priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the I/O priority for the request.", 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 = Just "a #GCancellable.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "callback to call when request is satisfied.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data for @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_multipart_input_stream_next_part_async" soup_multipart_input_stream_next_part_async ::
Ptr MultipartInputStream -> -- multipart : TInterface (Name {namespace = "Soup", name = "MultipartInputStream"})
Int32 -> -- io_priority : TBasicType TInt
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- data : TBasicType TPtr
IO ()
{- |
Obtains a 'GI.Gio.Objects.InputStream.InputStream' for the next request. See
'GI.Soup.Objects.MultipartInputStream.multipartInputStreamNextPart' for details on the
workflow.
/Since: 2.40/
-}
multipartInputStreamNextPartAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@multipart@/: the 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream'. -}
-> Int32
{- ^ /@ioPriority@/: the I\/O priority for the request. -}
-> Maybe (b)
{- ^ /@cancellable@/: a 'GI.Gio.Objects.Cancellable.Cancellable'. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: callback to call when request is satisfied. -}
-> m ()
multipartInputStreamNextPartAsync multipart ioPriority cancellable callback = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let data_ = nullPtr
soup_multipart_input_stream_next_part_async multipart' ioPriority maybeCancellable maybeCallback data_
touchManagedPtr multipart
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMultipartInputStream a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MultipartInputStreamNextPartAsyncMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPartAsync
#endif
-- method MultipartInputStream::next_part_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "MultipartInputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipartInputStream.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "InputStream"}))
-- throws : True
-- Skip return : False
foreign import ccall "soup_multipart_input_stream_next_part_finish" soup_multipart_input_stream_next_part_finish ::
Ptr MultipartInputStream -> -- multipart : TInterface (Name {namespace = "Soup", name = "MultipartInputStream"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO (Ptr Gio.InputStream.InputStream)
{- |
Finishes an asynchronous request for the next part.
/Since: 2.40/
-}
multipartInputStreamNextPartFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMultipartInputStream a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@multipart@/: a 'GI.Soup.Objects.MultipartInputStream.MultipartInputStream'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m (Maybe Gio.InputStream.InputStream)
{- ^ __Returns:__ a newly created
'GI.Gio.Objects.InputStream.InputStream' for reading the next part or 'Nothing' if there are no
more parts. /(Can throw 'Data.GI.Base.GError.GError')/ -}
multipartInputStreamNextPartFinish multipart result_ = liftIO $ do
multipart' <- unsafeManagedPtrCastPtr multipart
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ soup_multipart_input_stream_next_part_finish multipart' result_'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.InputStream.InputStream) result'
return result''
touchManagedPtr multipart
touchManagedPtr result_
return maybeResult
) (do
return ()
)
#if ENABLE_OVERLOADING
data MultipartInputStreamNextPartFinishMethodInfo
instance (signature ~ (b -> m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsMultipartInputStream a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MultipartInputStreamNextPartFinishMethodInfo a signature where
overloadedMethod _ = multipartInputStreamNextPartFinish
#endif