forked from loafle/openapi-generator-original
fix enum value, update dart petstore samples (#1193)
This commit is contained in:
parent
7d58f308d9
commit
22049db8c1
@ -12,7 +12,7 @@ class {{classname}} {
|
||||
{{#description}}
|
||||
/// {{description}}
|
||||
{{/description}}
|
||||
static const {{classname}} {{name}} = const {{classname}}._internal({{value}});
|
||||
static const {{classname}} {{{name}}}} = const {{classname}}._internal({{{value}}});
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
@ -29,7 +29,7 @@ class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> {
|
||||
switch (data) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{value}}: return {{classname}}.{{name}};
|
||||
case {{{value}}}: return {{classname}}.{{{name}}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default: throw('Unknown enum value to decode: $data');
|
||||
|
@ -10,7 +10,7 @@ class {{classname}} {
|
||||
{{#description}}
|
||||
/// {{description}}
|
||||
{{/description}}
|
||||
static const {{classname}} {{name}} = const {{classname}}._internal({{value}});
|
||||
static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}});
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
@ -27,7 +27,7 @@ class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> {
|
||||
switch (data) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{value}}: return {{classname}}.{{name}};
|
||||
case {{{value}}}: return {{classname}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default: throw('Unknown enum value to decode: $data');
|
||||
|
@ -10,7 +10,7 @@ class {{classname}} {
|
||||
{{#description}}
|
||||
/// {{description}}
|
||||
{{/description}}
|
||||
static const {{classname}} {{name}} = const {{classname}}._internal({{value}});
|
||||
static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}});
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
@ -27,7 +27,7 @@ class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> {
|
||||
switch (data) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{value}}: return {{classname}}.{{name}};
|
||||
case {{{value}}}: return {{classname}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default: throw('Unknown enum value to decode: $data');
|
||||
|
@ -36,7 +36,7 @@ object {{classname}} {
|
||||
{{/operation}}
|
||||
|
||||
{{#unknownStatusCodes}}
|
||||
ApiInvoker.addCustomStatusCode({{value}}, isSuccess = false)
|
||||
ApiInvoker.addCustomStatusCode({{{value}}}, isSuccess = false)
|
||||
{{/unknownStatusCodes}}
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -4,7 +4,7 @@ This is a sample server Petstore server. For this sample, you can use the api ke
|
||||
This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2018-09-21T14:54:05.021285+02:00[Europe/Paris]
|
||||
- Build date: 2018-10-08T15:27:22.304+08:00[Asia/Hong_Kong]
|
||||
- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -18,100 +18,100 @@ import 'package:openapi/model/pet.dart';
|
||||
import 'package:openapi/model/tag.dart';
|
||||
import 'package:openapi/model/user.dart';
|
||||
|
||||
|
||||
final jsonJaguarRepo = JsonRepo()
|
||||
..add(ApiResponseSerializer())
|
||||
..add(CategorySerializer())
|
||||
..add(OrderSerializer())
|
||||
..add(PetSerializer())
|
||||
..add(TagSerializer())
|
||||
..add(UserSerializer())
|
||||
;
|
||||
..add(ApiResponseSerializer())
|
||||
..add(CategorySerializer())
|
||||
..add(OrderSerializer())
|
||||
..add(PetSerializer())
|
||||
..add(TagSerializer())
|
||||
..add(UserSerializer());
|
||||
|
||||
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
|
||||
final _defaultInterceptors = [
|
||||
OAuthInterceptor(),
|
||||
BasicAuthInterceptor(),
|
||||
ApiKeyAuthInterceptor()
|
||||
];
|
||||
|
||||
class JaguarApiGen {
|
||||
List<Interceptor> interceptors;
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
Route _baseRoute;
|
||||
List<Interceptor> interceptors;
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
Route _baseRoute;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
|
||||
*/
|
||||
JaguarApiGen({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl}) {
|
||||
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
|
||||
if(interceptors == null) {
|
||||
this.interceptors = _defaultInterceptors;
|
||||
}
|
||||
else if(overrideInterceptors){
|
||||
this.interceptors = interceptors;
|
||||
}
|
||||
else {
|
||||
this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
|
||||
}
|
||||
|
||||
this.interceptors.forEach((interceptor) {
|
||||
_baseRoute.before(interceptor.before);
|
||||
_baseRoute.after(interceptor.after);
|
||||
});
|
||||
JaguarApiGen(
|
||||
{List<Interceptor> interceptors,
|
||||
bool overrideInterceptors = false,
|
||||
String baseUrl}) {
|
||||
_baseRoute =
|
||||
Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
|
||||
if (interceptors == null) {
|
||||
this.interceptors = _defaultInterceptors;
|
||||
} else if (overrideInterceptors) {
|
||||
this.interceptors = interceptors;
|
||||
} else {
|
||||
this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
|
||||
}
|
||||
|
||||
void setOAuthToken(String name, String token) {
|
||||
(_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
this.interceptors.forEach((interceptor) {
|
||||
_baseRoute.before(interceptor.before);
|
||||
_baseRoute.after(interceptor.after);
|
||||
});
|
||||
}
|
||||
|
||||
void setBasicAuth(String name, String username, String password) {
|
||||
(_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
|
||||
}
|
||||
void setOAuthToken(String name, String token) {
|
||||
(_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
|
||||
void setApiKey(String name, String apiKey) {
|
||||
(_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||
}
|
||||
void setBasicAuth(String name, String username, String password) {
|
||||
(_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] =
|
||||
BasicAuthInfo(username, password);
|
||||
}
|
||||
|
||||
void setApiKey(String name, String apiKey) {
|
||||
(_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get PetApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
PetApi getPetApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return PetApi(base: base, serializers: serializers);
|
||||
PetApi getPetApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return PetApi(base: base, serializers: serializers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get StoreApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
StoreApi getStoreApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return StoreApi(base: base, serializers: serializers);
|
||||
StoreApi getStoreApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return StoreApi(base: base, serializers: serializers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get UserApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
UserApi getUserApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return UserApi(base: base, serializers: serializers);
|
||||
UserApi getUserApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
|
||||
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return UserApi(base: base, serializers: serializers);
|
||||
}
|
||||
}
|
||||
|
@ -3,21 +3,21 @@ import 'dart:async';
|
||||
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
|
||||
|
||||
abstract class AuthInterceptor extends Interceptor {
|
||||
/*
|
||||
/*
|
||||
* Get auth information on given route for the given type
|
||||
* Can return null if type is not present on auth data or if route doesn't need authentication
|
||||
*/
|
||||
List<Map<String, dynamic>> getAuthInfo(RouteBase route, String type) {
|
||||
if (route.metadataMap.containsKey("auth")) {
|
||||
final auth = route.metadataMap["auth"];
|
||||
List<Map<String, dynamic>> results = [];
|
||||
for (var info in auth) {
|
||||
if(info["type"] == type) {
|
||||
results.add(info);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
List<Map<String, dynamic>> getAuthInfo(RouteBase route, String type) {
|
||||
if (route.metadataMap.containsKey("auth")) {
|
||||
final auth = route.metadataMap["auth"];
|
||||
List<Map<String, dynamic>> results = [];
|
||||
for (var info in auth) {
|
||||
if (info["type"] == type) {
|
||||
results.add(info);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
return results;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'api_response.jser.dart';
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
@Alias('code')
|
||||
final int code;
|
||||
|
||||
@ -13,17 +12,7 @@ class ApiResponse {
|
||||
@Alias('message')
|
||||
final String message;
|
||||
|
||||
|
||||
ApiResponse(
|
||||
|
||||
|
||||
{
|
||||
this.code = null,
|
||||
this.type = null,
|
||||
this.message = null
|
||||
|
||||
}
|
||||
);
|
||||
ApiResponse({this.code = null, this.type = null, this.message = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -32,6 +21,5 @@ class ApiResponse {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class ApiResponseSerializer extends Serializer<ApiResponse> with _$ApiResponseSerializer {
|
||||
|
||||
}
|
||||
class ApiResponseSerializer extends Serializer<ApiResponse>
|
||||
with _$ApiResponseSerializer {}
|
||||
|
@ -3,23 +3,13 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'category.jser.dart';
|
||||
|
||||
class Category {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@Alias('name')
|
||||
final String name;
|
||||
|
||||
|
||||
Category(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.name = null
|
||||
|
||||
}
|
||||
);
|
||||
Category({this.id = null, this.name = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -28,6 +18,5 @@ class Category {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class CategorySerializer extends Serializer<Category> with _$CategorySerializer {
|
||||
|
||||
}
|
||||
class CategorySerializer extends Serializer<Category>
|
||||
with _$CategorySerializer {}
|
||||
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'order.jser.dart';
|
||||
|
||||
class Order {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -15,27 +14,20 @@ class Order {
|
||||
|
||||
@Alias('shipDate')
|
||||
final DateTime shipDate;
|
||||
/* Order Status */
|
||||
/* Order Status */
|
||||
@Alias('status')
|
||||
final String status;
|
||||
//enum statusEnum { placed, approved, delivered, };
|
||||
@Alias('complete')
|
||||
final bool complete;
|
||||
|
||||
|
||||
Order(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.petId = null,
|
||||
this.quantity = null,
|
||||
this.shipDate = null,
|
||||
this.status = null,
|
||||
this.complete = false
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.petId = null,
|
||||
this.quantity = null,
|
||||
this.shipDate = null,
|
||||
this.status = null,
|
||||
this.complete = false});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -44,6 +36,4 @@ class Order {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class OrderSerializer extends Serializer<Order> with _$OrderSerializer {
|
||||
|
||||
}
|
||||
class OrderSerializer extends Serializer<Order> with _$OrderSerializer {}
|
||||
|
@ -5,7 +5,6 @@ import 'package:openapi/model/category.dart';
|
||||
part 'pet.jser.dart';
|
||||
|
||||
class Pet {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -20,24 +19,18 @@ class Pet {
|
||||
|
||||
@Alias('tags')
|
||||
final List<Tag> tags;
|
||||
/* pet status in the store */
|
||||
/* pet status in the store */
|
||||
@Alias('status')
|
||||
final String status;
|
||||
//enum statusEnum { available, pending, sold, };
|
||||
|
||||
Pet(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.category = null,
|
||||
|
||||
this.name = null,
|
||||
this.photoUrls = const [], this.tags = const [],
|
||||
this.status = null
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.category = null,
|
||||
this.name = null,
|
||||
this.photoUrls = const [],
|
||||
this.tags = const [],
|
||||
this.status = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -46,6 +39,4 @@ class Pet {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class PetSerializer extends Serializer<Pet> with _$PetSerializer {
|
||||
|
||||
}
|
||||
class PetSerializer extends Serializer<Pet> with _$PetSerializer {}
|
||||
|
@ -3,23 +3,13 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'tag.jser.dart';
|
||||
|
||||
class Tag {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@Alias('name')
|
||||
final String name;
|
||||
|
||||
|
||||
Tag(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.name = null
|
||||
|
||||
}
|
||||
);
|
||||
Tag({this.id = null, this.name = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -28,6 +18,4 @@ class Tag {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class TagSerializer extends Serializer<Tag> with _$TagSerializer {
|
||||
|
||||
}
|
||||
class TagSerializer extends Serializer<Tag> with _$TagSerializer {}
|
||||
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'user.jser.dart';
|
||||
|
||||
class User {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -24,26 +23,19 @@ class User {
|
||||
|
||||
@Alias('phone')
|
||||
final String phone;
|
||||
/* User Status */
|
||||
/* User Status */
|
||||
@Alias('userStatus')
|
||||
final int userStatus;
|
||||
|
||||
|
||||
User(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.username = null,
|
||||
this.firstName = null,
|
||||
this.lastName = null,
|
||||
this.email = null,
|
||||
this.password = null,
|
||||
this.phone = null,
|
||||
this.userStatus = null
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.username = null,
|
||||
this.firstName = null,
|
||||
this.lastName = null,
|
||||
this.email = null,
|
||||
this.password = null,
|
||||
this.phone = null,
|
||||
this.userStatus = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -52,6 +44,4 @@ class User {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class UserSerializer extends Serializer<User> with _$UserSerializer {
|
||||
|
||||
}
|
||||
class UserSerializer extends Serializer<User> with _$UserSerializer {}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -4,7 +4,7 @@ This is a sample server Petstore server. For this sample, you can use the api ke
|
||||
This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2018-09-21T14:54:03.562304+02:00[Europe/Paris]
|
||||
- Build date: 2018-10-08T15:27:15.700+08:00[Asia/Hong_Kong]
|
||||
- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -18,100 +18,100 @@ import 'package:openapi/model/pet.dart';
|
||||
import 'package:openapi/model/tag.dart';
|
||||
import 'package:openapi/model/user.dart';
|
||||
|
||||
|
||||
final jsonJaguarRepo = JsonRepo()
|
||||
..add(ApiResponseSerializer())
|
||||
..add(CategorySerializer())
|
||||
..add(OrderSerializer())
|
||||
..add(PetSerializer())
|
||||
..add(TagSerializer())
|
||||
..add(UserSerializer())
|
||||
;
|
||||
..add(ApiResponseSerializer())
|
||||
..add(CategorySerializer())
|
||||
..add(OrderSerializer())
|
||||
..add(PetSerializer())
|
||||
..add(TagSerializer())
|
||||
..add(UserSerializer());
|
||||
|
||||
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
|
||||
final _defaultInterceptors = [
|
||||
OAuthInterceptor(),
|
||||
BasicAuthInterceptor(),
|
||||
ApiKeyAuthInterceptor()
|
||||
];
|
||||
|
||||
class JaguarApiGen {
|
||||
List<Interceptor> interceptors;
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
Route _baseRoute;
|
||||
List<Interceptor> interceptors;
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
Route _baseRoute;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
|
||||
*/
|
||||
JaguarApiGen({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl}) {
|
||||
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
|
||||
if(interceptors == null) {
|
||||
this.interceptors = _defaultInterceptors;
|
||||
}
|
||||
else if(overrideInterceptors){
|
||||
this.interceptors = interceptors;
|
||||
}
|
||||
else {
|
||||
this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
|
||||
}
|
||||
|
||||
this.interceptors.forEach((interceptor) {
|
||||
_baseRoute.before(interceptor.before);
|
||||
_baseRoute.after(interceptor.after);
|
||||
});
|
||||
JaguarApiGen(
|
||||
{List<Interceptor> interceptors,
|
||||
bool overrideInterceptors = false,
|
||||
String baseUrl}) {
|
||||
_baseRoute =
|
||||
Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
|
||||
if (interceptors == null) {
|
||||
this.interceptors = _defaultInterceptors;
|
||||
} else if (overrideInterceptors) {
|
||||
this.interceptors = interceptors;
|
||||
} else {
|
||||
this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
|
||||
}
|
||||
|
||||
void setOAuthToken(String name, String token) {
|
||||
(_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
this.interceptors.forEach((interceptor) {
|
||||
_baseRoute.before(interceptor.before);
|
||||
_baseRoute.after(interceptor.after);
|
||||
});
|
||||
}
|
||||
|
||||
void setBasicAuth(String name, String username, String password) {
|
||||
(_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
|
||||
}
|
||||
void setOAuthToken(String name, String token) {
|
||||
(_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
|
||||
void setApiKey(String name, String apiKey) {
|
||||
(_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||
}
|
||||
void setBasicAuth(String name, String username, String password) {
|
||||
(_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] =
|
||||
BasicAuthInfo(username, password);
|
||||
}
|
||||
|
||||
void setApiKey(String name, String apiKey) {
|
||||
(_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get PetApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
PetApi getPetApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return PetApi(base: base, serializers: serializers);
|
||||
PetApi getPetApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return PetApi(base: base, serializers: serializers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get StoreApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
StoreApi getStoreApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return StoreApi(base: base, serializers: serializers);
|
||||
StoreApi getStoreApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return StoreApi(base: base, serializers: serializers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get UserApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
* by doing that all interceptors will not be executed
|
||||
*/
|
||||
UserApi getUserApi({Route base, SerializerRepo serializers}) {
|
||||
if(base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
if(serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return UserApi(base: base, serializers: serializers);
|
||||
UserApi getUserApi({Route base, SerializerRepo serializers}) {
|
||||
if (base == null) {
|
||||
base = _baseRoute;
|
||||
}
|
||||
|
||||
|
||||
if (serializers == null) {
|
||||
serializers = jsonJaguarRepo;
|
||||
}
|
||||
return UserApi(base: base, serializers: serializers);
|
||||
}
|
||||
}
|
||||
|
@ -3,21 +3,21 @@ import 'dart:async';
|
||||
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
|
||||
|
||||
abstract class AuthInterceptor extends Interceptor {
|
||||
/*
|
||||
/*
|
||||
* Get auth information on given route for the given type
|
||||
* Can return null if type is not present on auth data or if route doesn't need authentication
|
||||
*/
|
||||
List<Map<String, dynamic>> getAuthInfo(RouteBase route, String type) {
|
||||
if (route.metadataMap.containsKey("auth")) {
|
||||
final auth = route.metadataMap["auth"];
|
||||
List<Map<String, dynamic>> results = [];
|
||||
for (var info in auth) {
|
||||
if(info["type"] == type) {
|
||||
results.add(info);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
List<Map<String, dynamic>> getAuthInfo(RouteBase route, String type) {
|
||||
if (route.metadataMap.containsKey("auth")) {
|
||||
final auth = route.metadataMap["auth"];
|
||||
List<Map<String, dynamic>> results = [];
|
||||
for (var info in auth) {
|
||||
if (info["type"] == type) {
|
||||
results.add(info);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
return results;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'api_response.jser.dart';
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
@Alias('code')
|
||||
final int code;
|
||||
|
||||
@ -13,17 +12,7 @@ class ApiResponse {
|
||||
@Alias('message')
|
||||
final String message;
|
||||
|
||||
|
||||
ApiResponse(
|
||||
|
||||
|
||||
{
|
||||
this.code = null,
|
||||
this.type = null,
|
||||
this.message = null
|
||||
|
||||
}
|
||||
);
|
||||
ApiResponse({this.code = null, this.type = null, this.message = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -32,6 +21,5 @@ class ApiResponse {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class ApiResponseSerializer extends Serializer<ApiResponse> with _$ApiResponseSerializer {
|
||||
|
||||
}
|
||||
class ApiResponseSerializer extends Serializer<ApiResponse>
|
||||
with _$ApiResponseSerializer {}
|
||||
|
@ -3,23 +3,13 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'category.jser.dart';
|
||||
|
||||
class Category {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@Alias('name')
|
||||
final String name;
|
||||
|
||||
|
||||
Category(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.name = null
|
||||
|
||||
}
|
||||
);
|
||||
Category({this.id = null, this.name = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -28,6 +18,5 @@ class Category {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class CategorySerializer extends Serializer<Category> with _$CategorySerializer {
|
||||
|
||||
}
|
||||
class CategorySerializer extends Serializer<Category>
|
||||
with _$CategorySerializer {}
|
||||
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'order.jser.dart';
|
||||
|
||||
class Order {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -15,27 +14,20 @@ class Order {
|
||||
|
||||
@Alias('shipDate')
|
||||
final DateTime shipDate;
|
||||
/* Order Status */
|
||||
/* Order Status */
|
||||
@Alias('status')
|
||||
final String status;
|
||||
//enum statusEnum { placed, approved, delivered, };
|
||||
@Alias('complete')
|
||||
final bool complete;
|
||||
|
||||
|
||||
Order(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.petId = null,
|
||||
this.quantity = null,
|
||||
this.shipDate = null,
|
||||
this.status = null,
|
||||
this.complete = false
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.petId = null,
|
||||
this.quantity = null,
|
||||
this.shipDate = null,
|
||||
this.status = null,
|
||||
this.complete = false});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -44,6 +36,4 @@ class Order {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class OrderSerializer extends Serializer<Order> with _$OrderSerializer {
|
||||
|
||||
}
|
||||
class OrderSerializer extends Serializer<Order> with _$OrderSerializer {}
|
||||
|
@ -5,7 +5,6 @@ import 'package:openapi/model/category.dart';
|
||||
part 'pet.jser.dart';
|
||||
|
||||
class Pet {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -20,24 +19,18 @@ class Pet {
|
||||
|
||||
@Alias('tags')
|
||||
final List<Tag> tags;
|
||||
/* pet status in the store */
|
||||
/* pet status in the store */
|
||||
@Alias('status')
|
||||
final String status;
|
||||
//enum statusEnum { available, pending, sold, };
|
||||
|
||||
Pet(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.category = null,
|
||||
|
||||
this.name = null,
|
||||
this.photoUrls = const [], this.tags = const [],
|
||||
this.status = null
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.category = null,
|
||||
this.name = null,
|
||||
this.photoUrls = const [],
|
||||
this.tags = const [],
|
||||
this.status = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -46,6 +39,4 @@ class Pet {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class PetSerializer extends Serializer<Pet> with _$PetSerializer {
|
||||
|
||||
}
|
||||
class PetSerializer extends Serializer<Pet> with _$PetSerializer {}
|
||||
|
@ -3,23 +3,13 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'tag.jser.dart';
|
||||
|
||||
class Tag {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@Alias('name')
|
||||
final String name;
|
||||
|
||||
|
||||
Tag(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.name = null
|
||||
|
||||
}
|
||||
);
|
||||
Tag({this.id = null, this.name = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -28,6 +18,4 @@ class Tag {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class TagSerializer extends Serializer<Tag> with _$TagSerializer {
|
||||
|
||||
}
|
||||
class TagSerializer extends Serializer<Tag> with _$TagSerializer {}
|
||||
|
@ -3,7 +3,6 @@ import 'package:jaguar_serializer/jaguar_serializer.dart';
|
||||
part 'user.jser.dart';
|
||||
|
||||
class User {
|
||||
|
||||
@Alias('id')
|
||||
final int id;
|
||||
|
||||
@ -24,26 +23,19 @@ class User {
|
||||
|
||||
@Alias('phone')
|
||||
final String phone;
|
||||
/* User Status */
|
||||
/* User Status */
|
||||
@Alias('userStatus')
|
||||
final int userStatus;
|
||||
|
||||
|
||||
User(
|
||||
|
||||
|
||||
{
|
||||
this.id = null,
|
||||
this.username = null,
|
||||
this.firstName = null,
|
||||
this.lastName = null,
|
||||
this.email = null,
|
||||
this.password = null,
|
||||
this.phone = null,
|
||||
this.userStatus = null
|
||||
|
||||
}
|
||||
);
|
||||
{this.id = null,
|
||||
this.username = null,
|
||||
this.firstName = null,
|
||||
this.lastName = null,
|
||||
this.email = null,
|
||||
this.password = null,
|
||||
this.phone = null,
|
||||
this.userStatus = null});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@ -52,6 +44,4 @@ class User {
|
||||
}
|
||||
|
||||
@GenSerializer()
|
||||
class UserSerializer extends Serializer<User> with _$UserSerializer {
|
||||
|
||||
}
|
||||
class UserSerializer extends Serializer<User> with _$UserSerializer {}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -41,8 +41,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -86,8 +85,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -267,8 +265,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -322,8 +319,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ class StoreApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,8 +82,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -125,8 +123,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -169,8 +166,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -303,8 +299,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -350,8 +345,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -41,8 +41,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -86,8 +85,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -267,8 +265,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -322,8 +319,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ class StoreApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,8 +82,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -125,8 +123,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -169,8 +166,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -303,8 +299,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -350,8 +345,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -87,8 +87,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
**petId** | **int**| Pet id to delete | [default to null]
|
||||
**apiKey** | **String**| | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -133,7 +133,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -178,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -225,7 +225,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
**petId** | **int**| ID of pet to return | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -311,7 +311,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||
|
||||
@ -358,7 +358,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**petId** | **int**| ID of pet to update | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||
|
||||
|
@ -40,7 +40,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **String**| ID of the order that needs to be deleted |
|
||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -166,7 +166,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -207,7 +207,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -249,8 +249,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
**username** | **String**| The user name for login | [default to null]
|
||||
**password** | **String**| The password for login in clear text | [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
@ -329,7 +329,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**username** | **String**| name that need to be deleted | [default to null]
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
@ -41,8 +41,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -86,8 +85,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -267,8 +265,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -322,8 +319,7 @@ class PetApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ class StoreApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,8 +82,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -125,8 +123,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -169,8 +166,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -303,8 +299,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -350,8 +345,7 @@ class UserApi {
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
} else if (response.body != null) {
|
||||
} else {
|
||||
} else if (response.body != null) {} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
3.3.0-SNAPSHOT
|
||||
3.3.1-SNAPSHOT
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.api
|
||||
|
||||
import org.openapitools.client.model._
|
||||
@ -17,32 +17,30 @@ import scala.reflect.ClassTag
|
||||
|
||||
object EnumsSerializers {
|
||||
|
||||
def all: Seq[Serializer[_]] =
|
||||
Seq[Serializer[_]]() :+
|
||||
new EnumNameSerializer(OrderEnums.Status) :+
|
||||
new EnumNameSerializer(PetEnums.Status)
|
||||
def all: Seq[Serializer[_]] = Seq[Serializer[_]]() :+
|
||||
new EnumNameSerializer(OrderEnums.Status) :+
|
||||
new EnumNameSerializer(PetEnums.Status)
|
||||
|
||||
private class EnumNameSerializer[E <: Enumeration: ClassTag](enum: E)
|
||||
extends Serializer[E#Value] {
|
||||
extends Serializer[E#Value] {
|
||||
import JsonDSL._
|
||||
|
||||
val EnumerationClass: Class[E#Value] = classOf[E#Value]
|
||||
|
||||
def deserialize(implicit format: Formats)
|
||||
: PartialFunction[(TypeInfo, JValue), E#Value] = {
|
||||
def deserialize(implicit format: Formats):
|
||||
PartialFunction[(TypeInfo, JValue), E#Value] = {
|
||||
case (t @ TypeInfo(EnumerationClass, _), json) if isValid(json) =>
|
||||
json match {
|
||||
case JString(value) =>
|
||||
enum.withName(value)
|
||||
case value =>
|
||||
throw new MappingException(
|
||||
s"Can't convert $value to $EnumerationClass")
|
||||
throw new MappingException(s"Can't convert $value to $EnumerationClass")
|
||||
}
|
||||
}
|
||||
|
||||
private[this] def isValid(json: JValue) = json match {
|
||||
case JString(value) if enum.values.exists(_.toString == value) => true
|
||||
case _ => false
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def serialize(implicit format: Formats): PartialFunction[Any, JValue] = {
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.api
|
||||
|
||||
import org.openapitools.client.model.ApiResponse
|
||||
@ -21,151 +21,118 @@ import org.openapitools.client.core.ApiKeyLocations._
|
||||
object PetApi {
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 405 : (Invalid input)
|
||||
*
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
*/
|
||||
* Expected answers:
|
||||
* code 405 : (Invalid input)
|
||||
*
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
*/
|
||||
def addPet(pet: Pet): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet", "application/json")
|
||||
.withBody(pet)
|
||||
.withErrorResponse[Unit](405)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid pet value)
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid pet value)
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
*/
|
||||
def deletePet(petId: Long, apiKey: Option[String] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.DELETE,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/{petId}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
|
||||
.withPathParam("petId", petId)
|
||||
.withHeaderParam("api_key", apiKey)
|
||||
.withErrorResponse[Unit](400)
|
||||
|
||||
/**
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Seq[Pet] (successful operation)
|
||||
* code 400 : (Invalid status value)
|
||||
*
|
||||
* @param status Status values that need to be considered for filter
|
||||
*/
|
||||
/**
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Seq[Pet] (successful operation)
|
||||
* code 400 : (Invalid status value)
|
||||
*
|
||||
* @param status Status values that need to be considered for filter
|
||||
*/
|
||||
def findPetsByStatus(status: Seq[String]): ApiRequest[Seq[Pet]] =
|
||||
ApiRequest[Seq[Pet]](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/findByStatus",
|
||||
"application/json")
|
||||
ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByStatus", "application/json")
|
||||
.withQueryParam("status", ArrayValues(status, CSV))
|
||||
.withSuccessResponse[Seq[Pet]](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
|
||||
/**
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Seq[Pet] (successful operation)
|
||||
* code 400 : (Invalid tag value)
|
||||
*
|
||||
* @param tags Tags to filter by
|
||||
*/
|
||||
/**
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Seq[Pet] (successful operation)
|
||||
* code 400 : (Invalid tag value)
|
||||
*
|
||||
* @param tags Tags to filter by
|
||||
*/
|
||||
def findPetsByTags(tags: Seq[String]): ApiRequest[Seq[Pet]] =
|
||||
ApiRequest[Seq[Pet]](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/findByTags",
|
||||
"application/json")
|
||||
ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByTags", "application/json")
|
||||
.withQueryParam("tags", ArrayValues(tags, CSV))
|
||||
.withSuccessResponse[Seq[Pet]](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
|
||||
/**
|
||||
* Returns a single pet
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Pet (successful operation)
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Pet not found)
|
||||
*
|
||||
* Available security schemes:
|
||||
* api_key (apiKey)
|
||||
*
|
||||
* @param petId ID of pet to return
|
||||
*/
|
||||
/**
|
||||
* Returns a single pet
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Pet (successful operation)
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Pet not found)
|
||||
*
|
||||
* Available security schemes:
|
||||
* api_key (apiKey)
|
||||
*
|
||||
* @param petId ID of pet to return
|
||||
*/
|
||||
def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/{petId}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
|
||||
.withApiKey(apiKey, "api_key", HEADER)
|
||||
.withPathParam("petId", petId)
|
||||
.withSuccessResponse[Pet](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Pet not found)
|
||||
* code 405 : (Validation exception)
|
||||
*
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Pet not found)
|
||||
* code 405 : (Validation exception)
|
||||
*
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
*/
|
||||
def updatePet(pet: Pet): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.PUT,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/pet", "application/json")
|
||||
.withBody(pet)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
.withErrorResponse[Unit](405)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 405 : (Invalid input)
|
||||
*
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
*/
|
||||
def updatePetWithForm(petId: Long,
|
||||
name: Option[String] = None,
|
||||
status: Option[String] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/{petId}",
|
||||
"application/x-www-form-urlencoded")
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 405 : (Invalid input)
|
||||
*
|
||||
* @param petId ID of pet that needs to be updated
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
*/
|
||||
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/x-www-form-urlencoded")
|
||||
.withFormParam("name", name)
|
||||
.withFormParam("status", status)
|
||||
.withPathParam("petId", petId)
|
||||
.withErrorResponse[Unit](405)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : ApiResponse (successful operation)
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
*/
|
||||
def uploadFile(petId: Long,
|
||||
additionalMetadata: Option[String] = None,
|
||||
file: Option[File] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/pet/{petId}/uploadImage",
|
||||
"multipart/form-data")
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : ApiResponse (successful operation)
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
*/
|
||||
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}/uploadImage", "multipart/form-data")
|
||||
.withFormParam("additionalMetadata", additionalMetadata)
|
||||
.withFormParam("file", file)
|
||||
.withPathParam("petId", petId)
|
||||
.withSuccessResponse[ApiResponse](200)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.api
|
||||
|
||||
import org.openapitools.client.model.Order
|
||||
@ -19,75 +19,61 @@ import org.openapitools.client.core.ApiKeyLocations._
|
||||
object StoreApi {
|
||||
|
||||
/**
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Order not found)
|
||||
*
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
*/
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Order not found)
|
||||
*
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
*/
|
||||
def deleteOrder(orderId: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.DELETE,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/store/order/{orderId}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
|
||||
.withPathParam("orderId", orderId)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
/**
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Map[String, Int] (successful operation)
|
||||
*
|
||||
* Available security schemes:
|
||||
* api_key (apiKey)
|
||||
*/
|
||||
def getInventory()(
|
||||
implicit apiKey: ApiKeyValue): ApiRequest[Map[String, Int]] =
|
||||
ApiRequest[Map[String, Int]](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/store/inventory",
|
||||
"application/json")
|
||||
/**
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Map[String, Int] (successful operation)
|
||||
*
|
||||
* Available security schemes:
|
||||
* api_key (apiKey)
|
||||
*/
|
||||
def getInventory()(implicit apiKey: ApiKeyValue): ApiRequest[Map[String, Int]] =
|
||||
ApiRequest[Map[String, Int]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/inventory", "application/json")
|
||||
.withApiKey(apiKey, "api_key", HEADER)
|
||||
.withSuccessResponse[Map[String, Int]](200)
|
||||
|
||||
/**
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Order (successful operation)
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Order not found)
|
||||
*
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
*/
|
||||
/**
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* Expected answers:
|
||||
* code 200 : Order (successful operation)
|
||||
* code 400 : (Invalid ID supplied)
|
||||
* code 404 : (Order not found)
|
||||
*
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
*/
|
||||
def getOrderById(orderId: Long): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/store/order/{orderId}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
|
||||
.withPathParam("orderId", orderId)
|
||||
.withSuccessResponse[Order](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : Order (successful operation)
|
||||
* code 400 : (Invalid Order)
|
||||
*
|
||||
* @param order order placed for purchasing the pet
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : Order (successful operation)
|
||||
* code 400 : (Invalid Order)
|
||||
*
|
||||
* @param order order placed for purchasing the pet
|
||||
*/
|
||||
def placeOrder(order: Order): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/store/order",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/store/order", "application/json")
|
||||
.withBody(order)
|
||||
.withSuccessResponse[Order](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.api
|
||||
|
||||
import org.openapitools.client.model.User
|
||||
@ -19,101 +19,78 @@ import org.openapitools.client.core.ApiKeyLocations._
|
||||
object UserApi {
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user Created user object
|
||||
*/
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user Created user object
|
||||
*/
|
||||
def createUser(user: User): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user", "application/json")
|
||||
.withBody(user)
|
||||
.withDefaultSuccessResponse[Unit]
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user List of user object
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user List of user object
|
||||
*/
|
||||
def createUsersWithArrayInput(user: Seq[User]): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/createWithArray",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithArray", "application/json")
|
||||
.withBody(user)
|
||||
.withDefaultSuccessResponse[Unit]
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user List of user object
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*
|
||||
* @param user List of user object
|
||||
*/
|
||||
def createUsersWithListInput(user: Seq[User]): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/createWithList",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithList", "application/json")
|
||||
.withBody(user)
|
||||
.withDefaultSuccessResponse[Unit]
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid username supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username The name that needs to be deleted
|
||||
*/
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid username supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username The name that needs to be deleted
|
||||
*/
|
||||
def deleteUser(username: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.DELETE,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/{username}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
|
||||
.withPathParam("username", username)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : User (successful operation)
|
||||
* code 400 : (Invalid username supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : User (successful operation)
|
||||
* code 400 : (Invalid username supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
def getUserByName(username: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/{username}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
|
||||
.withPathParam("username", username)
|
||||
.withSuccessResponse[User](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : String (successful operation)
|
||||
* Headers :
|
||||
* X-Rate-Limit - calls per hour allowed by the user
|
||||
* X-Expires-After - date in UTC when toekn expires
|
||||
* code 400 : (Invalid username/password supplied)
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
*/
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 200 : String (successful operation)
|
||||
* Headers :
|
||||
* X-Rate-Limit - calls per hour allowed by the user
|
||||
* X-Expires-After - date in UTC when toekn expires
|
||||
* code 400 : (Invalid username/password supplied)
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
*/
|
||||
def loginUser(username: String, password: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/login",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/login", "application/json")
|
||||
.withQueryParam("username", username)
|
||||
.withQueryParam("password", password)
|
||||
.withSuccessResponse[String](200)
|
||||
@ -121,39 +98,32 @@ object UserApi {
|
||||
|
||||
object LoginUserHeaders {
|
||||
def xRateLimit(r: ApiReturnWithHeaders) = r.getIntHeader("X-Rate-Limit")
|
||||
def xExpiresAfter(r: ApiReturnWithHeaders) =
|
||||
r.getDateTimeHeader("X-Expires-After")
|
||||
def xExpiresAfter(r: ApiReturnWithHeaders) = r.getDateTimeHeader("X-Expires-After")
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*/
|
||||
* Expected answers:
|
||||
* code 0 : (successful operation)
|
||||
*/
|
||||
def logoutUser(): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/logout",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/logout", "application/json")
|
||||
.withDefaultSuccessResponse[Unit]
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid user supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username name that need to be deleted
|
||||
* @param user Updated user object
|
||||
*/
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* Expected answers:
|
||||
* code 400 : (Invalid user supplied)
|
||||
* code 404 : (User not found)
|
||||
*
|
||||
* @param username name that need to be deleted
|
||||
* @param user Updated user object
|
||||
*/
|
||||
def updateUser(username: String, user: User): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.PUT,
|
||||
"http://petstore.swagger.io/v2",
|
||||
"/user/{username}",
|
||||
"application/json")
|
||||
ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
|
||||
.withBody(user)
|
||||
.withPathParam("username", username)
|
||||
.withErrorResponse[Unit](400)
|
||||
.withErrorResponse[Unit](404)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.core
|
||||
|
||||
import java.io.File
|
||||
@ -46,82 +46,58 @@ object ApiInvoker {
|
||||
|
||||
def apply()(implicit system: ActorSystem): ApiInvoker =
|
||||
apply(DefaultFormats + DateTimeSerializer)
|
||||
def apply(serializers: Traversable[Serializer[_]])(
|
||||
implicit system: ActorSystem): ApiInvoker =
|
||||
def apply(serializers: Traversable[Serializer[_]])(implicit system: ActorSystem): ApiInvoker =
|
||||
apply(DefaultFormats + DateTimeSerializer ++ serializers)
|
||||
def apply(formats: Formats)(implicit system: ActorSystem): ApiInvoker =
|
||||
new ApiInvoker(formats)
|
||||
def apply(formats: Formats)(implicit system: ActorSystem): ApiInvoker = new ApiInvoker(formats)
|
||||
|
||||
case class CustomStatusCode(
|
||||
value: Int,
|
||||
reason: String = "Application-defined status code",
|
||||
isSuccess: Boolean = true)
|
||||
case class CustomStatusCode(value: Int, reason: String = "Application-defined status code", isSuccess: Boolean = true)
|
||||
|
||||
def addCustomStatusCode(code: CustomStatusCode): Unit =
|
||||
addCustomStatusCode(code.value, code.reason, code.isSuccess)
|
||||
def addCustomStatusCode(code: CustomStatusCode): Unit = addCustomStatusCode(code.value, code.reason, code.isSuccess)
|
||||
|
||||
def addCustomStatusCode(code: Int,
|
||||
reason: String = "Application defined code",
|
||||
isSuccess: Boolean = true): Unit = {
|
||||
def addCustomStatusCode(code: Int, reason: String = "Application defined code", isSuccess: Boolean = true): Unit = {
|
||||
StatusCodes.getForKey(code) foreach { _ =>
|
||||
StatusCodes.registerCustom(code,
|
||||
reason,
|
||||
reason,
|
||||
isSuccess,
|
||||
allowsEntity = true)
|
||||
StatusCodes.registerCustom(code, reason, reason, isSuccess, allowsEntity = true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows request execution without calling apiInvoker.execute(request)
|
||||
* request.response can be used to get a future of the ApiResponse generated.
|
||||
* request.result can be used to get a future of the expected ApiResponse content. If content doesn't match, a
|
||||
* Future will failed with a ClassCastException
|
||||
* @param request the apiRequest to be executed
|
||||
*/
|
||||
* Allows request execution without calling apiInvoker.execute(request)
|
||||
* request.response can be used to get a future of the ApiResponse generated.
|
||||
* request.result can be used to get a future of the expected ApiResponse content. If content doesn't match, a
|
||||
* Future will failed with a ClassCastException
|
||||
* @param request the apiRequest to be executed
|
||||
*/
|
||||
implicit class ApiRequestImprovements[T](request: ApiRequest[T]) {
|
||||
|
||||
def response(invoker: ApiInvoker)(
|
||||
implicit ec: ExecutionContext,
|
||||
system: ActorSystem): Future[ApiResponse[T]] =
|
||||
def response(invoker: ApiInvoker)(implicit ec: ExecutionContext, system: ActorSystem): Future[ApiResponse[T]] =
|
||||
response(ec, system, invoker)
|
||||
|
||||
def response(implicit ec: ExecutionContext,
|
||||
system: ActorSystem,
|
||||
invoker: ApiInvoker): Future[ApiResponse[T]] =
|
||||
def response(implicit ec: ExecutionContext, system: ActorSystem, invoker: ApiInvoker): Future[ApiResponse[T]] =
|
||||
invoker.execute(request)
|
||||
|
||||
def result[U <: T](implicit c: ClassTag[U],
|
||||
ec: ExecutionContext,
|
||||
system: ActorSystem,
|
||||
invoker: ApiInvoker): Future[U] =
|
||||
def result[U <: T](implicit c: ClassTag[U], ec: ExecutionContext, system: ActorSystem, invoker: ApiInvoker): Future[U] =
|
||||
invoker.execute(request).map(_.content).mapTo[U]
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows transformation from ApiMethod to spray HttpMethods
|
||||
* @param method the ApiMethod to be converted
|
||||
*/
|
||||
* Allows transformation from ApiMethod to spray HttpMethods
|
||||
* @param method the ApiMethod to be converted
|
||||
*/
|
||||
implicit class ApiMethodExtensions(val method: ApiMethod) {
|
||||
def toSprayMethod: HttpMethod =
|
||||
HttpMethods.getForKey(method.value).getOrElse(HttpMethods.GET)
|
||||
def toSprayMethod: HttpMethod = HttpMethods.getForKey(method.value).getOrElse(HttpMethods.GET)
|
||||
}
|
||||
|
||||
case object DateTimeSerializer
|
||||
extends CustomSerializer[DateTime](format =>
|
||||
({
|
||||
case JString(s) =>
|
||||
ISODateTimeFormat.dateOptionalTimeParser().parseDateTime(s)
|
||||
}, {
|
||||
case d: DateTime =>
|
||||
JString(ISODateTimeFormat.dateTime().print(d))
|
||||
}))
|
||||
case object DateTimeSerializer extends CustomSerializer[DateTime](format => ( {
|
||||
case JString(s) =>
|
||||
ISODateTimeFormat.dateOptionalTimeParser().parseDateTime(s)
|
||||
}, {
|
||||
case d: DateTime =>
|
||||
JString(ISODateTimeFormat.dateTime().print(d))
|
||||
}))
|
||||
}
|
||||
|
||||
class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
extends UntrustedSslContext
|
||||
with CustomContentTypes {
|
||||
class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends UntrustedSslContext with CustomContentTypes {
|
||||
|
||||
import org.openapitools.client.core.ApiInvoker._
|
||||
import org.openapitools.client.core.ParametersMap._
|
||||
@ -133,27 +109,23 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
|
||||
import spray.http.MessagePredicate._
|
||||
|
||||
val CompressionFilter: MessagePredicate = MessagePredicate({ _ =>
|
||||
settings.compressionEnabled
|
||||
}) &&
|
||||
val CompressionFilter: MessagePredicate= MessagePredicate({ _ => settings.compressionEnabled}) &&
|
||||
Encoder.DefaultFilter && minEntitySize(settings.compressionSizeThreshold)
|
||||
|
||||
settings.customCodes.foreach(addCustomStatusCode)
|
||||
|
||||
private def addAuthentication(
|
||||
credentialsSeq: Seq[Credentials]): pipelining.RequestTransformer =
|
||||
private def addAuthentication(credentialsSeq: Seq[Credentials]): pipelining.RequestTransformer =
|
||||
request =>
|
||||
credentialsSeq.foldLeft(request) {
|
||||
case (req, BasicCredentials(login, password)) =>
|
||||
req ~> addCredentials(BasicHttpCredentials(login, password))
|
||||
case (req,
|
||||
ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
||||
case (req, ApiKeyCredentials(keyValue, keyName, ApiKeyLocations.HEADER)) =>
|
||||
req ~> addHeader(RawHeader(keyName, keyValue.value))
|
||||
case (req, _) => req
|
||||
}
|
||||
}
|
||||
|
||||
private def addHeaders(headers: Map[String, Any]): pipelining.RequestTransformer = { request =>
|
||||
|
||||
private def addHeaders(
|
||||
headers: Map[String, Any]): pipelining.RequestTransformer = { request =>
|
||||
val rawHeaders = for {
|
||||
(name, value) <- headers.asFormattedParams
|
||||
header = RawHeader(name, String.valueOf(value))
|
||||
@ -183,9 +155,7 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
Some(
|
||||
normalizedContentType(request.contentType).mediaType match {
|
||||
case MediaTypes.`multipart/form-data` =>
|
||||
MultipartFormData(params.map {
|
||||
case (name, value) => (name, bodyPart(name, value))
|
||||
})
|
||||
MultipartFormData(params.map { case (name, value) => (name, bodyPart(name, value))})
|
||||
case MediaTypes.`application/x-www-form-urlencoded` =>
|
||||
FormData(params.mapValues(String.valueOf))
|
||||
case m: MediaType => // Default : application/x-www-form-urlencoded.
|
||||
@ -210,13 +180,9 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
case Some(c: MultipartFormData) =>
|
||||
builder.apply(uri, c)
|
||||
case Some(c: String) =>
|
||||
builder.apply(
|
||||
uri,
|
||||
HttpEntity(normalizedContentType(request.contentType), c))
|
||||
builder.apply(uri, HttpEntity(normalizedContentType(request.contentType), c))
|
||||
case _ =>
|
||||
builder.apply(
|
||||
uri,
|
||||
HttpEntity(normalizedContentType(request.contentType), " "))
|
||||
builder.apply(uri, HttpEntity(normalizedContentType(request.contentType), " "))
|
||||
}
|
||||
case _ => builder.apply(uri)
|
||||
}
|
||||
@ -228,17 +194,15 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
}
|
||||
|
||||
def makeQuery(r: ApiRequest[_]): Query = {
|
||||
r.credentials
|
||||
.foldLeft(r.queryParams) {
|
||||
case (params, ApiKeyCredentials(key, keyName, ApiKeyLocations.QUERY)) =>
|
||||
params + (keyName -> key.value)
|
||||
case (params, _) => params
|
||||
}
|
||||
.asFormattedParams
|
||||
r.credentials.foldLeft(r.queryParams) {
|
||||
case (params, ApiKeyCredentials(key, keyName, ApiKeyLocations.QUERY)) =>
|
||||
params + (keyName -> key.value)
|
||||
case (params, _) => params
|
||||
}.asFormattedParams
|
||||
.mapValues(String.valueOf)
|
||||
.foldRight[Query](Uri.Query.Empty) {
|
||||
case ((name, value), acc) => acc.+:(name, value)
|
||||
}
|
||||
case ((name, value), acc) => acc.+:(name, value)
|
||||
}
|
||||
}
|
||||
|
||||
def makeUri(r: ApiRequest[_]): Uri = {
|
||||
@ -246,8 +210,8 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
val opPathWithParams = r.pathParams.asFormattedParams
|
||||
.mapValues(String.valueOf)
|
||||
.foldLeft(opPath) {
|
||||
case (path, (name, value)) => path.replaceAll(s"\\{$name\\}", value)
|
||||
}
|
||||
case (path, (name, value)) => path.replaceAll(s"\\{$name\\}", value)
|
||||
}
|
||||
val query = makeQuery(r)
|
||||
|
||||
Uri(r.basePath + opPathWithParams).withQuery(query)
|
||||
@ -263,9 +227,7 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
uri.authority.host.toString,
|
||||
uri.effectivePort,
|
||||
sslEncryption = "https".equals(uri.scheme),
|
||||
defaultHeaders = settings.defaultHeaders ++ List(
|
||||
`Accept-Encoding`(gzip, deflate))
|
||||
)
|
||||
defaultHeaders = settings.defaultHeaders ++ List(`Accept-Encoding`(gzip, deflate)))
|
||||
|
||||
val request = createRequest(uri, r)
|
||||
|
||||
@ -275,62 +237,46 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
} yield {
|
||||
response ~> decode(Deflate) ~> decode(Gzip) ~> unmarshallApiResponse(r)
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
catch {
|
||||
case NonFatal(x) => Future.failed(x)
|
||||
}
|
||||
}
|
||||
|
||||
def unmarshallApiResponse[T](request: ApiRequest[T])(
|
||||
response: HttpResponse): ApiResponse[T] = {
|
||||
def unmarshallApiResponse[T](request: ApiRequest[T])(response: HttpResponse): ApiResponse[T] = {
|
||||
request.responseForCode(response.status.intValue) match {
|
||||
case Some((manifest: Manifest[T], state: ResponseState)) =>
|
||||
case Some( (manifest: Manifest[T], state: ResponseState) ) =>
|
||||
entityUnmarshaller(manifest)(response.entity) match {
|
||||
case Right(value) ⇒
|
||||
state match {
|
||||
case ResponseState.Success =>
|
||||
ApiResponse(response.status.intValue,
|
||||
value,
|
||||
response.headers
|
||||
.map(header => (header.name, header.value))
|
||||
.toMap)
|
||||
ApiResponse(response.status.intValue, value, response.headers.map(header => (header.name, header.value)).toMap)
|
||||
case ResponseState.Error =>
|
||||
throw ApiError(response.status.intValue,
|
||||
"Error response received",
|
||||
Some(value),
|
||||
headers = response.headers
|
||||
.map(header => (header.name, header.value))
|
||||
.toMap)
|
||||
throw ApiError(response.status.intValue, "Error response received",
|
||||
Some(value),
|
||||
headers = response.headers.map(header => (header.name, header.value)).toMap)
|
||||
}
|
||||
|
||||
case Left(MalformedContent(error, Some(cause))) ⇒
|
||||
throw ApiError(response.status.intValue,
|
||||
s"Unable to unmarshall content to [$manifest]",
|
||||
Some(response.entity.toString),
|
||||
cause)
|
||||
throw ApiError(response.status.intValue, s"Unable to unmarshall content to [$manifest]", Some(response.entity.toString), cause)
|
||||
|
||||
case Left(MalformedContent(error, None)) ⇒
|
||||
throw ApiError(response.status.intValue,
|
||||
s"Unable to unmarshall content to [$manifest]",
|
||||
Some(response.entity.toString))
|
||||
throw ApiError(response.status.intValue, s"Unable to unmarshall content to [$manifest]", Some(response.entity.toString))
|
||||
|
||||
case Left(ContentExpected) ⇒
|
||||
throw ApiError(
|
||||
response.status.intValue,
|
||||
s"Unable to unmarshall empty response to [$manifest]",
|
||||
Some(response.entity.toString))
|
||||
throw ApiError(response.status.intValue, s"Unable to unmarshall empty response to [$manifest]", Some(response.entity.toString))
|
||||
}
|
||||
|
||||
case _ =>
|
||||
throw ApiError(response.status.intValue,
|
||||
"Unexpected response code",
|
||||
Some(response.entity.toString))
|
||||
case _ => throw ApiError(response.status.intValue, "Unexpected response code", Some(response.entity.toString))
|
||||
}
|
||||
}
|
||||
|
||||
def entityUnmarshaller[T](implicit mf: Manifest[T]): Unmarshaller[T] =
|
||||
Unmarshaller[T](MediaTypes.`application/json`) {
|
||||
case x: HttpEntity.NonEmpty ⇒
|
||||
parse(x.asString(defaultCharset = HttpCharsets.`UTF-8`)).noNulls.camelizeKeys
|
||||
parse(x.asString(defaultCharset = HttpCharsets.`UTF-8`))
|
||||
.noNulls
|
||||
.camelizeKeys
|
||||
.extract[T]
|
||||
}
|
||||
|
||||
@ -339,12 +285,10 @@ class ApiInvoker(formats: Formats)(implicit system: ActorSystem)
|
||||
sealed trait CustomContentTypes {
|
||||
|
||||
def normalizedContentType(original: String): ContentType =
|
||||
MediaTypes.forExtension(original) map (ContentType(_)) getOrElse parseContentType(
|
||||
original)
|
||||
MediaTypes.forExtension(original) map (ContentType(_)) getOrElse parseContentType(original)
|
||||
|
||||
def parseContentType(contentType: String): ContentType = {
|
||||
val contentTypeAsRawHeader =
|
||||
HttpHeaders.RawHeader("Content-Type", contentType)
|
||||
val contentTypeAsRawHeader = HttpHeaders.RawHeader("Content-Type", contentType)
|
||||
val parsedContentTypeHeader = HttpParser.parseHeader(contentTypeAsRawHeader)
|
||||
(parsedContentTypeHeader: @unchecked) match {
|
||||
case Right(ct: HttpHeaders.`Content-Type`) =>
|
||||
@ -366,11 +310,9 @@ sealed trait UntrustedSslContext {
|
||||
|
||||
case true =>
|
||||
class IgnoreX509TrustManager extends X509TrustManager {
|
||||
def checkClientTrusted(chain: Array[X509Certificate],
|
||||
authType: String): Unit = {}
|
||||
def checkClientTrusted(chain: Array[X509Certificate], authType: String): Unit = {}
|
||||
|
||||
def checkServerTrusted(chain: Array[X509Certificate],
|
||||
authType: String): Unit = {}
|
||||
def checkServerTrusted(chain: Array[X509Certificate], authType: String): Unit = {}
|
||||
|
||||
def getAcceptedIssuers = null
|
||||
}
|
||||
@ -382,9 +324,10 @@ sealed trait UntrustedSslContext {
|
||||
}
|
||||
|
||||
implicit val clientSSLEngineProvider =
|
||||
ClientSSLEngineProvider { _ =>
|
||||
val engine = trustfulSslContext.createSSLEngine()
|
||||
engine.setUseClientMode(true)
|
||||
engine
|
||||
ClientSSLEngineProvider {
|
||||
_ =>
|
||||
val engine = trustfulSslContext.createSSLEngine()
|
||||
engine.setUseClientMode(true)
|
||||
engine
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.core
|
||||
|
||||
sealed trait ResponseState
|
||||
@ -22,58 +22,44 @@ object ResponseState {
|
||||
}
|
||||
|
||||
case class ApiRequest[U](
|
||||
// required fields
|
||||
method: ApiMethod,
|
||||
basePath: String,
|
||||
operationPath: String,
|
||||
contentType: String,
|
||||
// optional fields
|
||||
responses: Map[Int, (Manifest[_], ResponseState)] =
|
||||
Map.empty,
|
||||
bodyParam: Option[Any] = None,
|
||||
formParams: Map[String, Any] = Map.empty,
|
||||
pathParams: Map[String, Any] = Map.empty,
|
||||
queryParams: Map[String, Any] = Map.empty,
|
||||
headerParams: Map[String, Any] = Map.empty,
|
||||
credentials: Seq[Credentials] = List.empty) {
|
||||
// required fields
|
||||
method: ApiMethod,
|
||||
basePath: String,
|
||||
operationPath: String,
|
||||
contentType: String,
|
||||
|
||||
def withCredentials(cred: Credentials): ApiRequest[U] =
|
||||
copy[U](credentials = credentials :+ cred)
|
||||
// optional fields
|
||||
responses: Map[Int, (Manifest[_], ResponseState)] = Map.empty,
|
||||
bodyParam: Option[Any] = None,
|
||||
formParams: Map[String, Any] = Map.empty,
|
||||
pathParams: Map[String, Any] = Map.empty,
|
||||
queryParams: Map[String, Any] = Map.empty,
|
||||
headerParams: Map[String, Any] = Map.empty,
|
||||
credentials: Seq[Credentials] = List.empty) {
|
||||
|
||||
def withApiKey(key: ApiKeyValue,
|
||||
keyName: String,
|
||||
location: ApiKeyLocation): ApiRequest[U] =
|
||||
withCredentials(ApiKeyCredentials(key, keyName, location))
|
||||
def withCredentials(cred: Credentials): ApiRequest[U] = copy[U](credentials = credentials :+ cred)
|
||||
|
||||
def withSuccessResponse[T](code: Int)(
|
||||
implicit m: Manifest[T]): ApiRequest[U] =
|
||||
copy[U](responses = responses + (code -> (m, ResponseState.Success)))
|
||||
def withApiKey(key: ApiKeyValue, keyName: String, location: ApiKeyLocation): ApiRequest[U] = withCredentials(ApiKeyCredentials(key, keyName, location))
|
||||
|
||||
def withErrorResponse[T](code: Int)(implicit m: Manifest[T]): ApiRequest[U] =
|
||||
copy[U](responses = responses + (code -> (m, ResponseState.Error)))
|
||||
def withSuccessResponse[T](code: Int)(implicit m: Manifest[T]): ApiRequest[U] = copy[U](responses = responses + (code -> (m, ResponseState.Success)))
|
||||
|
||||
def withDefaultSuccessResponse[T](implicit m: Manifest[T]): ApiRequest[U] =
|
||||
withSuccessResponse[T](0)
|
||||
def withErrorResponse[T](code: Int)(implicit m: Manifest[T]): ApiRequest[U] = copy[U](responses = responses + (code -> (m, ResponseState.Error)))
|
||||
|
||||
def withDefaultErrorResponse[T](implicit m: Manifest[T]): ApiRequest[U] =
|
||||
withErrorResponse[T](0)
|
||||
def withDefaultSuccessResponse[T](implicit m: Manifest[T]): ApiRequest[U] = withSuccessResponse[T](0)
|
||||
|
||||
def responseForCode(statusCode: Int): Option[(Manifest[_], ResponseState)] =
|
||||
responses.get(statusCode) orElse responses.get(0)
|
||||
def withDefaultErrorResponse[T](implicit m: Manifest[T]): ApiRequest[U] = withErrorResponse[T](0)
|
||||
|
||||
def responseForCode(statusCode: Int): Option[(Manifest[_], ResponseState)] = responses.get(statusCode) orElse responses.get(0)
|
||||
|
||||
def withoutBody(): ApiRequest[U] = copy[U](bodyParam = None)
|
||||
|
||||
def withBody(body: Any): ApiRequest[U] = copy[U](bodyParam = Some(body))
|
||||
|
||||
def withFormParam(name: String, value: Any): ApiRequest[U] =
|
||||
copy[U](formParams = formParams + (name -> value))
|
||||
def withFormParam(name: String, value: Any): ApiRequest[U] = copy[U](formParams = formParams + (name -> value))
|
||||
|
||||
def withPathParam(name: String, value: Any): ApiRequest[U] =
|
||||
copy[U](pathParams = pathParams + (name -> value))
|
||||
def withPathParam(name: String, value: Any): ApiRequest[U] = copy[U](pathParams = pathParams + (name -> value))
|
||||
|
||||
def withQueryParam(name: String, value: Any): ApiRequest[U] =
|
||||
copy[U](queryParams = queryParams + (name -> value))
|
||||
def withQueryParam(name: String, value: Any): ApiRequest[U] = copy[U](queryParams = queryParams + (name -> value))
|
||||
|
||||
def withHeaderParam(name: String, value: Any): ApiRequest[U] =
|
||||
copy[U](headerParams = headerParams + (name -> value))
|
||||
def withHeaderParam(name: String, value: Any): ApiRequest[U] = copy[U](headerParams = headerParams + (name -> value))
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.core
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -27,23 +27,16 @@ class ApiSettings(config: Config) extends Extension {
|
||||
private def cfg = config.getConfig("org.openapitools.client.apiRequest")
|
||||
|
||||
val alwaysTrustCertificates: Boolean = cfg.getBoolean("trust-certificates")
|
||||
val defaultHeaders: List[RawHeader] = cfg
|
||||
.getConfig("default-headers")
|
||||
.entrySet
|
||||
.toList
|
||||
.map(c => RawHeader(c.getKey, c.getValue.render))
|
||||
val connectionTimeout = FiniteDuration(
|
||||
cfg.getDuration("connection-timeout", TimeUnit.MILLISECONDS),
|
||||
TimeUnit.MILLISECONDS)
|
||||
val defaultHeaders: List[RawHeader] = cfg.getConfig("default-headers").entrySet.toList.map(c => RawHeader(c.getKey, c.getValue.render))
|
||||
val connectionTimeout = FiniteDuration(cfg.getDuration("connection-timeout", TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS)
|
||||
val compressionEnabled: Boolean = cfg.getBoolean("compression.enabled")
|
||||
val compressionSizeThreshold: Int =
|
||||
cfg.getBytes("compression.size-threshold").toInt
|
||||
val customCodes: List[CustomStatusCode] =
|
||||
cfg.getConfigList("custom-codes").toList.map { c =>
|
||||
CustomStatusCode(c.getInt("code"),
|
||||
c.getString("reason"),
|
||||
c.getBoolean("success"))
|
||||
}
|
||||
val compressionSizeThreshold: Int = cfg.getBytes("compression.size-threshold").toInt
|
||||
val customCodes: List[CustomStatusCode] = cfg.getConfigList("custom-codes").toList.map { c =>
|
||||
CustomStatusCode(
|
||||
c.getInt("code"),
|
||||
c.getString("reason"),
|
||||
c.getBoolean("success"))
|
||||
}
|
||||
}
|
||||
|
||||
object ApiSettings extends ExtensionKey[ApiSettings]
|
||||
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.core
|
||||
|
||||
import java.io.File
|
||||
@ -26,42 +26,28 @@ sealed trait ApiReturnWithHeaders {
|
||||
// workaround: return date time header in string instead of datetime object
|
||||
def getDateTimeHeader(name: String): Option[String] = header(name)
|
||||
|
||||
def getIntHeader(name: String): Option[Int] =
|
||||
castedHeader(name, java.lang.Integer.parseInt)
|
||||
def getIntHeader(name: String): Option[Int] = castedHeader(name, java.lang.Integer.parseInt)
|
||||
|
||||
def getLongHeader(name: String): Option[Long] =
|
||||
castedHeader(name, java.lang.Long.parseLong)
|
||||
def getLongHeader(name: String): Option[Long] = castedHeader(name, java.lang.Long.parseLong)
|
||||
|
||||
def getFloatHeader(name: String): Option[Float] =
|
||||
castedHeader(name, java.lang.Float.parseFloat)
|
||||
def getFloatHeader(name: String): Option[Float] = castedHeader(name, java.lang.Float.parseFloat)
|
||||
|
||||
def getDoubleHeader(name: String): Option[Double] =
|
||||
castedHeader(name, java.lang.Double.parseDouble)
|
||||
def getDoubleHeader(name: String): Option[Double] = castedHeader(name, java.lang.Double.parseDouble)
|
||||
|
||||
def getBooleanHeader(name: String): Option[Boolean] =
|
||||
castedHeader(name, java.lang.Boolean.parseBoolean)
|
||||
def getBooleanHeader(name: String): Option[Boolean] = castedHeader(name, java.lang.Boolean.parseBoolean)
|
||||
|
||||
private def castedHeader[U](name: String,
|
||||
conversion: String => U): Option[U] = {
|
||||
private def castedHeader[U](name: String, conversion: String => U): Option[U] = {
|
||||
Try {
|
||||
header(name).map(conversion)
|
||||
}.get
|
||||
}
|
||||
}
|
||||
|
||||
sealed case class ApiResponse[T](code: Int,
|
||||
content: T,
|
||||
headers: Map[String, String] = Map.empty)
|
||||
extends ApiReturnWithHeaders
|
||||
sealed case class ApiResponse[T](code: Int, content: T, headers: Map[String, String] = Map.empty)
|
||||
extends ApiReturnWithHeaders
|
||||
|
||||
sealed case class ApiError[T](code: Int,
|
||||
message: String,
|
||||
responseContent: Option[T],
|
||||
cause: Throwable = null,
|
||||
headers: Map[String, String] = Map.empty)
|
||||
extends Throwable(
|
||||
s"($code) $message.${responseContent.map(s => s" Content : $s").getOrElse("")}",
|
||||
cause)
|
||||
sealed case class ApiError[T](code: Int, message: String, responseContent: Option[T], cause: Throwable = null, headers: Map[String, String] = Map.empty)
|
||||
extends Throwable(s"($code) $message.${responseContent.map(s => s" Content : $s").getOrElse("")}", cause)
|
||||
with ApiReturnWithHeaders
|
||||
|
||||
sealed case class ApiMethod(value: String)
|
||||
@ -79,27 +65,23 @@ object ApiMethods {
|
||||
}
|
||||
|
||||
/**
|
||||
* This trait needs to be added to any model defined by the api.
|
||||
*/
|
||||
* This trait needs to be added to any model defined by the api.
|
||||
*/
|
||||
trait ApiModel
|
||||
|
||||
/**
|
||||
* Single trait defining a credential that can be transformed to a paramName / paramValue tupple
|
||||
*/
|
||||
* Single trait defining a credential that can be transformed to a paramName / paramValue tupple
|
||||
*/
|
||||
sealed trait Credentials {
|
||||
def asQueryParam: Option[(String, String)] = None
|
||||
}
|
||||
|
||||
sealed case class BasicCredentials(user: String, password: String)
|
||||
extends Credentials
|
||||
sealed case class BasicCredentials(user: String, password: String) extends Credentials
|
||||
|
||||
sealed case class ApiKeyCredentials(key: ApiKeyValue,
|
||||
keyName: String,
|
||||
location: ApiKeyLocation)
|
||||
extends Credentials {
|
||||
sealed case class ApiKeyCredentials(key: ApiKeyValue, keyName: String, location: ApiKeyLocation) extends Credentials {
|
||||
override def asQueryParam: Option[(String, String)] = location match {
|
||||
case ApiKeyLocations.QUERY => Some((keyName, key.value))
|
||||
case _ => None
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,40 +97,39 @@ object ApiKeyLocations {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Case class used to unapply numeric values only in pattern matching
|
||||
*
|
||||
* @param value the string representation of the numeric value
|
||||
*/
|
||||
* Case class used to unapply numeric values only in pattern matching
|
||||
*
|
||||
* @param value the string representation of the numeric value
|
||||
*/
|
||||
sealed case class NumericValue(value: String) {
|
||||
override def toString: String = value
|
||||
}
|
||||
|
||||
object NumericValue {
|
||||
def unapply(n: Any): Option[NumericValue] = n match {
|
||||
case (_: Int | _: Long | _: Float | _: Double | _: Boolean | _: Byte) =>
|
||||
Some(NumericValue(String.valueOf(n)))
|
||||
case (_: Int | _: Long | _: Float | _: Double | _: Boolean | _: Byte) => Some(NumericValue(String.valueOf(n)))
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for params being arrays
|
||||
*/
|
||||
sealed case class ArrayValues(values: Seq[Any],
|
||||
format: CollectionFormat = CollectionFormats.CSV)
|
||||
* Used for params being arrays
|
||||
*/
|
||||
sealed case class ArrayValues(values: Seq[Any], format: CollectionFormat = CollectionFormats.CSV)
|
||||
|
||||
object ArrayValues {
|
||||
def apply(values: Option[Seq[Any]], format: CollectionFormat): ArrayValues =
|
||||
ArrayValues(values.getOrElse(Seq.empty), format)
|
||||
|
||||
def apply(values: Option[Seq[Any]]): ArrayValues =
|
||||
ArrayValues(values, CollectionFormats.CSV)
|
||||
def apply(values: Option[Seq[Any]]): ArrayValues = ArrayValues(values, CollectionFormats.CSV)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines how arrays should be rendered in query strings.
|
||||
*/
|
||||
* Defines how arrays should be rendered in query strings.
|
||||
*/
|
||||
sealed trait CollectionFormat
|
||||
|
||||
trait MergedArrayFormat extends CollectionFormat {
|
||||
@ -180,39 +161,33 @@ object CollectionFormats {
|
||||
object ParametersMap {
|
||||
|
||||
/**
|
||||
* Pimp parameters maps (Map[String, Any]) in order to transform them in a sequence of String -> Any tupples,
|
||||
* with valid url-encoding, arrays handling, files preservation, ...
|
||||
*/
|
||||
* Pimp parameters maps (Map[String, Any]) in order to transform them in a sequence of String -> Any tupples,
|
||||
* with valid url-encoding, arrays handling, files preservation, ...
|
||||
*/
|
||||
implicit class ParametersMapImprovements(val m: Map[String, Any]) {
|
||||
|
||||
def asFormattedParamsList: List[(String, Any)] =
|
||||
m.toList.flatMap(formattedParams)
|
||||
def asFormattedParamsList: List[(String, Any)] = m.toList.flatMap(formattedParams)
|
||||
|
||||
def asFormattedParams: Map[String, Any] = m.flatMap(formattedParams)
|
||||
|
||||
private def urlEncode(v: Any) =
|
||||
URLEncoder.encode(String.valueOf(v), "utf-8").replaceAll("\\+", "%20")
|
||||
private def urlEncode(v: Any) = URLEncoder.encode(String.valueOf(v), "utf-8").replaceAll("\\+", "%20")
|
||||
|
||||
private def formattedParams(tuple: (String, Any)): Seq[(String, Any)] =
|
||||
formattedParams(tuple._1, tuple._2)
|
||||
private def formattedParams(tuple: (String, Any)): Seq[(String, Any)] = formattedParams(tuple._1, tuple._2)
|
||||
|
||||
private def formattedParams(name: String, value: Any): Seq[(String, Any)] =
|
||||
value match {
|
||||
case arr: ArrayValues =>
|
||||
arr.format match {
|
||||
case CollectionFormats.MULTI =>
|
||||
arr.values.flatMap(formattedParams(name, _))
|
||||
case format: MergedArrayFormat =>
|
||||
Seq((name, arr.values.mkString(format.separator)))
|
||||
}
|
||||
case None => Seq.empty
|
||||
case Some(opt) => formattedParams(name, opt)
|
||||
case s: Seq[Any] => formattedParams(name, ArrayValues(s))
|
||||
case v: String => Seq((name, urlEncode(v)))
|
||||
case NumericValue(v) => Seq((name, urlEncode(v)))
|
||||
case f: File => Seq((name, f))
|
||||
case m: ApiModel => Seq((name, m))
|
||||
}
|
||||
private def formattedParams(name: String, value: Any): Seq[(String, Any)] = value match {
|
||||
case arr: ArrayValues =>
|
||||
arr.format match {
|
||||
case CollectionFormats.MULTI => arr.values.flatMap(formattedParams(name, _))
|
||||
case format: MergedArrayFormat => Seq((name, arr.values.mkString(format.separator)))
|
||||
}
|
||||
case None => Seq.empty
|
||||
case Some(opt) => formattedParams(name, opt)
|
||||
case s: Seq[Any] => formattedParams(name, ArrayValues(s))
|
||||
case v: String => Seq((name, urlEncode(v)))
|
||||
case NumericValue(v) => Seq((name, urlEncode(v)))
|
||||
case f: File => Seq((name, f))
|
||||
case m: ApiModel => Seq((name, m))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,24 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class ApiResponse(
|
||||
code: Option[Int] = None,
|
||||
`type`: Option[String] = None,
|
||||
message: Option[String] = None
|
||||
case class ApiResponse (
|
||||
code: Option[Int] = None,
|
||||
`type`: Option[String] = None,
|
||||
message: Option[String] = None
|
||||
) extends ApiModel
|
||||
|
||||
|
||||
|
@ -1,21 +1,23 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class Category(
|
||||
id: Option[Long] = None,
|
||||
name: Option[String] = None
|
||||
case class Category (
|
||||
id: Option[Long] = None,
|
||||
name: Option[String] = None
|
||||
) extends ApiModel
|
||||
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class Order(
|
||||
id: Option[Long] = None,
|
||||
petId: Option[Long] = None,
|
||||
quantity: Option[Int] = None,
|
||||
shipDate: Option[DateTime] = None,
|
||||
/* Order Status */
|
||||
status: Option[OrderEnums.Status] = None,
|
||||
complete: Option[Boolean] = None
|
||||
case class Order (
|
||||
id: Option[Long] = None,
|
||||
petId: Option[Long] = None,
|
||||
quantity: Option[Int] = None,
|
||||
shipDate: Option[DateTime] = None,
|
||||
/* Order Status */
|
||||
status: Option[OrderEnums.Status] = None,
|
||||
complete: Option[Boolean] = None
|
||||
) extends ApiModel
|
||||
|
||||
object OrderEnums {
|
||||
@ -35,3 +35,4 @@ object OrderEnums {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class Pet(
|
||||
id: Option[Long] = None,
|
||||
category: Option[Category] = None,
|
||||
name: String,
|
||||
photoUrls: Seq[String],
|
||||
tags: Option[Seq[Tag]] = None,
|
||||
/* pet status in the store */
|
||||
status: Option[PetEnums.Status] = None
|
||||
case class Pet (
|
||||
id: Option[Long] = None,
|
||||
category: Option[Category] = None,
|
||||
name: String,
|
||||
photoUrls: Seq[String],
|
||||
tags: Option[Seq[Tag]] = None,
|
||||
/* pet status in the store */
|
||||
status: Option[PetEnums.Status] = None
|
||||
) extends ApiModel
|
||||
|
||||
object PetEnums {
|
||||
@ -35,3 +35,4 @@ object PetEnums {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,23 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class Tag(
|
||||
id: Option[Long] = None,
|
||||
name: Option[String] = None
|
||||
case class Tag (
|
||||
id: Option[Long] = None,
|
||||
name: Option[String] = None
|
||||
) extends ApiModel
|
||||
|
||||
|
||||
|
@ -1,28 +1,30 @@
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
* OpenAPI Petstore
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.model
|
||||
|
||||
import org.openapitools.client.core.ApiModel
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
case class User(
|
||||
id: Option[Long] = None,
|
||||
username: Option[String] = None,
|
||||
firstName: Option[String] = None,
|
||||
lastName: Option[String] = None,
|
||||
email: Option[String] = None,
|
||||
password: Option[String] = None,
|
||||
phone: Option[String] = None,
|
||||
/* User Status */
|
||||
userStatus: Option[Int] = None
|
||||
case class User (
|
||||
id: Option[Long] = None,
|
||||
username: Option[String] = None,
|
||||
firstName: Option[String] = None,
|
||||
lastName: Option[String] = None,
|
||||
email: Option[String] = None,
|
||||
password: Option[String] = None,
|
||||
phone: Option[String] = None,
|
||||
/* User Status */
|
||||
userStatus: Option[Int] = None
|
||||
) extends ApiModel
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user