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