Skip to content

multipart/form-data#289

Merged
wolfadex merged 1 commit intomainfrom
multipart-form-data
Apr 2, 2026
Merged

multipart/form-data#289
wolfadex merged 1 commit intomainfrom
multipart-form-data

Conversation

@miniBill
Copy link
Copy Markdown
Collaborator

@miniBill miniBill commented Mar 24, 2026

@github-actions

This comment was marked as outdated.

2 similar comments
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@miniBill
Copy link
Copy Markdown
Collaborator Author

That's way more diff than I was expecting 🤔

@miniBill miniBill marked this pull request as draft March 24, 2026 18:39
@miniBill miniBill force-pushed the multipart-form-data branch 3 times, most recently from d7ceed2 to f194057 Compare March 24, 2026 19:29
@miniBill miniBill force-pushed the multipart-form-data branch 5 times, most recently from 4cb08ea to 3efc4cc Compare April 1, 2026 10:29
@miniBill
Copy link
Copy Markdown
Collaborator Author

miniBill commented Apr 1, 2026

Depends on #295

@github-actions

This comment was marked as outdated.

@miniBill miniBill force-pushed the multipart-form-data branch from 3efc4cc to 818f042 Compare April 2, 2026 10:07
@miniBill miniBill marked this pull request as ready for review April 2, 2026 10:08
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/MultipartFormData/Api.elm branch/cli/generated/MultipartFormData/Api.elm
0a1,259
> module MultipartFormData.Api exposing (api, apiTask, noMaybes, noMaybesTask)
> 
> {-|
> 
> 
> ## Operations
> 
> @docs api, apiTask, noMaybes, noMaybesTask
> 
> -}
> 
> import Bytes
> import Dict
> import Http
> import Json.Decode
> import Json.Encode
> import OpenApi.Common
> import Task
> import Url.Builder
> 
> 
> api :
>     { toMsg : Result (OpenApi.Common.Error e String) () -> msg
>     , body :
>         { address : Maybe { city : Maybe String, street : Maybe String }
>         , id : String
>         , profileImage : Maybe Bytes.Bytes
>         }
>     }
>     -> Cmd msg
> api config =
>     Http.request
>         { url = Url.Builder.absolute [ "api" ] []
>         , method = "POST"
>         , headers = []
>         , expect =
>             OpenApi.Common.expectJsonCustom
>                 (Dict.fromList [])
>                 (Json.Decode.succeed ())
>                 config.toMsg
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "address"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.object
>                                         (List.filterMap
>                                             Basics.identity
>                                             [ Maybe.map
>                                                 (\mapUnpack0 ->
>                                                     ( "city"
>                                                     , Json.Encode.string
>                                                         mapUnpack0
>                                                     )
>                                                 )
>                                                 mapUnpack.city
>                                             , Maybe.map
>                                                 (\mapUnpack0 ->
>                                                     ( "street"
>                                                     , Json.Encode.string
>                                                         mapUnpack0
>                                                     )
>                                                 )
>                                                 mapUnpack.street
>                                             ]
>                                         )
>                                     )
>                                 )
>                         )
>                         config.body.address
>                     , Just (Http.stringPart "id" config.body.id)
>                     , Maybe.map
>                         (Http.bytesPart
>                             "profileImage"
>                             "application/octet-stream"
>                         )
>                         config.body.profileImage
>                     ]
>                 )
>         , timeout = Nothing
>         , tracker = Nothing
>         }
> 
> 
> apiTask :
>     { body :
>         { address : Maybe { city : Maybe String, street : Maybe String }
>         , id : String
>         , profileImage : Maybe Bytes.Bytes
>         }
>     }
>     -> Task.Task (OpenApi.Common.Error e String) ()
> apiTask config =
>     Http.task
>         { url = Url.Builder.absolute [ "api" ] []
>         , method = "POST"
>         , headers = []
>         , resolver =
>             OpenApi.Common.jsonResolverCustom
>                 (Dict.fromList [])
>                 (Json.Decode.succeed ())
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "address"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.object
>                                         (List.filterMap
>                                             Basics.identity
>                                             [ Maybe.map
>                                                 (\mapUnpack0 ->
>                                                     ( "city"
>                                                     , Json.Encode.string
>                                                         mapUnpack0
>                                                     )
>                                                 )
>                                                 mapUnpack.city
>                                             , Maybe.map
>                                                 (\mapUnpack0 ->
>                                                     ( "street"
>                                                     , Json.Encode.string
>                                                         mapUnpack0
>                                                     )
>                                                 )
>                                                 mapUnpack.street
>                                             ]
>                                         )
>                                     )
>                                 )
>                         )
>                         config.body.address
>                     , Just (Http.stringPart "id" config.body.id)
>                     , Maybe.map
>                         (Http.bytesPart
>                             "profileImage"
>                             "application/octet-stream"
>                         )
>                         config.body.profileImage
>                     ]
>                 )
>         , timeout = Nothing
>         }
> 
> 
> noMaybes :
>     { toMsg : Result (OpenApi.Common.Error e String) () -> msg
>     , body :
>         { address : { city : Maybe String, street : Maybe String }
>         , id : String
>         , profileImage : Bytes.Bytes
>         }
>     }
>     -> Cmd msg
> noMaybes config =
>     Http.request
>         { url = Url.Builder.absolute [ "noMaybes" ] []
>         , method = "POST"
>         , headers = []
>         , expect =
>             OpenApi.Common.expectJsonCustom
>                 (Dict.fromList [])
>                 (Json.Decode.succeed ())
>                 config.toMsg
>         , body =
>             Http.multipartBody
>                 [ Http.stringPart
>                     "address"
>                     (Json.Encode.encode
>                         0
>                         (Json.Encode.object
>                             (List.filterMap
>                                 Basics.identity
>                                 [ Maybe.map
>                                     (\mapUnpack ->
>                                         ( "city", Json.Encode.string mapUnpack )
>                                     )
>                                     config.body.address.city
>                                 , Maybe.map
>                                     (\mapUnpack ->
>                                         ( "street"
>                                         , Json.Encode.string mapUnpack
>                                         )
>                                     )
>                                     config.body.address.street
>                                 ]
>                             )
>                         )
>                     )
>                 , Http.stringPart "id" config.body.id
>                 , Http.bytesPart
>                     "profileImage"
>                     "application/octet-stream"
>                     config.body.profileImage
>                 ]
>         , timeout = Nothing
>         , tracker = Nothing
>         }
> 
> 
> noMaybesTask :
>     { body :
>         { address : { city : Maybe String, street : Maybe String }
>         , id : String
>         , profileImage : Bytes.Bytes
>         }
>     }
>     -> Task.Task (OpenApi.Common.Error e String) ()
> noMaybesTask config =
>     Http.task
>         { url = Url.Builder.absolute [ "noMaybes" ] []
>         , method = "POST"
>         , headers = []
>         , resolver =
>             OpenApi.Common.jsonResolverCustom
>                 (Dict.fromList [])
>                 (Json.Decode.succeed ())
>         , body =
>             Http.multipartBody
>                 [ Http.stringPart
>                     "address"
>                     (Json.Encode.encode
>                         0
>                         (Json.Encode.object
>                             (List.filterMap
>                                 Basics.identity
>                                 [ Maybe.map
>                                     (\mapUnpack ->
>                                         ( "city", Json.Encode.string mapUnpack )
>                                     )
>                                     config.body.address.city
>                                 , Maybe.map
>                                     (\mapUnpack ->
>                                         ( "street"
>                                         , Json.Encode.string mapUnpack
>                                         )
>                                     )
>                                     config.body.address.street
>                                 ]
>                             )
>                         )
>                     )
>                 , Http.stringPart "id" config.body.id
>                 , Http.bytesPart
>                     "profileImage"
>                     "application/octet-stream"
>                     config.body.profileImage
>                 ]
>         , timeout = Nothing
>         }
diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/MultipartFormData/Types/RequestBodies.elm branch/cli/generated/MultipartFormData/Types/RequestBodies.elm
0a1,26
> module MultipartFormData.Types.RequestBodies exposing (Multipart, MultipartNoMaybes)
> 
> {-|
> 
> 
> ## Aliases
> 
> @docs Multipart, MultipartNoMaybes
> 
> -}
> 
> import Uuid
> 
> 
> type alias Multipart =
>     { address : Maybe { city : Maybe String, street : Maybe String }
>     , id : Uuid.Uuid
>     , profileImage : Maybe String
>     }
> 
> 
> type alias MultipartNoMaybes =
>     { address : { city : Maybe String, street : Maybe String }
>     , id : Uuid.Uuid
>     , profileImage : String
>     }
diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/TelegramBotApi/Api.elm branch/cli/generated/TelegramBotApi/Api.elm
120d119
< import Bytes
133a133,148
> addStickerToSet :
>     { toMsg :
>         Result
>             (OpenApi.Common.Error TelegramBotApi.Types.Error String)
>             { ok :
>                 Bool
>             , result : Bool
>             }
>         -> msg
>     , body :
>         { name : String
>         , sticker : TelegramBotApi.Types.InputSticker
>         , user_id : Int
>         }
>     }
>     -> Cmd msg
159c174,188
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 [ Http.stringPart "name" config.body.name
>                 , Http.stringPart
>                     "sticker"
>                     (Json.Encode.encode
>                         0
>                         (TelegramBotApi.Json.encodeInputSticker
>                             config.body.sticker
>                         )
>                     )
>                 , Http.stringPart
>                     "user_id"
>                     (Json.Encode.encode 0 (Json.Encode.int config.body.user_id))
>                 ]
168c197,202
<     { body : Bytes.Bytes }
---
>     { body :
>         { name : String
>         , sticker : TelegramBotApi.Types.InputSticker
>         , user_id : Int
>         }
>     }
200c234,248
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 [ Http.stringPart "name" config.body.name
>                 , Http.stringPart
>                     "sticker"
>                     (Json.Encode.encode
>                         0
>                         (TelegramBotApi.Json.encodeInputSticker
>                             config.body.sticker
>                         )
>                     )
>                 , Http.stringPart
>                     "user_id"
>                     (Json.Encode.encode 0 (Json.Encode.int config.body.user_id))
>                 ]
3393a3442,3460
> createNewStickerSet :
>     { toMsg :
>         Result
>             (OpenApi.Common.Error TelegramBotApi.Types.Error String)
>             { ok :
>                 Bool
>             , result : Bool
>             }
>         -> msg
>     , body :
>         { name : String
>         , needs_repainting : Maybe Bool
>         , sticker_type : Maybe String
>         , stickers : List TelegramBotApi.Types.InputSticker
>         , title : String
>         , user_id : Int
>         }
>     }
>     -> Cmd msg
3419c3486,3532
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Just (Http.stringPart "name" config.body.name)
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "needs_repainting"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.bool mapUnpack)
>                                 )
>                         )
>                         config.body.needs_repainting
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "sticker_type"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.string mapUnpack)
>                                 )
>                         )
>                         config.body.sticker_type
>                     , Just
>                         (Http.stringPart
>                             "stickers"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.list
>                                     TelegramBotApi.Json.encodeInputSticker
>                                     config.body.stickers
>                                 )
>                             )
>                         )
>                     , Just (Http.stringPart "title" config.body.title)
>                     , Just
>                         (Http.stringPart
>                             "user_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.user_id)
>                             )
>                         )
>                     ]
>                 )
3428c3541,3549
<     { body : Bytes.Bytes }
---
>     { body :
>         { name : String
>         , needs_repainting : Maybe Bool
>         , sticker_type : Maybe String
>         , stickers : List TelegramBotApi.Types.InputSticker
>         , title : String
>         , user_id : Int
>         }
>     }
3460c3581,3627
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Just (Http.stringPart "name" config.body.name)
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "needs_repainting"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.bool mapUnpack)
>                                 )
>                         )
>                         config.body.needs_repainting
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "sticker_type"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.string mapUnpack)
>                                 )
>                         )
>                         config.body.sticker_type
>                     , Just
>                         (Http.stringPart
>                             "stickers"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.list
>                                     TelegramBotApi.Json.encodeInputSticker
>                                     config.body.stickers
>                                 )
>                             )
>                         )
>                     , Just (Http.stringPart "title" config.body.title)
>                     , Just
>                         (Http.stringPart
>                             "user_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.user_id)
>                             )
>                         )
>                     ]
>                 )
5802a5970,5987
> editMessageChecklist :
>     { toMsg :
>         Result
>             (OpenApi.Common.Error TelegramBotApi.Types.Error String)
>             { ok :
>                 Bool
>             , result : TelegramBotApi.Types.Message
>             }
>         -> msg
>     , body :
>         { business_connection_id : String
>         , chat_id : Int
>         , checklist : TelegramBotApi.Types.InputChecklist
>         , message_id : Int
>         , reply_markup : Maybe TelegramBotApi.Types.InlineKeyboardMarkup
>         }
>     }
>     -> Cmd msg
5828c6013,6061
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Just
>                         (Http.stringPart
>                             "business_connection_id"
>                             config.body.business_connection_id
>                         )
>                     , Just
>                         (Http.stringPart
>                             "chat_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.chat_id)
>                             )
>                         )
>                     , Just
>                         (Http.stringPart
>                             "checklist"
>                             (Json.Encode.encode
>                                 0
>                                 (TelegramBotApi.Json.encodeInputChecklist
>                                     config.body.checklist
>                                 )
>                             )
>                         )
>                     , Just
>                         (Http.stringPart
>                             "message_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.message_id)
>                             )
>                         )
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "reply_markup"
>                                 (Json.Encode.encode
>                                     0
>                                     (TelegramBotApi.Json.encodeInlineKeyboardMarkup
>                                         mapUnpack
>                                     )
>                                 )
>                         )
>                         config.body.reply_markup
>                     ]
>                 )
5837c6070,6077
<     { body : Bytes.Bytes }
---
>     { body :
>         { business_connection_id : String
>         , chat_id : Int
>         , checklist : TelegramBotApi.Types.InputChecklist
>         , message_id : Int
>         , reply_markup : Maybe TelegramBotApi.Types.InlineKeyboardMarkup
>         }
>     }
5869c6109,6157
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Just
>                         (Http.stringPart
>                             "business_connection_id"
>                             config.body.business_connection_id
>                         )
>                     , Just
>                         (Http.stringPart
>                             "chat_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.chat_id)
>                             )
>                         )
>                     , Just
>                         (Http.stringPart
>                             "checklist"
>                             (Json.Encode.encode
>                                 0
>                                 (TelegramBotApi.Json.encodeInputChecklist
>                                     config.body.checklist
>                                 )
>                             )
>                         )
>                     , Just
>                         (Http.stringPart
>                             "message_id"
>                             (Json.Encode.encode
>                                 0
>                                 (Json.Encode.int config.body.message_id)
>                             )
>                         )
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "reply_markup"
>                                 (Json.Encode.encode
>                                     0
>                                     (TelegramBotApi.Json.encodeInlineKeyboardMarkup
>                                         mapUnpack
>                                     )
>                                 )
>                         )
>                         config.body.reply_markup
>                     ]
>                 )
6167c6455,6462
<     , body : Bytes.Bytes
---
>     , body :
>         { business_connection_id : Maybe String
>         , chat_id : Maybe TelegramBotApi.Types.Int_Or_String
>         , inline_message_id : Maybe String
>         , media : TelegramBotApi.Types.InputMedia
>         , message_id : Maybe Int
>         , reply_markup : Maybe TelegramBotApi.Types.InlineKeyboardMarkup
>         }
6203c6498,6557
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Maybe.map
>                         (Http.stringPart "business_connection_id")
>                         config.body.business_connection_id
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "chat_id"
>                                 (Json.Encode.encode
>                                     0
>                                     (case mapUnpack of
>                                         TelegramBotApi.Types.Int_Or_String__Int content ->
>                                             Json.Encode.int content
> 
>                                         TelegramBotApi.Types.Int_Or_String__String content ->
>                                             Json.Encode.string content
>                                     )
>                                 )
>                         )
>                         config.body.chat_id
>                     , Maybe.map
>                         (Http.stringPart "inline_message_id")
>                         config.body.inline_message_id
>                     , Just
>                         (Http.stringPart
>                             "media"
>                             (Json.Encode.encode
>                                 0
>                                 (TelegramBotApi.Json.encodeInputMedia
>                                     config.body.media
>                                 )
>                             )
>                         )
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "message_id"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.int mapUnpack)
>                                 )
>                         )
>                         config.body.message_id
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "reply_markup"
>                                 (Json.Encode.encode
>                                     0
>                                     (TelegramBotApi.Json.encodeInlineKeyboardMarkup
>                                         mapUnpack
>                                     )
>                                 )
>                         )
>                         config.body.reply_markup
>                     ]
>                 )
6212c6566,6574
<     { body : Bytes.Bytes }
---
>     { body :
>         { business_connection_id : Maybe String
>         , chat_id : Maybe TelegramBotApi.Types.Int_Or_String
>         , inline_message_id : Maybe String
>         , media : TelegramBotApi.Types.InputMedia
>         , message_id : Maybe Int
>         , reply_markup : Maybe TelegramBotApi.Types.InlineKeyboardMarkup
>         }
>     }
6252c6614,6673
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>             Http.multipartBody
>                 (List.filterMap
>                     Basics.identity
>                     [ Maybe.map
>                         (Http.stringPart "business_connection_id")
>                         config.body.business_connection_id
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "chat_id"
>                                 (Json.Encode.encode
>                                     0
>                                     (case mapUnpack of
>                                         TelegramBotApi.Types.Int_Or_String__Int content ->
>                                             Json.Encode.int content
> 
>                                         TelegramBotApi.Types.Int_Or_String__String content ->
>                                             Json.Encode.string content
>                                     )
>                                 )
>                         )
>                         config.body.chat_id
>                     , Maybe.map
>                         (Http.stringPart "inline_message_id")
>                         config.body.inline_message_id
>                     , Just
>                         (Http.stringPart
>                             "media"
>                             (Json.Encode.encode
>                                 0
>                                 (TelegramBotApi.Json.encodeInputMedia
>                                     config.body.media
>                                 )
>                             )
>                         )
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "message_id"
>                                 (Json.Encode.encode
>                                     0
>                                     (Json.Encode.int mapUnpack)
>                                 )
>                         )
>                         config.body.message_id
>                     , Maybe.map
>                         (\mapUnpack ->
>                             Http.stringPart
>                                 "reply_markup"
>                                 (Json.Encode.encode
>                                     0
>                                     (TelegramBotApi.Json.encodeInlineKeyboardMarkup
>                                         mapUnpack
>                                     )
>                                 )
>                         )
>                         config.body.reply_markup
>                     ]
>                 )
6724a7146,7165
> editStory :
>     { toMsg :
>         Result
>             (OpenApi.Common.Error TelegramBotApi.Types.Error String)
>             { ok :
>                 Bool
>             , result : TelegramBotApi.Types.Story
>             }
>         -> msg
>     , body :
>         { areas : Maybe (List TelegramBotApi.Types.StoryArea)
>         , business_connection_id : String
>         , caption : Maybe String
>         , caption_entities : Maybe (List TelegramBotApi.Types.MessageEntity)
>         , content : TelegramBotApi.Types.InputStoryContent
>         , parse_mode : Maybe String
>         , story_id : Int
>         }
>     }
>     -> Cmd msg
6750c7191,7249
<         , body = Http.bytesBody "multipart/form-data" config.body
---
>         , body =
>       

@wolfadex wolfadex merged commit 65d3e54 into main Apr 2, 2026
2 checks passed
@wolfadex wolfadex deleted the multipart-form-data branch April 2, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants