forked from loafle/openapi-generator-original
[elm] Add toString for all types (#3983)
This commit is contained in:
parent
e9a0a51b50
commit
8cc708011b
@ -434,7 +434,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
Map<String, Object> objs = (Map<String, Object>) operations.get("operations");
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) objs.get("operation");
|
||||
|
||||
final Map<String, Set<String>> dependencies = new HashMap<>();
|
||||
final Set<String> dependencies = new HashSet<>();
|
||||
|
||||
for (CodegenOperation op : ops) {
|
||||
if (ElmVersion.ELM_018.equals(elmVersion)) {
|
||||
@ -445,57 +445,38 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
op.path = ("\"" + path + "\"").replaceAll(" \\+\\+ \"\"", "");
|
||||
} else {
|
||||
final List<String> paths = Arrays.asList(op.path.substring(1).split("/"));
|
||||
String path = paths.stream()
|
||||
.map(str -> str.startsWith("{") && str.endsWith("}") ? str : "\"" + str + "\"")
|
||||
.collect(Collectors.joining(", "));
|
||||
for (CodegenParameter param : op.pathParams) {
|
||||
String str = paramToString("params", param, false, null);
|
||||
path = path.replace("{" + param.paramName + "}", str);
|
||||
}
|
||||
op.path = path;
|
||||
|
||||
final String query = op.queryParams.stream()
|
||||
.map(param -> paramToString("params", param, true, "Url.string \"" + param.baseName + "\""))
|
||||
.collect(Collectors.joining(", "));
|
||||
op.vendorExtensions.put("query", query);
|
||||
|
||||
final String headers = op.headerParams.stream()
|
||||
.map(param -> paramToString("headers", param, true, "Http.header \"" + param.baseName + "\""))
|
||||
.collect(Collectors.joining(", "));
|
||||
op.vendorExtensions.put("headers", headers);
|
||||
// TODO cookies
|
||||
// TODO forms
|
||||
final List<Object> pathParams = Arrays.asList(op.path.substring(1).split("/")).stream()
|
||||
.map(str -> {
|
||||
if (str.startsWith("{") && str.endsWith("}")) {
|
||||
return op.pathParams.stream().filter(p -> str.equals("{" + p.paramName + "}")).findFirst().orElse(null);
|
||||
} else {
|
||||
return "\"" + str + "\"";
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
op.vendorExtensions.put("pathParams", pathParams);
|
||||
}
|
||||
|
||||
if (op.bodyParam != null && !op.bodyParam.isPrimitiveType && !op.bodyParam.isMapContainer) {
|
||||
final String encoder = (String) op.bodyParam.vendorExtensions.get(ENCODER);
|
||||
if (encoder != null) {
|
||||
if (!dependencies.containsKey(op.bodyParam.dataType)) {
|
||||
dependencies.put(op.bodyParam.dataType, new TreeSet<String>());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (CodegenResponse resp : op.responses) {
|
||||
if (resp.primitiveType || resp.isMapContainer) {
|
||||
for (CodegenParameter param : op.allParams) {
|
||||
if (param.isPrimitiveType || param.isContainer || param.isDate || param.isDateTime || param.isUuid) {
|
||||
continue;
|
||||
}
|
||||
final String decoder = (String) resp.vendorExtensions.get(DECODER);
|
||||
if (decoder != null) {
|
||||
if (!dependencies.containsKey(resp.dataType)) {
|
||||
dependencies.put(resp.dataType, new TreeSet<String>());
|
||||
}
|
||||
dependencies.add(param.dataType);
|
||||
}
|
||||
for (CodegenResponse resp : op.responses) {
|
||||
if (resp.primitiveType || resp.isMapContainer || resp.isDate || resp.isDateTime || resp.isUuid) {
|
||||
continue;
|
||||
}
|
||||
dependencies.add(resp.dataType);
|
||||
}
|
||||
}
|
||||
|
||||
final List<ElmImport> elmImports = new ArrayList<>();
|
||||
for (Map.Entry<String, Set<String>> entry : dependencies.entrySet()) {
|
||||
for (String key : dependencies) {
|
||||
final ElmImport elmImport = new ElmImport();
|
||||
final String key = entry.getKey();
|
||||
elmImport.moduleName = "Data." + key;
|
||||
elmImport.as = key;
|
||||
elmImport.exposures = entry.getValue();
|
||||
elmImport.exposures = new HashSet<>();
|
||||
elmImport.exposures.add(key);
|
||||
elmImport.hasExposures = true;
|
||||
elmImports.add(elmImport);
|
||||
@ -589,12 +570,14 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return Optional.of("String.fromInt");
|
||||
} else if (property.isFloat || property.isDouble) {
|
||||
return Optional.of("String.fromFloat");
|
||||
} else {
|
||||
return Optional.of(property.dataType + ".toString");
|
||||
}
|
||||
throw new RuntimeException("Parameter '" + paramName + "' cannot be converted to a string. Please report the issue.");
|
||||
}
|
||||
|
||||
private CodegenProperty paramToProperty(final CodegenParameter parameter) {
|
||||
final CodegenProperty property = new CodegenProperty();
|
||||
property.dataType = parameter.dataType;
|
||||
property.isEnum = parameter.isEnum;
|
||||
property.isString = parameter.isString;
|
||||
property.isBinary = parameter.isBinary;
|
||||
|
@ -16,8 +16,8 @@ type {{enumName}}
|
||||
{{#allowableValues.enumVars}} {{#-first}}= {{/-first}}{{^-first}}| {{/-first}}{{name}}
|
||||
{{/allowableValues.enumVars}}
|
||||
|
||||
{{paramName}}ToString : {{enumName}} -> String
|
||||
{{paramName}}ToString value =
|
||||
stringify{{enumName}} : {{enumName}} -> String
|
||||
stringify{{enumName}} value =
|
||||
case value of
|
||||
{{#allowableValues.enumVars}} {{name}} ->
|
||||
{{{value}}}
|
||||
@ -59,10 +59,10 @@ basePath =
|
||||
{{operationId}} {{#headerParams.0}}headers {{/headerParams.0}}params =
|
||||
Http.request
|
||||
{ method = "{{httpMethod}}"
|
||||
, headers = {{#headerParams.0}}List.filterMap identity {{/headerParams.0}}[{{{vendorExtensions.headers}}}]
|
||||
, headers = List.filterMap identity [{{#headerParams}}{{#required}}(Just << {{/required}}{{^required}}Maybe.map ({{/required}}Http.header "{{baseName}}" << {{>toString}}) {{^isElm018}}headers.{{/isElm018}}{{paramName}}{{^-last}}, {{/-last}}{{/headerParams}}]
|
||||
, url = Url.crossOrigin {{#enableCustomBasePaths}}params.{{/enableCustomBasePaths}}basePath
|
||||
[{{{path}}}]
|
||||
{{#queryParams.0}}(List.filterMap identity {{/queryParams.0}}[{{{vendorExtensions.query}}}]{{#queryParams.0}}){{/queryParams.0}}
|
||||
[{{#vendorExtensions.pathParams}}{{#paramName}}{{>toString}} params.{{paramName}}{{/paramName}}{{^paramName}}{{{.}}}{{/paramName}}{{^-last}}, {{/-last}}{{/vendorExtensions.pathParams}}]
|
||||
(List.filterMap identity [{{#queryParams}}{{#required}}(Just << {{/required}}{{^required}}Maybe.map ({{/required}}Url.string "{{baseName}}" << {{>toString}}) {{^isElm018}}params.{{/isElm018}}{{paramName}}{{^-last}}, {{/-last}}{{/queryParams}}])
|
||||
, body = {{#bodyParam}}{{^required}}Maybe.withDefault Http.emptyBody <| Maybe.map ({{/required}}Http.jsonBody {{#required}}<|{{/required}}{{^required}}<<{{/required}} {{vendorExtensions.elmEncoder}}{{^required}}){{/required}} params.body{{/bodyParam}}{{^bodyParam}}Http.emptyBody{{/bodyParam}}
|
||||
, expect = {{^responses}}Http.expectWhatever params.onSend{{/responses}}{{#responses}}{{#-first}}{{^dataType}}Http.expectWhatever params.onSend{{/dataType}}{{#dataType}}Http.expectJson params.onSend {{#isMapContainer}}(Decode.dict {{/isMapContainer}}{{#isListContainer}}(Decode.list {{/isListContainer}}{{#vendorExtensions}}{{elmDecoder}}{{/vendorExtensions}}{{#isListContainer}}){{/isListContainer}}{{#isMapContainer}}){{/isMapContainer}}{{/dataType}}{{/-first}}{{/responses}}
|
||||
, timeout = Just 30000
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
module Data.{{classname}} exposing ({{#models}}{{#model}}{{classname}}{{#hasChildren}}(..){{/hasChildren}}{{#isEnum}}(..){{/isEnum}}{{^isEnum}}{{#vars}}{{#isEnum}}, {{vendorExtensions.elmCustomType}}(..){{/isEnum}}{{/vars}}{{/isEnum}}, decoder, encode{{/model}}{{/models}})
|
||||
module Data.{{classname}} exposing ({{#models}}{{#model}}{{classname}}{{#hasChildren}}(..){{/hasChildren}}{{#isEnum}}(..){{/isEnum}}{{^isEnum}}{{#vars}}{{#isEnum}}, {{vendorExtensions.elmCustomType}}(..){{/isEnum}}{{/vars}}{{/isEnum}}, decoder, encode, toString{{/model}}{{/models}})
|
||||
|
||||
{{>imports}}import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -15,5 +15,6 @@ import Json.Encode as Encode
|
||||
-}
|
||||
{{/description}}
|
||||
{{#isEnum}}{{>modelTypeCustom}}{{/isEnum}}{{^isEnum}}{{#discriminator}}{{>modelTypeDiscriminator}}{{/discriminator}}{{^discriminator}}{{#isAlias}}{{>modelTypePrimitive}}{{/isAlias}}{{^isAlias}}{{#isArrayModel}}{{>modelTypeArray}}{{/isArrayModel}}{{^isArrayModel}}{{>modelTypeRecord}}{{/isArrayModel}}{{/isAlias}}{{/discriminator}}{{/isEnum}}
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -10,3 +10,8 @@ decoder =
|
||||
encode : {{classname}} -> Encode.Value
|
||||
encode items =
|
||||
Encode.list {{#isElm018}}(List.map {{/isElm018}}{{vendorExtensions.elmEncoder}} items{{#isElm018}}){{/isElm018}}
|
||||
|
||||
|
||||
toString : {{classname}} -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
@ -4,4 +4,16 @@
|
||||
{{>customTypeDecoder}}
|
||||
|
||||
|
||||
{{>customTypeEncoder}}
|
||||
{{>customTypeEncoder}}
|
||||
|
||||
|
||||
toString : {{classname}} -> String
|
||||
toString model =
|
||||
case model of
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{name}} ->
|
||||
{{{value}}}
|
||||
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
@ -30,3 +30,8 @@ encode model =
|
||||
{{modelName}}.encode "{{mappingName}}" subModel
|
||||
|
||||
{{/mappedModels}}
|
||||
|
||||
|
||||
toString : {{classname}} -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
@ -10,3 +10,8 @@ decoder =
|
||||
encode : {{classname}} -> Encode.Value
|
||||
encode =
|
||||
{{vendorExtensions.elmEncoder}}
|
||||
|
||||
|
||||
toString : {{classname}} -> String
|
||||
toString =
|
||||
{{>toString}}
|
||||
|
@ -14,6 +14,13 @@ type alias {{classname}} =
|
||||
|
||||
|
||||
{{>recordEncoder}}
|
||||
|
||||
|
||||
toString : {{classname}} -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode{{#vendorExtensions.discriminatorName}} ""{{/vendorExtensions.discriminatorName}}
|
||||
|
||||
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
|
||||
|
1
modules/openapi-generator/src/main/resources/elm/toString.mustache
vendored
Normal file
1
modules/openapi-generator/src/main/resources/elm/toString.mustache
vendored
Normal file
@ -0,0 +1 @@
|
||||
{{#isListContainer}}String.join "," << List.map {{#items}}{{>toString}}{{/items}}{{/isListContainer}}{{^isListContainer}}{{^isEnum}}{{#isString}}identity{{/isString}}{{#isBinary}}identity{{/isBinary}}{{#isByteArray}}identity{{/isByteArray}}{{/isEnum}}{{#isBoolean}}(\val -> if val then "true" else "false"){{/isBoolean}}{{#isDateTime}}DateTime.toString{{/isDateTime}}{{#isDate}}DateOnly.toString{{/isDate}}{{#isElm018}}toString{{/isElm018}}{{^isElm018}}{{#isInteger}}String.fromInt{{/isInteger}}{{#isLong}}String.fromInt{{/isLong}}{{#isFloat}}String.fromFloat{{/isFloat}}{{#isDouble}}String.fromFloat{{/isDouble}}{{#isEnum}}stringify{{enumName}}{{/isEnum}}{{^isEnum}}{{^isString}}{{^isBinary}}{{^isByteArray}}{{^isBoolean}}{{^isDouble}}{{^isFloat}}{{^isLong}}{{^isInteger}}{{dataType}}.toString{{/isInteger}}{{/isLong}}{{/isFloat}}{{/isDouble}}{{/isBoolean}}{{/isByteArray}}{{/isBinary}}{{/isString}}{{/isEnum}}{{/isElm018}}{{/isListContainer}}
|
@ -65,7 +65,7 @@ public class ElmClientCodegenTest {
|
||||
assertTrue(result.containsKey("operations"));
|
||||
assertTrue(result.containsKey("elmImports"));
|
||||
|
||||
assertEquals(rootOp.path, "\"\"");
|
||||
assertEquals(rootOp.path, "/");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1 +1 @@
|
||||
4.0.3-SNAPSHOT
|
||||
4.1.3-SNAPSHOT
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.ApiResponse exposing (ApiResponse, decoder, encode)
|
||||
module Data.ApiResponse exposing (ApiResponse, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -46,3 +46,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : ApiResponse -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Category exposing (Category, decoder, encode)
|
||||
module Data.Category exposing (Category, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -43,3 +43,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : Category -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Order_ exposing (Order_, Status(..), decoder, encode)
|
||||
module Data.Order_ exposing (Order_, Status(..), decoder, encode, toString)
|
||||
|
||||
import DateTime exposing (DateTime)
|
||||
import Dict exposing (Dict)
|
||||
@ -64,6 +64,13 @@ encode model =
|
||||
|
||||
|
||||
|
||||
toString : Order_ -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -99,3 +106,4 @@ encodeStatus model =
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Pet exposing (Pet, Status(..), decoder, encode)
|
||||
module Data.Pet exposing (Pet, Status(..), decoder, encode, toString)
|
||||
|
||||
import Data.Category as Category exposing (Category)
|
||||
import Data.Tag as Tag exposing (Tag)
|
||||
@ -65,6 +65,13 @@ encode model =
|
||||
|
||||
|
||||
|
||||
toString : Pet -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -100,3 +107,4 @@ encodeStatus model =
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Tag exposing (Tag, decoder, encode)
|
||||
module Data.Tag exposing (Tag, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -43,3 +43,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : Tag -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.User exposing (User, decoder, encode)
|
||||
module Data.User exposing (User, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -61,3 +61,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : User -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
4.0.3-SNAPSHOT
|
||||
4.1.3-SNAPSHOT
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.ApiResponse exposing (ApiResponse, decoder, encode)
|
||||
module Data.ApiResponse exposing (ApiResponse, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -46,3 +46,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : ApiResponse -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Category exposing (Category, decoder, encode)
|
||||
module Data.Category exposing (Category, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -43,3 +43,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : Category -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Order_ exposing (Order_, Status(..), decoder, encode)
|
||||
module Data.Order_ exposing (Order_, Status(..), decoder, encode, toString)
|
||||
|
||||
import DateTime exposing (DateTime)
|
||||
import Dict exposing (Dict)
|
||||
@ -64,6 +64,13 @@ encode model =
|
||||
|
||||
|
||||
|
||||
toString : Order_ -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -99,3 +106,4 @@ encodeStatus model =
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Pet exposing (Pet, Status(..), decoder, encode)
|
||||
module Data.Pet exposing (Pet, Status(..), decoder, encode, toString)
|
||||
|
||||
import Data.Category as Category exposing (Category)
|
||||
import Data.Tag as Tag exposing (Tag)
|
||||
@ -65,6 +65,13 @@ encode model =
|
||||
|
||||
|
||||
|
||||
toString : Pet -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
statusDecoder : Decoder Status
|
||||
statusDecoder =
|
||||
Decode.string
|
||||
@ -100,3 +107,4 @@ encodeStatus model =
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.Tag exposing (Tag, decoder, encode)
|
||||
module Data.Tag exposing (Tag, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -43,3 +43,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : Tag -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
-}
|
||||
|
||||
|
||||
module Data.User exposing (User, decoder, encode)
|
||||
module Data.User exposing (User, decoder, encode, toString)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -61,3 +61,11 @@ encode model =
|
||||
]
|
||||
|
||||
|
||||
|
||||
toString : User -> String
|
||||
toString =
|
||||
Encode.encode 0 << encode
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -25,8 +25,8 @@ type Status
|
||||
| Pending
|
||||
| Sold
|
||||
|
||||
statusToString : Status -> String
|
||||
statusToString value =
|
||||
stringifyStatus : Status -> String
|
||||
stringifyStatus value =
|
||||
case value of
|
||||
Available ->
|
||||
"available"
|
||||
@ -58,10 +58,10 @@ addPet :
|
||||
addPet params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Pet.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -83,10 +83,10 @@ deletePet :
|
||||
deletePet headers params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = List.filterMap identity [Maybe.map (Http.header "api_key" ) headers.apiKey]
|
||||
, headers = List.filterMap identity [Maybe.map (Http.header "api_key" << identity) headers.apiKey]
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
[]
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -108,10 +108,10 @@ findPetsByStatus :
|
||||
findPetsByStatus params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", "findByStatus"]
|
||||
(List.filterMap identity [Just (Url.string "status" <| (String.join "," << List.map statusToString) params.status)])
|
||||
(List.filterMap identity [(Just << Url.string "status" << String.join "," << List.map stringifyStatus) params.status])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend (Decode.list Pet.decoder)
|
||||
, timeout = Just 30000
|
||||
@ -133,10 +133,10 @@ findPetsByTags :
|
||||
findPetsByTags params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", "findByTags"]
|
||||
(List.filterMap identity [Just (Url.string "tags" <| (String.join ",") params.tags)])
|
||||
(List.filterMap identity [(Just << Url.string "tags" << String.join "," << List.map identity) params.tags])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend (Decode.list Pet.decoder)
|
||||
, timeout = Just 30000
|
||||
@ -158,10 +158,10 @@ getPetById :
|
||||
getPetById params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
[]
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Pet.decoder
|
||||
, timeout = Just 30000
|
||||
@ -181,10 +181,10 @@ updatePet :
|
||||
updatePet params =
|
||||
Http.request
|
||||
{ method = "PUT"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Pet.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -204,10 +204,10 @@ updatePetWithForm :
|
||||
updatePetWithForm params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId]
|
||||
[]
|
||||
["pet", String.fromInt params.petId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -227,10 +227,10 @@ uploadFile :
|
||||
uploadFile params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["pet", String.fromInt params.petId, "uploadImage"]
|
||||
[]
|
||||
["pet", String.fromInt params.petId, "uploadImage"]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend ApiResponse.decoder
|
||||
, timeout = Just 30000
|
||||
|
@ -40,10 +40,10 @@ deleteOrder :
|
||||
deleteOrder params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order", params.orderId]
|
||||
[]
|
||||
["store", "order", identity params.orderId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -65,10 +65,10 @@ getInventory :
|
||||
getInventory params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = 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
|
||||
@ -90,10 +90,10 @@ getOrderById :
|
||||
getOrderById params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order", String.fromInt params.orderId]
|
||||
[]
|
||||
["store", "order", String.fromInt params.orderId]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Order_.decoder
|
||||
, timeout = Just 30000
|
||||
@ -113,10 +113,10 @@ placeOrder :
|
||||
placeOrder params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["store", "order"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| Order_.encode params.body
|
||||
, expect = Http.expectJson params.onSend Order_.decoder
|
||||
, timeout = Just 30000
|
||||
|
@ -40,10 +40,10 @@ createUser :
|
||||
createUser params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -63,10 +63,10 @@ createUsersWithArrayInput :
|
||||
createUsersWithArrayInput params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "createWithArray"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -86,10 +86,10 @@ createUsersWithListInput :
|
||||
createUsersWithListInput params =
|
||||
Http.request
|
||||
{ method = "POST"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "createWithList"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -111,10 +111,10 @@ deleteUser :
|
||||
deleteUser params =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
[]
|
||||
["user", identity params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -134,10 +134,10 @@ getUserByName :
|
||||
getUserByName params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
[]
|
||||
["user", identity params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend User.decoder
|
||||
, timeout = Just 30000
|
||||
@ -157,10 +157,10 @@ loginUser :
|
||||
loginUser params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "login"]
|
||||
(List.filterMap identity [Just (Url.string "username" params.username), Just (Url.string "password" params.password)])
|
||||
(List.filterMap identity [(Just << Url.string "username" << identity) params.username, (Just << Url.string "password" << identity) params.password])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectJson params.onSend Decode.string
|
||||
, timeout = Just 30000
|
||||
@ -180,10 +180,10 @@ logoutUser :
|
||||
logoutUser params =
|
||||
Http.request
|
||||
{ method = "GET"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", "logout"]
|
||||
[]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
@ -205,10 +205,10 @@ updateUser :
|
||||
updateUser params =
|
||||
Http.request
|
||||
{ method = "PUT"
|
||||
, headers = []
|
||||
, headers = List.filterMap identity []
|
||||
, url = Url.crossOrigin basePath
|
||||
["user", params.username]
|
||||
[]
|
||||
["user", identity params.username]
|
||||
(List.filterMap identity [])
|
||||
, body = Http.jsonBody <| User.encode params.body
|
||||
, expect = Http.expectWhatever params.onSend
|
||||
, timeout = Just 30000
|
||||
|
Loading…
x
Reference in New Issue
Block a user