2018-11-24 19:12:22 +08:00

49 lines
1.4 KiB
Elm

{-
OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
OpenAPI spec version: 1.0.0
NOTE: This file is auto generated by the openapi-generator.
https://github.com/openapitools/openapi-generator.git
Do not edit this file manually.
-}
module Data.ApiResponse exposing (ApiResponse, decoder, encoder)
import Dict exposing (Dict)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Pipeline exposing (decode, optional, required)
import Json.Encode as Encode
{-| Describes the result of uploading an image resource
-}
type alias ApiResponse =
{ code : Maybe (Int)
, type_ : Maybe (String)
, message : Maybe (String)
}
decoder : Decoder ApiResponse
decoder =
decode ApiResponse
|> optional "code" (Decode.nullable Decode.int) Nothing
|> optional "type" (Decode.nullable Decode.string) Nothing
|> optional "message" (Decode.nullable Decode.string) Nothing
encoder : ApiResponse -> Encode.Value
encoder model =
Encode.object
[ ( "code", Maybe.withDefault Encode.null (Maybe.map Encode.int model.code) )
, ( "type", Maybe.withDefault Encode.null (Maybe.map Encode.string model.type_) )
, ( "message", Maybe.withDefault Encode.null (Maybe.map Encode.string model.message) )
]