Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Author
|
(the test fix is necessary because the tests are run on the package so it picks the latest version of elm-codegen and the new version has a formatting fix) |
diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/RealworldConduitApi/Api.elm branch/cli/generated/RealworldConduitApi/Api.elm
2,4c2,4
< ( deleteArticle, deleteArticleTask, getArticle, getArticleTask, getArticles, getArticlesFeed
< , getArticlesFeedTask, getArticlesTask
< , deleteArticleComment, deleteArticleCommentTask, getArticleComments, getArticleCommentsTask
---
> ( createArticle, createArticleTask, deleteArticle, deleteArticleTask, getArticle, getArticleTask
> , getArticles, getArticlesFeed, getArticlesFeedTask, getArticlesTask, updateArticle, updateArticleTask
> , createArticleComment, createArticleCommentTask, deleteArticleComment, deleteArticleCommentTask, getArticleComments, getArticleCommentsTask
8c8,9
< , getCurrentUser, getCurrentUserTask
---
> , createUser, createUserTask, getCurrentUser, getCurrentUserTask, login, loginTask
> , updateCurrentUser, updateCurrentUserTask
16,17c17,18
< @docs deleteArticle, deleteArticleTask, getArticle, getArticleTask, getArticles, getArticlesFeed
< @docs getArticlesFeedTask, getArticlesTask
---
> @docs createArticle, createArticleTask, deleteArticle, deleteArticleTask, getArticle, getArticleTask
> @docs getArticles, getArticlesFeed, getArticlesFeedTask, getArticlesTask, updateArticle, updateArticleTask
22c23
< @docs deleteArticleComment, deleteArticleCommentTask, getArticleComments, getArticleCommentsTask
---
> @docs createArticleComment, createArticleCommentTask, deleteArticleComment, deleteArticleCommentTask, getArticleComments, getArticleCommentsTask
42c43,44
< @docs getCurrentUser, getCurrentUserTask
---
> @docs createUser, createUserTask, getCurrentUser, getCurrentUserTask, login, loginTask
> @docs updateCurrentUser, updateCurrentUserTask
48a51
> import Json.Encode
49a53
> import RealworldConduitApi.Json
50a55
> import RealworldConduitApi.Types
55a61,169
> {-| Create an article
>
> Create an article. Auth is required
>
> -}
> createArticle :
> { authorization : { token : String }
> , toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.CreateArticle_Error String) RealworldConduitApi.Types.Responses.SingleArticleResponse
> -> msg
> , body : { article : RealworldConduitApi.Types.NewArticle }
> }
> -> Cmd msg
> createArticle config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles" ]
> []
> , method = "POST"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticle_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticle_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleArticleResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "article"
> , RealworldConduitApi.Json.encodeNewArticle
> config.body.article
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Create an article
>
> Create an article. Auth is required
>
> -}
> createArticleTask :
> { authorization : { token : String }
> , body : { article : RealworldConduitApi.Types.NewArticle }
> }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.CreateArticle_Error String) RealworldConduitApi.Types.Responses.SingleArticleResponse
> createArticleTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles" ]
> []
> , method = "POST"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticle_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticle_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleArticleResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "article"
> , RealworldConduitApi.Json.encodeNewArticle
> config.body.article
> )
> ]
> )
> , timeout = Nothing
> }
>
>
452a567,788
> {-| Update an article
>
> Update an article. Auth is required
>
> -}
> updateArticle :
> { authorization : { token : String }
> , toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.UpdateArticle_Error String) RealworldConduitApi.Types.Responses.SingleArticleResponse
> -> msg
> , body : { article : RealworldConduitApi.Types.UpdateArticle }
> , params : { slug : String }
> }
> -> Cmd msg
> updateArticle config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles", config.params.slug ]
> []
> , method = "PUT"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateArticle_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateArticle_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleArticleResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "article"
> , RealworldConduitApi.Json.encodeUpdateArticle
> config.body.article
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Update an article
>
> Update an article. Auth is required
>
> -}
> updateArticleTask :
> { authorization : { token : String }
> , body : { article : RealworldConduitApi.Types.UpdateArticle }
> , params : { slug : String }
> }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.UpdateArticle_Error String) RealworldConduitApi.Types.Responses.SingleArticleResponse
> updateArticleTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles", config.params.slug ]
> []
> , method = "PUT"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateArticle_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateArticle_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleArticleResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "article"
> , RealworldConduitApi.Json.encodeUpdateArticle
> config.body.article
> )
> ]
> )
> , timeout = Nothing
> }
>
>
> {-| Create a comment for an article
>
> Create a comment for an article. Auth is required
>
> -}
> createArticleComment :
> { authorization : { token : String }
> , toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.CreateArticleComment_Error String) RealworldConduitApi.Types.Responses.SingleCommentResponse
> -> msg
> , body : { comment : RealworldConduitApi.Types.NewComment }
> , params : { slug : String }
> }
> -> Cmd msg
> createArticleComment config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles", config.params.slug, "comments" ]
> []
> , method = "POST"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticleComment_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticleComment_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleCommentResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "comment"
> , RealworldConduitApi.Json.encodeNewComment
> config.body.comment
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Create a comment for an article
>
> Create a comment for an article. Auth is required
>
> -}
> createArticleCommentTask :
> { authorization : { token : String }
> , body : { comment : RealworldConduitApi.Types.NewComment }
> , params : { slug : String }
> }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.CreateArticleComment_Error String) RealworldConduitApi.Types.Responses.SingleCommentResponse
> createArticleCommentTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "articles", config.params.slug, "comments" ]
> []
> , method = "POST"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticleComment_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.CreateArticleComment_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeSingleCommentResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "comment"
> , RealworldConduitApi.Json.encodeNewComment
> config.body.comment
> )
> ]
> )
> , timeout = Nothing
> }
>
>
1134a1471,1546
> {-| Register a new user
> -}
> createUser :
> { toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.GenericError String) RealworldConduitApi.Types.Responses.UserResponse
> -> msg
> , body : { user : RealworldConduitApi.Types.NewUser }
> }
> -> Cmd msg
> createUser config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "users" ]
> []
> , method = "POST"
> , headers = []
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "422"
> , RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeNewUser config.body.user
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Register a new user
> -}
> createUserTask :
> { body : { user : RealworldConduitApi.Types.NewUser } }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.GenericError String) RealworldConduitApi.Types.Responses.UserResponse
> createUserTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "users" ]
> []
> , method = "POST"
> , headers = []
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "422"
> , RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeNewUser config.body.user
> )
> ]
> )
> , timeout = Nothing
> }
>
>
1214a1627,1827
> , timeout = Nothing
> }
>
>
> {-| Existing user login
>
> Login for existing user
>
> -}
> login :
> { toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.Login_Error String) RealworldConduitApi.Types.Responses.UserResponse
> -> msg
> , body : { user : RealworldConduitApi.Types.LoginUser }
> }
> -> Cmd msg
> login config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "users", "login" ]
> []
> , method = "POST"
> , headers = []
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.Login_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.Login_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeLoginUser
> config.body.user
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Existing user login
>
> Login for existing user
>
> -}
> loginTask :
> { body : { user : RealworldConduitApi.Types.LoginUser } }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.Login_Error String) RealworldConduitApi.Types.Responses.UserResponse
> loginTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.realworld.io/api"
> [ "users", "login" ]
> []
> , method = "POST"
> , headers = []
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.Login_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.Login_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeLoginUser
> config.body.user
> )
> ]
> )
> , timeout = Nothing
> }
>
>
> {-| Update current user
>
> Updated user information for current user
>
> -}
> updateCurrentUser :
> { authorization : { token : String }
> , toMsg :
> Result (OpenApi.Common.Error RealworldConduitApi.Types.Responses.UpdateCurrentUser_Error String) RealworldConduitApi.Types.Responses.UserResponse
> -> msg
> , body : { user : RealworldConduitApi.Types.UpdateUser }
> }
> -> Cmd msg
> updateCurrentUser config =
> Http.request
> { url =
> Url.Builder.crossOrigin "https://api.realworld.io/api" [ "user" ] []
> , method = "PUT"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateCurrentUser_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateCurrentUser_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeUpdateUser
> config.body.user
> )
> ]
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Update current user
>
> Updated user information for current user
>
> -}
> updateCurrentUserTask :
> { authorization : { token : String }
> , body : { user : RealworldConduitApi.Types.UpdateUser }
> }
> -> Task.Task (OpenApi.Common.Error RealworldConduitApi.Types.Responses.UpdateCurrentUser_Error String) RealworldConduitApi.Types.Responses.UserResponse
> updateCurrentUserTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin "https://api.realworld.io/api" [ "user" ] []
> , method = "PUT"
> , headers =
> [ Http.header
> "Authorization"
> ("Token " ++ config.authorization.token)
> ]
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "401"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateCurrentUser_401
> RealworldConduitApi.Json.Responses.decodeUnauthorized
> )
> , ( "422"
> , Json.Decode.map
> RealworldConduitApi.Types.Responses.UpdateCurrentUser_422
> RealworldConduitApi.Json.Responses.decodeGenericError
> )
> ]
> )
> RealworldConduitApi.Json.Responses.decodeUserResponse
> , body =
> Http.jsonBody
> (Json.Encode.object
> [ ( "user"
> , RealworldConduitApi.Json.encodeUpdateUser
> config.body.user
> )
> ]
> )
diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/RealworldConduitApi/Types/Responses.elm branch/cli/generated/RealworldConduitApi/Types/Responses.elm
4,5c4,6
< , CreateArticleFavorite_Error(..), DeleteArticleComment_Error(..), DeleteArticleFavorite_Error(..), DeleteArticle_Error(..), FollowUserByUsername_Error(..), GetArticleComments_Error(..)
< , GetArticlesFeed_Error(..), GetArticles_Error(..), GetCurrentUser_Error(..), GetProfileByUsername_Error(..), UnfollowUserByUsername_Error(..)
---
> , CreateArticleComment_Error(..), CreateArticleFavorite_Error(..), CreateArticle_Error(..), DeleteArticleComment_Error(..), DeleteArticleFavorite_Error(..), DeleteArticle_Error(..)
> , FollowUserByUsername_Error(..), GetArticleComments_Error(..), GetArticlesFeed_Error(..), GetArticles_Error(..), GetCurrentUser_Error(..), GetProfileByUsername_Error(..)
> , Login_Error(..), UnfollowUserByUsername_Error(..), UpdateArticle_Error(..), UpdateCurrentUser_Error(..)
19,20c20,22
< @docs CreateArticleFavorite_Error, DeleteArticleComment_Error, DeleteArticleFavorite_Error, DeleteArticle_Error, FollowUserByUsername_Error, GetArticleComments_Error
< @docs GetArticlesFeed_Error, GetArticles_Error, GetCurrentUser_Error, GetProfileByUsername_Error, UnfollowUserByUsername_Error
---
> @docs CreateArticleComment_Error, CreateArticleFavorite_Error, CreateArticle_Error, DeleteArticleComment_Error, DeleteArticleFavorite_Error, DeleteArticle_Error
> @docs FollowUserByUsername_Error, GetArticleComments_Error, GetArticlesFeed_Error, GetArticles_Error, GetCurrentUser_Error, GetProfileByUsername_Error
> @docs Login_Error, UnfollowUserByUsername_Error, UpdateArticle_Error, UpdateCurrentUser_Error
66a69,73
> type CreateArticleComment_Error
> = CreateArticleComment_401 Unauthorized
> | CreateArticleComment_422 GenericError
>
>
71a79,83
> type CreateArticle_Error
> = CreateArticle_401 Unauthorized
> | CreateArticle_422 GenericError
>
>
116a129,133
> type Login_Error
> = Login_401 Unauthorized
> | Login_422 GenericError
>
>
119a137,146
>
>
> type UpdateArticle_Error
> = UpdateArticle_401 Unauthorized
> | UpdateArticle_422 GenericError
>
>
> type UpdateCurrentUser_Error
> = UpdateCurrentUser_401 Unauthorized
> | UpdateCurrentUser_422 GenericError
|
Collaborator
Author
|
I checked the diff with difftastic (great tool, btw) and it's only added functions |
Merged
wolfadex
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR mostly deduplicates code. It does fix a couple missing functions in one of the examples, but the main objective is to make the multipart/form-data PR smaller