gi-soup-3.0.2: Libsoup bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Soup.Objects.MultipartInputStream

Description

Handles streams of multipart messages.

This adds support for the multipart responses. For handling the multiple parts the user needs to wrap the InputStream obtained by sending the request with a [classmultipartInputStream] and use [methodmultipartInputStream.next_part] before reading. Responses which are not wrapped will be treated like non-multipart responses.

Note that although MultipartInputStream is a InputStream, you should not read directly from it, and the results are undefined if you do.

Synopsis

Exported types

newtype MultipartInputStream Source #

Memory-managed wrapper type.

Constructors

MultipartInputStream (ManagedPtr MultipartInputStream) 

Instances

Instances details
Eq MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

GObject MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

ManagedPtrNewtype MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

TypedObject MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

Methods

glibType :: IO GType

HasParentTypes MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

IsGValue (Maybe MultipartInputStream) Source #

Convert MultipartInputStream to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Soup.Objects.MultipartInputStream

type ParentTypes MultipartInputStream Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

type ParentTypes MultipartInputStream = '[FilterInputStream, InputStream, Object, PollableInputStream]

class (GObject o, IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o Source #

Type class for types which can be safely cast to MultipartInputStream, for instance with toMultipartInputStream.

Instances

Instances details
(GObject o, IsDescendantOf MultipartInputStream o) => IsMultipartInputStream o Source # 
Instance details

Defined in GI.Soup.Objects.MultipartInputStream

toMultipartInputStream :: (MonadIO m, IsMultipartInputStream o) => o -> m MultipartInputStream Source #

Cast to MultipartInputStream, for types for which this is known to be safe. For general casts, use castTo.

Methods

getHeaders

multipartInputStreamGetHeaders Source #

Arguments

:: (HasCallStack, MonadIO m, IsMultipartInputStream a) 
=> a

multipart: a MultipartInputStream.

-> m (Maybe MessageHeaders)

Returns: a MessageHeaders containing the headers for the part currently being processed or Nothing if the headers failed to parse.

Obtains the headers for the part currently being processed.

Note that the [structmessageHeaders] that are returned are owned by the MultipartInputStream and will be replaced when a call is made to [methodmultipartInputStream.next_part] 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 [structmessageHeaders] will be returned.

new

multipartInputStreamNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsMessage a, IsInputStream b) 
=> a

msg: the Message the response is related to.

-> b

baseStream: the InputStream returned by sending the request.

-> m MultipartInputStream

Returns: a new MultipartInputStream

Creates a new MultipartInputStream that wraps the InputStream obtained by sending the [classmessage].

Reads should not be done directly through this object, use the input streams returned by [methodmultipartInputStream.next_part] or its async counterpart instead.

nextPart

multipartInputStreamNextPart Source #

Arguments

:: (HasCallStack, MonadIO m, IsMultipartInputStream a, IsCancellable b) 
=> a

multipart: the MultipartInputStream

-> Maybe b

cancellable: a Cancellable

-> m (Maybe InputStream)

Returns: a new InputStream, or Nothing if there are no more parts (Can throw GError)

Obtains an input stream for the next part.

When dealing with a multipart response the input stream needs to be wrapped in a MultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.

After calling this function, [methodmultipartInputStream.get_headers] 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.

nextPartAsync

multipartInputStreamNextPartAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsMultipartInputStream a, IsCancellable b) 
=> a

multipart: the MultipartInputStream.

-> Int32

ioPriority: the I/O priority for the request.

-> Maybe b

cancellable: a Cancellable.

-> Maybe AsyncReadyCallback

callback: callback to call when request is satisfied.

-> m () 

Obtains a InputStream for the next request.

See [methodmultipartInputStream.next_part] for details on the workflow.

nextPartFinish

multipartInputStreamNextPartFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsMultipartInputStream a, IsAsyncResult b) 
=> a

multipart: a MultipartInputStream.

-> b

result: a AsyncResult.

-> m (Maybe InputStream)

Returns: a newly created InputStream for reading the next part or Nothing if there are no more parts. (Can throw GError)

Finishes an asynchronous request for the next part.

Properties

message

The [classmessage].

constructMultipartInputStreamMessage :: (IsMultipartInputStream o, MonadIO m, IsMessage a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “message” property. This is rarely needed directly, but it is used by new.

getMultipartInputStreamMessage :: (MonadIO m, IsMultipartInputStream o) => o -> m (Maybe Message) Source #

Get the value of the “message” property. When overloading is enabled, this is equivalent to

get multipartInputStream #message