{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046. Of particular interest to HTTP are \multipart\/byte-ranges\<\/literal> and \multipart\/form-data\<\/literal>. Although the headers of a 'GI.Soup.Structs.Multipart.Multipart' body part will contain the full headers from that body part, libsoup does not interpret them according to MIME rules. For example, each body part is assumed to have \"binary\" Content-Transfer-Encoding, even if its headers explicitly state otherwise. In other words, don\'t try to use 'GI.Soup.Structs.Multipart.Multipart' for handling real MIME multiparts. /Since: 2.26/ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Soup.Structs.Multipart ( -- * Exported types Multipart(..) , noMultipart , -- * Methods -- ** appendFormFile #method:appendFormFile# #if ENABLE_OVERLOADING MultipartAppendFormFileMethodInfo , #endif multipartAppendFormFile , -- ** appendFormString #method:appendFormString# #if ENABLE_OVERLOADING MultipartAppendFormStringMethodInfo , #endif multipartAppendFormString , -- ** appendPart #method:appendPart# #if ENABLE_OVERLOADING MultipartAppendPartMethodInfo , #endif multipartAppendPart , -- ** free #method:free# #if ENABLE_OVERLOADING MultipartFreeMethodInfo , #endif multipartFree , -- ** getLength #method:getLength# #if ENABLE_OVERLOADING MultipartGetLengthMethodInfo , #endif multipartGetLength , -- ** getPart #method:getPart# #if ENABLE_OVERLOADING MultipartGetPartMethodInfo , #endif multipartGetPart , -- ** new #method:new# multipartNew , -- ** newFromMessage #method:newFromMessage# multipartNewFromMessage , -- ** toMessage #method:toMessage# #if ENABLE_OVERLOADING MultipartToMessageMethodInfo , #endif multipartToMessage , ) 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 {-# SOURCE #-} qualified GI.Soup.Structs.Buffer as Soup.Buffer import {-# SOURCE #-} qualified GI.Soup.Structs.MessageBody as Soup.MessageBody import {-# SOURCE #-} qualified GI.Soup.Structs.MessageHeaders as Soup.MessageHeaders -- | Memory-managed wrapper type. newtype Multipart = Multipart (ManagedPtr Multipart) foreign import ccall "soup_multipart_get_type" c_soup_multipart_get_type :: IO GType instance BoxedObject Multipart where boxedType _ = c_soup_multipart_get_type -- | A convenience alias for `Nothing` :: `Maybe` `Multipart`. noMultipart :: Maybe Multipart noMultipart = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList Multipart type instance O.AttributeList Multipart = MultipartAttributeList type MultipartAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method Multipart::new -- method type : Constructor -- Args : [Arg {argCName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the MIME type of the multipart to create.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Multipart"})) -- throws : False -- Skip return : False foreign import ccall "soup_multipart_new" soup_multipart_new :: CString -> -- mime_type : TBasicType TUTF8 IO (Ptr Multipart) {- | Creates a new empty 'GI.Soup.Structs.Multipart.Multipart' with a randomly-generated boundary string. Note that /@mimeType@/ must be the full MIME type, including \"multipart\/\". /Since: 2.26/ -} multipartNew :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@mimeType@/: the MIME type of the multipart to create. -} -> m Multipart {- ^ __Returns:__ a new empty 'GI.Soup.Structs.Multipart.Multipart' of the given /@mimeType@/ -} multipartNew mimeType = liftIO $ do mimeType' <- textToCString mimeType result <- soup_multipart_new mimeType' checkUnexpectedReturnNULL "multipartNew" result result' <- (wrapBoxed Multipart) result freeMem mimeType' return result' #if ENABLE_OVERLOADING #endif -- method Multipart::new_from_message -- method type : Constructor -- Args : [Arg {argCName = "headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the headers of the HTTP message to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "body", argType = TInterface (Name {namespace = "Soup", name = "MessageBody"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the body of the HTTP message to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Soup", name = "Multipart"})) -- throws : False -- Skip return : False foreign import ccall "soup_multipart_new_from_message" soup_multipart_new_from_message :: Ptr Soup.MessageHeaders.MessageHeaders -> -- headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr Soup.MessageBody.MessageBody -> -- body : TInterface (Name {namespace = "Soup", name = "MessageBody"}) IO (Ptr Multipart) {- | Parses /@headers@/ and /@body@/ to form a new 'GI.Soup.Structs.Multipart.Multipart' /Since: 2.26/ -} multipartNewFromMessage :: (B.CallStack.HasCallStack, MonadIO m) => Soup.MessageHeaders.MessageHeaders {- ^ /@headers@/: the headers of the HTTP message to parse -} -> Soup.MessageBody.MessageBody {- ^ /@body@/: the body of the HTTP message to parse -} -> m (Maybe Multipart) {- ^ __Returns:__ a new 'GI.Soup.Structs.Multipart.Multipart' (or 'Nothing' if the message couldn\'t be parsed or wasn\'t multipart). -} multipartNewFromMessage headers body = liftIO $ do headers' <- unsafeManagedPtrGetPtr headers body' <- unsafeManagedPtrGetPtr body result <- soup_multipart_new_from_message headers' body' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (wrapBoxed Multipart) result' return result'' touchManagedPtr headers touchManagedPtr body return maybeResult #if ENABLE_OVERLOADING #endif -- method Multipart::append_form_file -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a multipart (presumably of type \"multipart/form-data\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "control_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the control associated with this file", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the file, or %NULL if not known", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "content_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the MIME type of the file, or %NULL if not known", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "body", argType = TInterface (Name {namespace = "Soup", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file data", 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_append_form_file" soup_multipart_append_form_file :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) CString -> -- control_name : TBasicType TUTF8 CString -> -- filename : TBasicType TUTF8 CString -> -- content_type : TBasicType TUTF8 Ptr Soup.Buffer.Buffer -> -- body : TInterface (Name {namespace = "Soup", name = "Buffer"}) IO () {- | Adds a new MIME part containing /@body@/ to /@multipart@/, using \"Content-Disposition: form-data\", as per the HTML forms specification. See 'GI.Soup.Functions.formRequestNewFromMultipart' for more details. /Since: 2.26/ -} multipartAppendFormFile :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a multipart (presumably of type \"multipart\/form-data\") -} -> T.Text {- ^ /@controlName@/: the name of the control associated with this file -} -> T.Text {- ^ /@filename@/: the name of the file, or 'Nothing' if not known -} -> T.Text {- ^ /@contentType@/: the MIME type of the file, or 'Nothing' if not known -} -> Soup.Buffer.Buffer {- ^ /@body@/: the file data -} -> m () multipartAppendFormFile multipart controlName filename contentType body = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart controlName' <- textToCString controlName filename' <- textToCString filename contentType' <- textToCString contentType body' <- unsafeManagedPtrGetPtr body soup_multipart_append_form_file multipart' controlName' filename' contentType' body' touchManagedPtr multipart touchManagedPtr body freeMem controlName' freeMem filename' freeMem contentType' return () #if ENABLE_OVERLOADING data MultipartAppendFormFileMethodInfo instance (signature ~ (T.Text -> T.Text -> T.Text -> Soup.Buffer.Buffer -> m ()), MonadIO m) => O.MethodInfo MultipartAppendFormFileMethodInfo Multipart signature where overloadedMethod _ = multipartAppendFormFile #endif -- method Multipart::append_form_string -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a multipart (presumably of type \"multipart/form-data\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "control_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the control associated with @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the body data", 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_append_form_string" soup_multipart_append_form_string :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) CString -> -- control_name : TBasicType TUTF8 CString -> -- data : TBasicType TUTF8 IO () {- | Adds a new MIME part containing /@data@/ to /@multipart@/, using \"Content-Disposition: form-data\", as per the HTML forms specification. See 'GI.Soup.Functions.formRequestNewFromMultipart' for more details. /Since: 2.26/ -} multipartAppendFormString :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a multipart (presumably of type \"multipart\/form-data\") -} -> T.Text {- ^ /@controlName@/: the name of the control associated with /@data@/ -} -> T.Text {- ^ /@data@/: the body data -} -> m () multipartAppendFormString multipart controlName data_ = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart controlName' <- textToCString controlName data_' <- textToCString data_ soup_multipart_append_form_string multipart' controlName' data_' touchManagedPtr multipart freeMem controlName' freeMem data_' return () #if ENABLE_OVERLOADING data MultipartAppendFormStringMethodInfo instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo MultipartAppendFormStringMethodInfo Multipart signature where overloadedMethod _ = multipartAppendFormString #endif -- method Multipart::append_part -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipart", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the MIME part headers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "body", argType = TInterface (Name {namespace = "Soup", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the MIME part body", 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_append_part" soup_multipart_append_part :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) Ptr Soup.MessageHeaders.MessageHeaders -> -- headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr Soup.Buffer.Buffer -> -- body : TInterface (Name {namespace = "Soup", name = "Buffer"}) IO () {- | Adds a new MIME part to /@multipart@/ with the given headers and body. (The multipart will make its own copies of /@headers@/ and /@body@/, so you should free your copies if you are not using them for anything else.) /Since: 2.26/ -} multipartAppendPart :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a 'GI.Soup.Structs.Multipart.Multipart' -} -> Soup.MessageHeaders.MessageHeaders {- ^ /@headers@/: the MIME part headers -} -> Soup.Buffer.Buffer {- ^ /@body@/: the MIME part body -} -> m () multipartAppendPart multipart headers body = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart headers' <- unsafeManagedPtrGetPtr headers body' <- unsafeManagedPtrGetPtr body soup_multipart_append_part multipart' headers' body' touchManagedPtr multipart touchManagedPtr headers touchManagedPtr body return () #if ENABLE_OVERLOADING data MultipartAppendPartMethodInfo instance (signature ~ (Soup.MessageHeaders.MessageHeaders -> Soup.Buffer.Buffer -> m ()), MonadIO m) => O.MethodInfo MultipartAppendPartMethodInfo Multipart signature where overloadedMethod _ = multipartAppendPart #endif -- method Multipart::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipart", 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_free" soup_multipart_free :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) IO () {- | Frees /@multipart@/ /Since: 2.26/ -} multipartFree :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a 'GI.Soup.Structs.Multipart.Multipart' -} -> m () multipartFree multipart = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart soup_multipart_free multipart' touchManagedPtr multipart return () #if ENABLE_OVERLOADING data MultipartFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MultipartFreeMethodInfo Multipart signature where overloadedMethod _ = multipartFree #endif -- method Multipart::get_length -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipart", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "soup_multipart_get_length" soup_multipart_get_length :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) IO Int32 {- | Gets the number of body parts in /@multipart@/ /Since: 2.26/ -} multipartGetLength :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a 'GI.Soup.Structs.Multipart.Multipart' -} -> m Int32 {- ^ __Returns:__ the number of body parts in /@multipart@/ -} multipartGetLength multipart = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart result <- soup_multipart_get_length multipart' touchManagedPtr multipart return result #if ENABLE_OVERLOADING data MultipartGetLengthMethodInfo instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo MultipartGetLengthMethodInfo Multipart signature where overloadedMethod _ = multipartGetLength #endif -- method Multipart::get_part -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipart", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "part", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the part number to get (counting from 0)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the MIME part\nheaders", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "body", argType = TInterface (Name {namespace = "Soup", name = "Buffer"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the MIME part\nbody", 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_multipart_get_part" soup_multipart_get_part :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) Int32 -> -- part : TBasicType TInt Ptr (Ptr Soup.MessageHeaders.MessageHeaders) -> -- headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr (Ptr Soup.Buffer.Buffer) -> -- body : TInterface (Name {namespace = "Soup", name = "Buffer"}) IO CInt {- | Gets the indicated body part from /@multipart@/. /Since: 2.26/ -} multipartGetPart :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a 'GI.Soup.Structs.Multipart.Multipart' -} -> Int32 {- ^ /@part@/: the part number to get (counting from 0) -} -> m ((Bool, Soup.MessageHeaders.MessageHeaders, Soup.Buffer.Buffer)) {- ^ __Returns:__ 'True' on success, 'False' if /@part@/ is out of range (in which case /@headers@/ and /@body@/ won\'t be set) -} multipartGetPart multipart part = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart headers <- allocMem :: IO (Ptr (Ptr Soup.MessageHeaders.MessageHeaders)) body <- allocMem :: IO (Ptr (Ptr Soup.Buffer.Buffer)) result <- soup_multipart_get_part multipart' part headers body let result' = (/= 0) result headers' <- peek headers headers'' <- (newBoxed Soup.MessageHeaders.MessageHeaders) headers' body' <- peek body body'' <- (newBoxed Soup.Buffer.Buffer) body' touchManagedPtr multipart freeMem headers freeMem body return (result', headers'', body'') #if ENABLE_OVERLOADING data MultipartGetPartMethodInfo instance (signature ~ (Int32 -> m ((Bool, Soup.MessageHeaders.MessageHeaders, Soup.Buffer.Buffer))), MonadIO m) => O.MethodInfo MultipartGetPartMethodInfo Multipart signature where overloadedMethod _ = multipartGetPart #endif -- method Multipart::to_message -- method type : OrdinaryMethod -- Args : [Arg {argCName = "multipart", argType = TInterface (Name {namespace = "Soup", name = "Multipart"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMultipart", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_headers", argType = TInterface (Name {namespace = "Soup", name = "MessageHeaders"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the headers of the HTTP message to serialize @multipart to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_body", argType = TInterface (Name {namespace = "Soup", name = "MessageBody"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the body of the HTTP message to serialize @multipart to", 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_to_message" soup_multipart_to_message :: Ptr Multipart -> -- multipart : TInterface (Name {namespace = "Soup", name = "Multipart"}) Ptr Soup.MessageHeaders.MessageHeaders -> -- dest_headers : TInterface (Name {namespace = "Soup", name = "MessageHeaders"}) Ptr Soup.MessageBody.MessageBody -> -- dest_body : TInterface (Name {namespace = "Soup", name = "MessageBody"}) IO () {- | Serializes /@multipart@/ to /@destHeaders@/ and /@destBody@/. /Since: 2.26/ -} multipartToMessage :: (B.CallStack.HasCallStack, MonadIO m) => Multipart {- ^ /@multipart@/: a 'GI.Soup.Structs.Multipart.Multipart' -} -> Soup.MessageHeaders.MessageHeaders {- ^ /@destHeaders@/: the headers of the HTTP message to serialize /@multipart@/ to -} -> Soup.MessageBody.MessageBody {- ^ /@destBody@/: the body of the HTTP message to serialize /@multipart@/ to -} -> m () multipartToMessage multipart destHeaders destBody = liftIO $ do multipart' <- unsafeManagedPtrGetPtr multipart destHeaders' <- unsafeManagedPtrGetPtr destHeaders destBody' <- unsafeManagedPtrGetPtr destBody soup_multipart_to_message multipart' destHeaders' destBody' touchManagedPtr multipart touchManagedPtr destHeaders touchManagedPtr destBody return () #if ENABLE_OVERLOADING data MultipartToMessageMethodInfo instance (signature ~ (Soup.MessageHeaders.MessageHeaders -> Soup.MessageBody.MessageBody -> m ()), MonadIO m) => O.MethodInfo MultipartToMessageMethodInfo Multipart signature where overloadedMethod _ = multipartToMessage #endif #if ENABLE_OVERLOADING type family ResolveMultipartMethod (t :: Symbol) (o :: *) :: * where ResolveMultipartMethod "appendFormFile" o = MultipartAppendFormFileMethodInfo ResolveMultipartMethod "appendFormString" o = MultipartAppendFormStringMethodInfo ResolveMultipartMethod "appendPart" o = MultipartAppendPartMethodInfo ResolveMultipartMethod "free" o = MultipartFreeMethodInfo ResolveMultipartMethod "toMessage" o = MultipartToMessageMethodInfo ResolveMultipartMethod "getLength" o = MultipartGetLengthMethodInfo ResolveMultipartMethod "getPart" o = MultipartGetPartMethodInfo ResolveMultipartMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveMultipartMethod t Multipart, O.MethodInfo info Multipart p) => OL.IsLabel t (Multipart -> 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