mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 10:35:25 +00:00
update elm petstore samples
This commit is contained in:
parent
7db12aa4af
commit
2146081ffb
@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
4.0.0-SNAPSHOT
|
||||
=======
|
||||
3.3.4-SNAPSHOT
|
||||
>>>>>>> origin
|
||||
4.0.0-SNAPSHOT
|
@ -21,9 +21,9 @@ 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
|
||||
{ code : Maybe (Int)
|
||||
, type_ : Maybe (String)
|
||||
, message : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -35,10 +35,14 @@ decoder =
|
||||
|> 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) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@ import Json.Encode as Encode
|
||||
{-| A category for a pet
|
||||
-}
|
||||
type alias Category =
|
||||
{ id : Maybe Int
|
||||
, name : Maybe String
|
||||
{ id : Maybe (Int)
|
||||
, name : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -33,9 +33,13 @@ decoder =
|
||||
|> optional "name" (Decode.nullable Decode.string) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Category -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
[ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) )
|
||||
, ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -22,12 +22,12 @@ import Json.Encode as Encode
|
||||
{-| An order for a pets from the pet store
|
||||
-}
|
||||
type alias Order_ =
|
||||
{ id : Maybe Int
|
||||
, petId : Maybe Int
|
||||
, quantity : Maybe Int
|
||||
, shipDate : Maybe DateTime
|
||||
, status : Maybe Status
|
||||
, complete : Maybe Bool
|
||||
{ id : Maybe (Int)
|
||||
, petId : Maybe (Int)
|
||||
, quantity : Maybe (Int)
|
||||
, shipDate : Maybe (DateTime)
|
||||
, status : Maybe (Status)
|
||||
, complete : Maybe (Bool)
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ type Status
|
||||
| Delivered
|
||||
|
||||
|
||||
|
||||
decoder : Decoder Order_
|
||||
decoder =
|
||||
decode Order_
|
||||
@ -48,6 +49,7 @@ decoder =
|
||||
|> optional "complete" (Decode.nullable Decode.bool) (Just False)
|
||||
|
||||
|
||||
|
||||
encoder : Order_ -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
@ -57,9 +59,11 @@ encoder model =
|
||||
, ( "shipDate", Maybe.withDefault Encode.null (Maybe.map DateTime.encoder model.shipDate) )
|
||||
, ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) )
|
||||
, ( "complete", Maybe.withDefault Encode.null (Maybe.map Encode.bool model.complete) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -80,6 +84,7 @@ statusDecoder =
|
||||
)
|
||||
|
||||
|
||||
|
||||
statusEncoder : Status -> Encode.Value
|
||||
statusEncoder model =
|
||||
case model of
|
||||
@ -91,3 +96,6 @@ statusEncoder model =
|
||||
|
||||
Delivered ->
|
||||
Encode.string "delivered"
|
||||
|
||||
|
||||
|
||||
|
@ -23,12 +23,12 @@ import Json.Encode as Encode
|
||||
{-| A pet for sale in the pet store
|
||||
-}
|
||||
type alias Pet =
|
||||
{ id : Maybe Int
|
||||
, category : Maybe Category
|
||||
{ id : Maybe (Int)
|
||||
, category : Maybe (Category)
|
||||
, name : String
|
||||
, photoUrls : List String
|
||||
, tags : Maybe (List Tag)
|
||||
, status : Maybe Status
|
||||
, photoUrls : (List String)
|
||||
, tags : Maybe ((List Tag))
|
||||
, status : Maybe (Status)
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ type Status
|
||||
| Sold
|
||||
|
||||
|
||||
|
||||
decoder : Decoder Pet
|
||||
decoder =
|
||||
decode Pet
|
||||
@ -49,6 +50,7 @@ decoder =
|
||||
|> optional "status" (Decode.nullable statusDecoder) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Pet -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
@ -58,9 +60,11 @@ encoder model =
|
||||
, ( "photoUrls", (Encode.list << List.map Encode.string) model.photoUrls )
|
||||
, ( "tags", Maybe.withDefault Encode.null (Maybe.map (Encode.list << List.map Tag.encoder) model.tags) )
|
||||
, ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -81,6 +85,7 @@ statusDecoder =
|
||||
)
|
||||
|
||||
|
||||
|
||||
statusEncoder : Status -> Encode.Value
|
||||
statusEncoder model =
|
||||
case model of
|
||||
@ -92,3 +97,6 @@ statusEncoder model =
|
||||
|
||||
Sold ->
|
||||
Encode.string "sold"
|
||||
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@ import Json.Encode as Encode
|
||||
{-| A tag for a pet
|
||||
-}
|
||||
type alias Tag =
|
||||
{ id : Maybe Int
|
||||
, name : Maybe String
|
||||
{ id : Maybe (Int)
|
||||
, name : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -33,9 +33,13 @@ decoder =
|
||||
|> optional "name" (Decode.nullable Decode.string) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Tag -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
[ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) )
|
||||
, ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -21,14 +21,14 @@ import Json.Encode as Encode
|
||||
{-| A User who is purchasing from the pet store
|
||||
-}
|
||||
type alias User =
|
||||
{ id : Maybe Int
|
||||
, username : Maybe String
|
||||
, firstName : Maybe String
|
||||
, lastName : Maybe String
|
||||
, email : Maybe String
|
||||
, password : Maybe String
|
||||
, phone : Maybe String
|
||||
, userStatus : Maybe Int
|
||||
{ id : Maybe (Int)
|
||||
, username : Maybe (String)
|
||||
, firstName : Maybe (String)
|
||||
, lastName : Maybe (String)
|
||||
, email : Maybe (String)
|
||||
, password : Maybe (String)
|
||||
, phone : Maybe (String)
|
||||
, userStatus : Maybe (Int)
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ decoder =
|
||||
|> optional "userStatus" (Decode.nullable Decode.int) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : User -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
@ -56,4 +57,7 @@ encoder model =
|
||||
, ( "password", Maybe.withDefault Encode.null (Maybe.map Encode.string model.password) )
|
||||
, ( "phone", Maybe.withDefault Encode.null (Maybe.map Encode.string model.phone) )
|
||||
, ( "userStatus", Maybe.withDefault Encode.null (Maybe.map Encode.int model.userStatus) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -34,4 +34,4 @@ decodeIsoString str =
|
||||
|
||||
toString : DateTime -> String
|
||||
toString =
|
||||
toIsoString
|
||||
toIsoString
|
@ -12,8 +12,8 @@
|
||||
|
||||
module Request.Pet exposing (addPet, deletePet, findPetsByStatus, findPetsByTags, getPetById, updatePet, updatePetWithForm, uploadFile)
|
||||
|
||||
import Data.ApiResponse as ApiResponse exposing (ApiResponse)
|
||||
import Data.Pet as Pet exposing (Pet)
|
||||
import Data.ApiResponse as ApiResponse exposing (ApiResponse)
|
||||
import Dict
|
||||
import Http
|
||||
import Json.Decode as Decode
|
||||
@ -40,7 +40,7 @@ addPet model =
|
||||
deletePet : Int -> Http.Request ()
|
||||
deletePet petId =
|
||||
{ method = "DELETE"
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
@ -85,7 +85,7 @@ findPetsByTags =
|
||||
getPetById : Int -> Http.Request Pet
|
||||
getPetById petId =
|
||||
{ method = "GET"
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson Pet.decoder
|
||||
@ -111,7 +111,7 @@ updatePet model =
|
||||
updatePetWithForm : Int -> Http.Request ()
|
||||
updatePetWithForm petId =
|
||||
{ method = "POST"
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, url = basePath ++ "/pet/" ++ toString petId
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
@ -124,7 +124,7 @@ updatePetWithForm petId =
|
||||
uploadFile : Int -> Http.Request ApiResponse
|
||||
uploadFile petId =
|
||||
{ method = "POST"
|
||||
, url = basePath ++ "/pet/" ++ toString petId ++ "/uploadImage"
|
||||
, url = basePath ++ "/pet/" ++ toString petId ++ "/uploadImage"
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson ApiResponse.decoder
|
||||
|
@ -28,7 +28,7 @@ basePath =
|
||||
deleteOrder : String -> Http.Request ()
|
||||
deleteOrder orderId =
|
||||
{ method = "DELETE"
|
||||
, url = basePath ++ "/store/order/" ++ orderId
|
||||
, url = basePath ++ "/store/order/" ++ orderId
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
@ -58,7 +58,7 @@ getInventory =
|
||||
getOrderById : Int -> Http.Request Order_
|
||||
getOrderById orderId =
|
||||
{ method = "GET"
|
||||
, url = basePath ++ "/store/order/" ++ toString orderId
|
||||
, url = basePath ++ "/store/order/" ++ toString orderId
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson Order_.decoder
|
||||
|
@ -69,7 +69,7 @@ createUsersWithListInput model =
|
||||
deleteUser : String -> Http.Request ()
|
||||
deleteUser username =
|
||||
{ method = "DELETE"
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
@ -82,7 +82,7 @@ deleteUser username =
|
||||
getUserByName : String -> Http.Request User
|
||||
getUserByName username =
|
||||
{ method = "GET"
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, headers = []
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson User.decoder
|
||||
@ -123,7 +123,7 @@ logoutUser =
|
||||
updateUser : String -> User -> Http.Request ()
|
||||
updateUser username model =
|
||||
{ method = "PUT"
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, url = basePath ++ "/user/" ++ username
|
||||
, headers = []
|
||||
, body = Http.jsonBody <| User.encoder model
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
|
@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
4.0.0-SNAPSHOT
|
||||
=======
|
||||
3.3.4-SNAPSHOT
|
||||
>>>>>>> origin
|
||||
4.0.0-SNAPSHOT
|
@ -21,9 +21,9 @@ 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
|
||||
{ code : Maybe (Int)
|
||||
, type_ : Maybe (String)
|
||||
, message : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -35,10 +35,14 @@ decoder =
|
||||
|> 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) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@ import Json.Encode as Encode
|
||||
{-| A category for a pet
|
||||
-}
|
||||
type alias Category =
|
||||
{ id : Maybe Int
|
||||
, name : Maybe String
|
||||
{ id : Maybe (Int)
|
||||
, name : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -33,9 +33,13 @@ decoder =
|
||||
|> optional "name" (Decode.nullable Decode.string) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Category -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
[ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) )
|
||||
, ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -22,12 +22,12 @@ import Json.Encode as Encode
|
||||
{-| An order for a pets from the pet store
|
||||
-}
|
||||
type alias Order_ =
|
||||
{ id : Maybe Int
|
||||
, petId : Maybe Int
|
||||
, quantity : Maybe Int
|
||||
, shipDate : Maybe DateTime
|
||||
, status : Maybe Status
|
||||
, complete : Maybe Bool
|
||||
{ id : Maybe (Int)
|
||||
, petId : Maybe (Int)
|
||||
, quantity : Maybe (Int)
|
||||
, shipDate : Maybe (DateTime)
|
||||
, status : Maybe (Status)
|
||||
, complete : Maybe (Bool)
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ type Status
|
||||
| Delivered
|
||||
|
||||
|
||||
|
||||
decoder : Decoder Order_
|
||||
decoder =
|
||||
Decode.succeed Order_
|
||||
@ -48,6 +49,7 @@ decoder =
|
||||
|> optional "complete" (Decode.nullable Decode.bool) (Just False)
|
||||
|
||||
|
||||
|
||||
encoder : Order_ -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
@ -57,9 +59,11 @@ encoder model =
|
||||
, ( "shipDate", Maybe.withDefault Encode.null (Maybe.map DateTime.encoder model.shipDate) )
|
||||
, ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) )
|
||||
, ( "complete", Maybe.withDefault Encode.null (Maybe.map Encode.bool model.complete) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -80,6 +84,7 @@ statusDecoder =
|
||||
)
|
||||
|
||||
|
||||
|
||||
statusEncoder : Status -> Encode.Value
|
||||
statusEncoder model =
|
||||
case model of
|
||||
@ -91,3 +96,6 @@ statusEncoder model =
|
||||
|
||||
Delivered ->
|
||||
Encode.string "delivered"
|
||||
|
||||
|
||||
|
||||
|
@ -23,12 +23,12 @@ import Json.Encode as Encode
|
||||
{-| A pet for sale in the pet store
|
||||
-}
|
||||
type alias Pet =
|
||||
{ id : Maybe Int
|
||||
, category : Maybe Category
|
||||
{ id : Maybe (Int)
|
||||
, category : Maybe (Category)
|
||||
, name : String
|
||||
, photoUrls : List String
|
||||
, tags : Maybe (List Tag)
|
||||
, status : Maybe Status
|
||||
, photoUrls : (List String)
|
||||
, tags : Maybe ((List Tag))
|
||||
, status : Maybe (Status)
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ type Status
|
||||
| Sold
|
||||
|
||||
|
||||
|
||||
decoder : Decoder Pet
|
||||
decoder =
|
||||
Decode.succeed Pet
|
||||
@ -49,18 +50,21 @@ decoder =
|
||||
|> optional "status" (Decode.nullable statusDecoder) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Pet -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
[ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) )
|
||||
, ( "category", Maybe.withDefault Encode.null (Maybe.map Category.encoder model.category) )
|
||||
, ( "name", Encode.string model.name )
|
||||
, ( "photoUrls", Encode.list Encode.string model.photoUrls )
|
||||
, ( "photoUrls", (Encode.list Encode.string) model.photoUrls )
|
||||
, ( "tags", Maybe.withDefault Encode.null (Maybe.map (Encode.list Tag.encoder) model.tags) )
|
||||
, ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -81,6 +85,7 @@ statusDecoder =
|
||||
)
|
||||
|
||||
|
||||
|
||||
statusEncoder : Status -> Encode.Value
|
||||
statusEncoder model =
|
||||
case model of
|
||||
@ -92,3 +97,6 @@ statusEncoder model =
|
||||
|
||||
Sold ->
|
||||
Encode.string "sold"
|
||||
|
||||
|
||||
|
||||
|
@ -21,8 +21,8 @@ import Json.Encode as Encode
|
||||
{-| A tag for a pet
|
||||
-}
|
||||
type alias Tag =
|
||||
{ id : Maybe Int
|
||||
, name : Maybe String
|
||||
{ id : Maybe (Int)
|
||||
, name : Maybe (String)
|
||||
}
|
||||
|
||||
|
||||
@ -33,9 +33,13 @@ decoder =
|
||||
|> optional "name" (Decode.nullable Decode.string) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : Tag -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
[ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) )
|
||||
, ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -21,14 +21,14 @@ import Json.Encode as Encode
|
||||
{-| A User who is purchasing from the pet store
|
||||
-}
|
||||
type alias User =
|
||||
{ id : Maybe Int
|
||||
, username : Maybe String
|
||||
, firstName : Maybe String
|
||||
, lastName : Maybe String
|
||||
, email : Maybe String
|
||||
, password : Maybe String
|
||||
, phone : Maybe String
|
||||
, userStatus : Maybe Int
|
||||
{ id : Maybe (Int)
|
||||
, username : Maybe (String)
|
||||
, firstName : Maybe (String)
|
||||
, lastName : Maybe (String)
|
||||
, email : Maybe (String)
|
||||
, password : Maybe (String)
|
||||
, phone : Maybe (String)
|
||||
, userStatus : Maybe (Int)
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ decoder =
|
||||
|> optional "userStatus" (Decode.nullable Decode.int) Nothing
|
||||
|
||||
|
||||
|
||||
encoder : User -> Encode.Value
|
||||
encoder model =
|
||||
Encode.object
|
||||
@ -56,4 +57,7 @@ encoder model =
|
||||
, ( "password", Maybe.withDefault Encode.null (Maybe.map Encode.string model.password) )
|
||||
, ( "phone", Maybe.withDefault Encode.null (Maybe.map Encode.string model.phone) )
|
||||
, ( "userStatus", Maybe.withDefault Encode.null (Maybe.map Encode.int model.userStatus) )
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -34,4 +34,4 @@ decodeIsoString str =
|
||||
|
||||
toString : DateTime -> String
|
||||
toString =
|
||||
Iso8601.fromTime
|
||||
Iso8601.fromTime
|
@ -12,8 +12,8 @@
|
||||
|
||||
module Request.Pet exposing (addPet, deletePet, findPetsByStatus, findPetsByTags, getPetById, updatePet, updatePetWithForm, uploadFile)
|
||||
|
||||
import Data.ApiResponse as ApiResponse exposing (ApiResponse)
|
||||
import Data.Pet as Pet exposing (Pet)
|
||||
import Data.ApiResponse as ApiResponse exposing (ApiResponse)
|
||||
import Dict
|
||||
import Http
|
||||
import Json.Decode as Decode
|
||||
@ -28,16 +28,17 @@ basePath =
|
||||
addPet :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : Pet
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
addPet params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Pet.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -47,17 +48,18 @@ addPet params =
|
||||
|
||||
deletePet :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
|
||||
, petId : Int
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
deletePet params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", String.fromInt params.petId ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -69,6 +71,8 @@ deletePet params =
|
||||
-}
|
||||
findPetsByStatus :
|
||||
{ onSend : Result Http.Error (List Pet) -> msg
|
||||
|
||||
|
||||
, status : List String
|
||||
}
|
||||
-> Cmd msg
|
||||
@ -76,10 +80,9 @@ findPetsByStatus params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", "findByStatus" ]
|
||||
(List.filterMap identity [ Just (Url.string "status" <| String.join "," params.status) ])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", "findByStatus"]
|
||||
(List.filterMap identity [Just (Url.string "status" <| String.join "," params.status)])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend (Decode.list Pet.decoder)
|
||||
, timeout = Just 30000
|
||||
@ -91,6 +94,8 @@ findPetsByStatus params =
|
||||
-}
|
||||
findPetsByTags :
|
||||
{ onSend : Result Http.Error (List Pet) -> msg
|
||||
|
||||
|
||||
, tags : List String
|
||||
}
|
||||
-> Cmd msg
|
||||
@ -98,10 +103,9 @@ findPetsByTags params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", "findByTags" ]
|
||||
(List.filterMap identity [ Just (Url.string "tags" <| String.join "," params.tags) ])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", "findByTags"]
|
||||
(List.filterMap identity [Just (Url.string "tags" <| String.join "," params.tags)])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend (Decode.list Pet.decoder)
|
||||
, timeout = Just 30000
|
||||
@ -113,17 +117,18 @@ findPetsByTags params =
|
||||
-}
|
||||
getPetById :
|
||||
{ onSend : Result Http.Error Pet -> msg
|
||||
|
||||
, petId : Int
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
getPetById params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", String.fromInt params.petId ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Pet.decoder
|
||||
, timeout = Just 30000
|
||||
@ -134,16 +139,17 @@ getPetById params =
|
||||
updatePet :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : Pet
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
updatePet params =
|
||||
Http.request
|
||||
{ method = "PUT"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Pet.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -153,17 +159,18 @@ updatePet params =
|
||||
|
||||
updatePetWithForm :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
|
||||
, petId : Int
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
updatePetWithForm params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", String.fromInt params.petId ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -173,17 +180,18 @@ updatePetWithForm params =
|
||||
|
||||
uploadFile :
|
||||
{ onSend : Result Http.Error ApiResponse -> msg
|
||||
|
||||
, petId : Int
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
uploadFile params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "pet", String.fromInt params.petId, "uploadImage" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId, "uploadImage"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend ApiResponse.decoder
|
||||
, timeout = Just 30000
|
||||
|
@ -28,17 +28,18 @@ basePath =
|
||||
-}
|
||||
deleteOrder :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
|
||||
, orderId : String
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
deleteOrder params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "store", "order", params.orderId ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order", params.orderId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -50,16 +51,18 @@ deleteOrder params =
|
||||
-}
|
||||
getInventory :
|
||||
{ onSend : Result Http.Error (Dict.Dict String Int) -> msg
|
||||
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
getInventory params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "store", "inventory" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "inventory"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend (Decode.dict Decode.int)
|
||||
, timeout = Just 30000
|
||||
@ -71,17 +74,18 @@ getInventory params =
|
||||
-}
|
||||
getOrderById :
|
||||
{ onSend : Result Http.Error Order_ -> msg
|
||||
|
||||
, orderId : Int
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
getOrderById params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "store", "order", String.fromInt params.orderId ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order", String.fromInt params.orderId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Order_.decoder
|
||||
, timeout = Just 30000
|
||||
@ -92,16 +96,17 @@ getOrderById params =
|
||||
placeOrder :
|
||||
{ onSend : Result Http.Error Order_ -> msg
|
||||
, body : Order_
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
placeOrder params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "store", "order" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Order_.encoder params.body
|
||||
, expect = Http.expectJson params.onSend Order_.decoder
|
||||
, timeout = Just 30000
|
||||
|
@ -29,16 +29,17 @@ basePath =
|
||||
createUser :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : User
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
createUser params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -49,16 +50,17 @@ createUser params =
|
||||
createUsersWithArrayInput :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : User
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
createUsersWithArrayInput params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", "createWithArray" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "createWithArray"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -69,16 +71,17 @@ createUsersWithArrayInput params =
|
||||
createUsersWithListInput :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : User
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
createUsersWithListInput params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", "createWithList" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "createWithList"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -90,17 +93,18 @@ createUsersWithListInput params =
|
||||
-}
|
||||
deleteUser :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
|
||||
, username : String
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
deleteUser params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", params.username ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -110,17 +114,18 @@ deleteUser params =
|
||||
|
||||
getUserByName :
|
||||
{ onSend : Result Http.Error User -> msg
|
||||
|
||||
, username : String
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
getUserByName params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", params.username ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend User.decoder
|
||||
, timeout = Just 30000
|
||||
@ -130,18 +135,18 @@ getUserByName params =
|
||||
|
||||
loginUser :
|
||||
{ onSend : Result Http.Error String -> msg
|
||||
, username : String
|
||||
, password : String
|
||||
|
||||
|
||||
, username : String , password : String
|
||||
}
|
||||
-> Cmd msg
|
||||
loginUser params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", "login" ]
|
||||
(List.filterMap identity [ Just (Url.string "username" <| params.username), Just (Url.string "password" <| params.password) ])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "login"]
|
||||
(List.filterMap identity [Just (Url.string "username" <| params.username), Just (Url.string "password" <| params.password)])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Decode.string
|
||||
, timeout = Just 30000
|
||||
@ -151,16 +156,18 @@ loginUser params =
|
||||
|
||||
logoutUser :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
|
||||
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
logoutUser params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", "logout" ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "logout"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -174,16 +181,16 @@ updateUser :
|
||||
{ onSend : Result Http.Error () -> msg
|
||||
, body : User
|
||||
, username : String
|
||||
|
||||
}
|
||||
-> Cmd msg
|
||||
updateUser params =
|
||||
Http.request
|
||||
{ method = "PUT"
|
||||
, headers = []
|
||||
, url =
|
||||
Url.crossOrigin basePath
|
||||
[ "user", params.username ]
|
||||
(List.filterMap identity [])
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encoder params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
|
Loading…
Reference in New Issue
Block a user