[dart][dart-dio] Formatting improvements (#8180)

* always add trailing commas in arrays and break each line
* make variables final
* improve API formatting (mainly leading spaces)
* remove empty lines and whitespaces
* fix formatting of datatype and description and docs
* consistently use single quotation marks (dart already does this)
This commit is contained in:
Peter Leibiger 2020-12-15 02:55:33 +01:00 committed by GitHub
parent d1eda02be6
commit f484e0db42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 2756 additions and 2263 deletions

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -17,15 +16,21 @@ class {{classname}} {
{{classname}}(this._dio, this._serializers);
{{#operation}}
/// {{summary}}
/// {{{summary}}}
///
/// {{notes}}
Future<Response{{#returnType}}<{{{returnType}}}>{{/returnType}}>{{nickname}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}},{{/required}}{{/allParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}},{{/required}}{{/allParams}}CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// {{{notes}}}
Future<Response{{#returnType}}<{{{returnType}}}>{{/returnType}}>{{nickname}}({{^hasRequiredParams}}{ {{/hasRequiredParams}}{{#requiredParams}}
{{{dataType}}} {{paramName}},{{#-last}} { {{/-last}}{{/requiredParams}}{{#optionalParams}}
{{{dataType}}} {{paramName}},{{/optionalParams}}
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{baseName}}' '}', {{{paramName}}}.toString()){{/pathParams}};
String _path = "{{{path}}}"{{#pathParams}}.replaceAll("{" r'{{baseName}}' "}", {{{paramName}}}.toString()){{/pathParams}};
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
{{#headerParams}}
@ -37,9 +42,11 @@ class {{classname}} {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [{{#consumes}}"{{{mediaType}}}"{{^-last}},{{/-last}}{{/consumes}}];
final List<String> contentTypes = [{{^hasConsumes}}];{{/hasConsumes}}{{#hasConsumes}}{{#consumes}}
'{{{mediaType}}}',{{/consumes}}
];{{/hasConsumes}}
{{#hasFormParams}}
final Map<String, dynamic> formData = {};
{{#isMultipart}}
{{#formParams}}
@ -63,8 +70,8 @@ class {{classname}} {
bodyData = formData;
{{/isMultipart}}
{{/hasFormParams}}
{{#bodyParam}}
{{#isArray}}
const type = FullType(BuiltList, [FullType({{baseType}})]);
final serializedBody = _serializers.serialize({{paramName}}, specifiedType: type);
@ -87,15 +94,21 @@ class {{classname}} {
{{/isResponseFile}}
headers: headerParams,
extra: {
'secure': [{{#authMethods}} {"type": "{{type}}", "name": "{{name}}"{{#isApiKey}}, "keyName": "{{keyParamName}}", "where": "{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}"{{/isApiKey}} }{{^-last}}, {{/-last}}{{/authMethods}}],
'secure': [{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}}
{{#authMethods}}{
'type': '{{type}}',
'name': '{{name}}',{{#isApiKey}}
'keyName': '{{keyParamName}}',
'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}}
},{{/authMethods}}
],{{/hasAuthMethods}}
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
){{#returnType}}.then((response) {
{{#isResponseFile}}
final data = response.data;
{{/isResponseFile}}
@ -127,6 +140,7 @@ class {{classname}} {
);
}){{/returnType}};
}
{{/operation}}
}
{{/operations}}

View File

@ -47,7 +47,7 @@ import 'package:{{pubName}}/api.dart';
var api_instance = new {{classname}}();
{{#allParams}}
var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{{dataType}}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
@ -56,7 +56,7 @@ try {
print(result);
{{/returnType}}
} catch (e) {
print("Exception when calling {{classname}}->{{operationId}}: $e\n");
print('Exception when calling {{classname}}->{{operationId}}: $e\n');
}
```
@ -64,7 +64,7 @@ try {
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{baseType}}.md){{/isPrimitiveType}}| {{{description}}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}
{{/allParams}}
### Return type

View File

@ -15,7 +15,7 @@ class {{clientName}} {
Dio dio;
Serializers serializers;
String basePath = "{{{basePath}}}";
String basePath = '{{{basePath}}}';
{{clientName}}({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
if (dio == null) {

View File

@ -6,17 +6,19 @@ part '{{classFilename}}.g.dart';
abstract class {{classname}} implements Built<{{classname}}, {{classname}}Builder> {
{{#vars}}
{{#description}}/* {{{description}}} */{{/description}}
{{#description}}
/// {{{description}}}
{{/description}}
{{#isNullable}}
@nullable
{{/isNullable}}
@BuiltValueField(wireName: r'{{baseName}}')
{{{datatypeWithEnum}}} get {{name}};
{{#allowableValues}}
{{#min}}// range from {{min}} to {{max}}{{/min}}//{{^min}} enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}
// {{#min}}range from {{{min}}} to {{{max}}}{{/min}}{{^min}}enum {{name}}Enum { {{#values}} {{{.}}}, {{/values}} };{{/min}}
{{/allowableValues}}
{{/vars}}
{{/vars}}
// Boilerplate code needed to wire-up generated code
{{classname}}._();

View File

@ -7,7 +7,7 @@ class OffsetDateSerializer implements PrimitiveSerializer<OffsetDate> {
Iterable<Type> get types => BuiltList<Type>([OffsetDate]);
@override
String get wireName => "OffsetDate";
String get wireName => 'OffsetDate';
@override
OffsetDate deserialize(Serializers serializers, Object serialized,
@ -28,7 +28,7 @@ class OffsetDateTimeSerializer implements PrimitiveSerializer<OffsetDateTime> {
Iterable<Type> get types => BuiltList<Type>([OffsetDateTime]);
@override
String get wireName => "OffsetDateTime";
String get wireName => 'OffsetDateTime';
@override
OffsetDateTime deserialize(Serializers serializers, Object serialized,

View File

@ -8,7 +8,7 @@ import 'package:{{pubName}}/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{{description}}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -7,7 +7,9 @@ class {{{classname}}} {
});
{{#vars}}
{{#description}}/// {{{description}}}{{/description}}
{{#description}}
/// {{{description}}}
{{/description}}
{{^isEnum}}
{{#minimum}}
// minimum: {{{minimum}}}

View File

@ -11,8 +11,8 @@ Name | Type | Description | Notes
**id** | **int** | | [optional] [default to null]
**category** | [**Category**](Category.md) | | [optional] [default to null]
**name** | **String** | | [default to null]
**photoUrls** | **BuiltList&lt;String&gt;** | | [default to const []]
**tags** | [**BuiltList&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**photoUrls** | **BuiltList<String>** | | [default to const []]
**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -36,7 +36,7 @@ var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
print('Exception when calling PetApi->addPet: $e\n');
}
```
@ -79,7 +79,7 @@ var apiKey = apiKey_example; // String |
try {
api_instance.deletePet(petId, apiKey);
} catch (e) {
print("Exception when calling PetApi->deletePet: $e\n");
print('Exception when calling PetApi->deletePet: $e\n');
}
```
@ -125,7 +125,7 @@ try {
var result = api_instance.findPetsByStatus(status);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByStatus: $e\n");
print('Exception when calling PetApi->findPetsByStatus: $e\n');
}
```
@ -133,7 +133,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**BuiltList&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
**status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type
@ -170,7 +170,7 @@ try {
var result = api_instance.findPetsByTags(tags);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByTags: $e\n");
print('Exception when calling PetApi->findPetsByTags: $e\n');
}
```
@ -178,7 +178,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**BuiltList&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
**tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []]
### Return type
@ -217,7 +217,7 @@ try {
var result = api_instance.getPetById(petId);
print(result);
} catch (e) {
print("Exception when calling PetApi->getPetById: $e\n");
print('Exception when calling PetApi->getPetById: $e\n');
}
```
@ -259,7 +259,7 @@ var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(body);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
print('Exception when calling PetApi->updatePet: $e\n');
}
```
@ -303,7 +303,7 @@ var status = status_example; // String | Updated status of the pet
try {
api_instance.updatePetWithForm(petId, name, status);
} catch (e) {
print("Exception when calling PetApi->updatePetWithForm: $e\n");
print('Exception when calling PetApi->updatePetWithForm: $e\n');
}
```
@ -350,7 +350,7 @@ try {
var result = api_instance.uploadFile(petId, additionalMetadata, file);
print(result);
} catch (e) {
print("Exception when calling PetApi->uploadFile: $e\n");
print('Exception when calling PetApi->uploadFile: $e\n');
}
```

View File

@ -32,7 +32,7 @@ var orderId = orderId_example; // String | ID of the order that needs to be dele
try {
api_instance.deleteOrder(orderId);
} catch (e) {
print("Exception when calling StoreApi->deleteOrder: $e\n");
print('Exception when calling StoreApi->deleteOrder: $e\n');
}
```
@ -78,7 +78,7 @@ try {
var result = api_instance.getInventory();
print(result);
} catch (e) {
print("Exception when calling StoreApi->getInventory: $e\n");
print('Exception when calling StoreApi->getInventory: $e\n');
}
```
@ -118,7 +118,7 @@ try {
var result = api_instance.getOrderById(orderId);
print(result);
} catch (e) {
print("Exception when calling StoreApi->getOrderById: $e\n");
print('Exception when calling StoreApi->getOrderById: $e\n');
}
```
@ -159,7 +159,7 @@ try {
var result = api_instance.placeOrder(body);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
print('Exception when calling StoreApi->placeOrder: $e\n');
}
```

View File

@ -36,7 +36,7 @@ var body = new User(); // User | Created user object
try {
api_instance.createUser(body);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
print('Exception when calling UserApi->createUser: $e\n');
}
```
@ -71,12 +71,12 @@ Creates list of users with given input array
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var body = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var body = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithArrayInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
print('Exception when calling UserApi->createUsersWithArrayInput: $e\n');
}
```
@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**body** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -111,12 +111,12 @@ Creates list of users with given input array
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var body = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var body = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithListInput(body);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
print('Exception when calling UserApi->createUsersWithListInput: $e\n');
}
```
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**body** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -158,7 +158,7 @@ var username = username_example; // String | The name that needs to be deleted
try {
api_instance.deleteUser(username);
} catch (e) {
print("Exception when calling UserApi->deleteUser: $e\n");
print('Exception when calling UserApi->deleteUser: $e\n');
}
```
@ -199,7 +199,7 @@ try {
var result = api_instance.getUserByName(username);
print(result);
} catch (e) {
print("Exception when calling UserApi->getUserByName: $e\n");
print('Exception when calling UserApi->getUserByName: $e\n');
}
```
@ -241,7 +241,7 @@ try {
var result = api_instance.loginUser(username, password);
print(result);
} catch (e) {
print("Exception when calling UserApi->loginUser: $e\n");
print('Exception when calling UserApi->loginUser: $e\n');
}
```
@ -281,7 +281,7 @@ var api_instance = new UserApi();
try {
api_instance.logoutUser();
} catch (e) {
print("Exception when calling UserApi->logoutUser: $e\n");
print('Exception when calling UserApi->logoutUser: $e\n');
}
```
@ -321,7 +321,7 @@ var body = new User(); // User | Updated user object
try {
api_instance.updateUser(username, body);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
print('Exception when calling UserApi->updateUser: $e\n');
}
```

View File

@ -17,7 +17,7 @@ class Openapi {
Dio dio;
Serializers serializers;
String basePath = "http://petstore.swagger.io/v2";
String basePath = 'http://petstore.swagger.io/v2';
Openapi({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
if (dio == null) {

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -19,19 +18,26 @@ class PetApi {
/// Add a new pet to the store
///
///
Future<Response>addPet(Pet body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>addPet(
Pet body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -45,33 +51,43 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Deletes a pet
///
///
Future<Response>deletePet(int petId,{ String apiKey,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deletePet(
int petId, {
String apiKey,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'api_key'] = apiKey;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -81,33 +97,42 @@ class PetApi {
method: 'delete'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Finds Pets by status
///
/// Multiple status values can be provided with comma separated strings
Future<Response<BuiltList<Pet>>>findPetsByStatus(BuiltList<String> status,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByStatus(
BuiltList<String> status, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByStatus';
String _path = "/pet/findByStatus";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'status'] = status;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -117,15 +142,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -141,24 +170,28 @@ class PetApi {
);
});
}
/// Finds Pets by tags
///
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Future<Response<BuiltList<Pet>>>findPetsByTags(BuiltList<String> tags,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByTags(
BuiltList<String> tags, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByTags';
String _path = "/pet/findByTags";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'tags'] = tags;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -168,15 +201,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -192,23 +229,27 @@ class PetApi {
);
});
}
/// Find pet by ID
///
/// Returns a single pet
Future<Response<Pet>>getPetById(int petId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Pet>>getPetById(
int petId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -218,15 +259,21 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Pet);
final data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -241,22 +288,30 @@ class PetApi {
);
});
}
/// Update an existing pet
///
///
Future<Response>updatePet(Pet body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updatePet(
Pet body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -270,37 +325,51 @@ class PetApi {
method: 'put'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Updates a pet in the store with form data
///
///
Future<Response>updatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updatePetWithForm(
int petId, {
String name,
String status,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['name'] = parameterToString(_serializers, name);
formData['status'] = parameterToString(_serializers, status);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -309,30 +378,45 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// uploads an image
///
///
Future<Response<ApiResponse>>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<ApiResponse>>uploadFile(
int petId, {
String additionalMetadata,
Uint8List file,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}/uploadImage".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["multipart/form-data"];
final List<String> contentTypes = [
'multipart/form-data',
];
final Map<String, dynamic> formData = {};
if (additionalMetadata != null) {
@ -343,7 +427,6 @@ class PetApi {
}
bodyData = FormData.fromMap(formData);
return _dio.request(
_path,
queryParameters: queryParams,
@ -352,15 +435,19 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(ApiResponse);
final data = _serializers.deserializeWith<ApiResponse>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -375,4 +462,5 @@ class PetApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,21 +14,24 @@ class StoreApi {
/// Delete purchase order by ID
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(String orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(
String orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString());
String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -41,30 +43,33 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Returns pet inventories by status
///
/// Returns a map of status codes to quantities
Future<Response<BuiltMap<String, int>>>getInventory({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltMap<String, int>>>getInventory({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/inventory';
String _path = "/store/inventory";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -74,15 +79,21 @@ class StoreApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltMap;
const type = FullType(collectionType, [FullType(String), FullType(int)]);
final BuiltMap<String, int> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -98,23 +109,27 @@ class StoreApi {
);
});
}
/// Find purchase order by ID
///
/// For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(int orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(
int orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString());
String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -126,13 +141,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -147,22 +161,27 @@ class StoreApi {
);
});
}
/// Place an order for a pet
///
///
Future<Response<Order>>placeOrder(Order body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Order>>placeOrder(
Order body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order';
String _path = "/store/order";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -178,13 +197,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -199,4 +217,5 @@ class StoreApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -16,19 +15,23 @@ class UserApi {
/// Create user
///
/// This can only be done by the logged in user.
Future<Response>createUser(User body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUser(
User body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user';
String _path = "/user";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -44,29 +47,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithArrayInput(BuiltList<User> body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithArrayInput(
BuiltList<User> body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithArray';
String _path = "/user/createWithArray";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(body, specifiedType: type);
@ -83,29 +91,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithListInput(BuiltList<User> body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithListInput(
BuiltList<User> body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithList';
String _path = "/user/createWithList";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(body, specifiedType: type);
@ -122,30 +135,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Delete user
///
/// This can only be done by the logged in user.
Future<Response>deleteUser(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deleteUser(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -157,30 +174,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Get user by user name
///
///
Future<Response<User>>getUserByName(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<User>>getUserByName(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -192,13 +213,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(User);
final data = _serializers.deserializeWith<User>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -213,15 +233,22 @@ class UserApi {
);
});
}
/// Logs user into the system
///
///
Future<Response<String>>loginUser(String username,String password,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<String>>loginUser(
String username,
String password, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/login';
String _path = "/user/login";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'username'] = username;
@ -229,9 +256,7 @@ class UserApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -243,13 +268,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as String;
return Response<String>(
@ -263,23 +287,26 @@ class UserApi {
);
});
}
/// Logs out current logged in user session
///
///
Future<Response>logoutUser({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>logoutUser({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/logout';
String _path = "/user/logout";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -291,29 +318,35 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Updated user
///
/// This can only be done by the logged in user.
Future<Response>updateUser(String username,User body,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updateUser(
String username,
User body, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -329,11 +362,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
}

View File

@ -5,7 +5,6 @@ part 'api_response.g.dart';
abstract class ApiResponse implements Built<ApiResponse, ApiResponseBuilder> {
@nullable
@BuiltValueField(wireName: r'code')
int get code;

View File

@ -5,7 +5,6 @@ part 'category.g.dart';
abstract class Category implements Built<Category, CategoryBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;

View File

@ -6,7 +6,6 @@ part 'order.g.dart';
abstract class Order implements Built<Order, OrderBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -22,7 +21,8 @@ abstract class Order implements Built<Order, OrderBuilder> {
@nullable
@BuiltValueField(wireName: r'shipDate')
DateTime get shipDate;
/* Order Status */
/// Order Status
@nullable
@BuiltValueField(wireName: r'status')
OrderStatusEnum get status;

View File

@ -8,7 +8,6 @@ part 'pet.g.dart';
abstract class Pet implements Built<Pet, PetBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -28,7 +27,8 @@ abstract class Pet implements Built<Pet, PetBuilder> {
@nullable
@BuiltValueField(wireName: r'tags')
BuiltList<Tag> get tags;
/* pet status in the store */
/// pet status in the store
@nullable
@BuiltValueField(wireName: r'status')
PetStatusEnum get status;

View File

@ -5,7 +5,6 @@ part 'tag.g.dart';
abstract class Tag implements Built<Tag, TagBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;

View File

@ -5,7 +5,6 @@ part 'user.g.dart';
abstract class User implements Built<User, UserBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -33,7 +32,8 @@ abstract class User implements Built<User, UserBuilder> {
@nullable
@BuiltValueField(wireName: r'phone')
String get phone;
/* User Status */
/// User Status
@nullable
@BuiltValueField(wireName: r'userStatus')
int get userStatus;

View File

@ -17,13 +17,10 @@ class ApiResponse {
this.message,
});
int code;
String type;
String message;
@override

View File

@ -16,10 +16,8 @@ class Category {
this.name,
});
int id;
String name;
@override

View File

@ -20,22 +20,17 @@ class Order {
this.complete = false,
});
int id;
int petId;
int quantity;
DateTime shipDate;
/// Order Status
OrderStatusEnum status;
bool complete;
@override

View File

@ -20,19 +20,14 @@ class Pet {
this.status,
});
int id;
Category category;
String name;
List<String> photoUrls;
List<Tag> tags;
/// pet status in the store

View File

@ -16,10 +16,8 @@ class Tag {
this.name,
});
int id;
String name;
@override

View File

@ -22,25 +22,18 @@ class User {
this.userStatus,
});
int id;
String username;
String firstName;
String lastName;
String email;
String password;
String phone;
/// User Status

View File

@ -11,8 +11,8 @@ Name | Type | Description | Notes
**id** | **int** | | [optional] [default to null]
**category** | [**Category**](Category.md) | | [optional] [default to null]
**name** | **String** | | [default to null]
**photoUrls** | **BuiltList&lt;String&gt;** | | [default to const []]
**tags** | [**BuiltList&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**photoUrls** | **BuiltList<String>** | | [default to const []]
**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -37,7 +37,7 @@ try {
var result = api_instance.addPet(pet);
print(result);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
print('Exception when calling PetApi->addPet: $e\n');
}
```
@ -80,7 +80,7 @@ var apiKey = apiKey_example; // String |
try {
api_instance.deletePet(petId, apiKey);
} catch (e) {
print("Exception when calling PetApi->deletePet: $e\n");
print('Exception when calling PetApi->deletePet: $e\n');
}
```
@ -126,7 +126,7 @@ try {
var result = api_instance.findPetsByStatus(status);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByStatus: $e\n");
print('Exception when calling PetApi->findPetsByStatus: $e\n');
}
```
@ -134,7 +134,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**BuiltList&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
**status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type
@ -171,7 +171,7 @@ try {
var result = api_instance.findPetsByTags(tags);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByTags: $e\n");
print('Exception when calling PetApi->findPetsByTags: $e\n');
}
```
@ -179,7 +179,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**BuiltList&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
**tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []]
### Return type
@ -218,7 +218,7 @@ try {
var result = api_instance.getPetById(petId);
print(result);
} catch (e) {
print("Exception when calling PetApi->getPetById: $e\n");
print('Exception when calling PetApi->getPetById: $e\n');
}
```
@ -261,7 +261,7 @@ try {
var result = api_instance.updatePet(pet);
print(result);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
print('Exception when calling PetApi->updatePet: $e\n');
}
```
@ -305,7 +305,7 @@ var status = status_example; // String | Updated status of the pet
try {
api_instance.updatePetWithForm(petId, name, status);
} catch (e) {
print("Exception when calling PetApi->updatePetWithForm: $e\n");
print('Exception when calling PetApi->updatePetWithForm: $e\n');
}
```
@ -352,7 +352,7 @@ try {
var result = api_instance.uploadFile(petId, additionalMetadata, file);
print(result);
} catch (e) {
print("Exception when calling PetApi->uploadFile: $e\n");
print('Exception when calling PetApi->uploadFile: $e\n');
}
```

View File

@ -32,7 +32,7 @@ var orderId = orderId_example; // String | ID of the order that needs to be dele
try {
api_instance.deleteOrder(orderId);
} catch (e) {
print("Exception when calling StoreApi->deleteOrder: $e\n");
print('Exception when calling StoreApi->deleteOrder: $e\n');
}
```
@ -78,7 +78,7 @@ try {
var result = api_instance.getInventory();
print(result);
} catch (e) {
print("Exception when calling StoreApi->getInventory: $e\n");
print('Exception when calling StoreApi->getInventory: $e\n');
}
```
@ -118,7 +118,7 @@ try {
var result = api_instance.getOrderById(orderId);
print(result);
} catch (e) {
print("Exception when calling StoreApi->getOrderById: $e\n");
print('Exception when calling StoreApi->getOrderById: $e\n');
}
```
@ -159,7 +159,7 @@ try {
var result = api_instance.placeOrder(order);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
print('Exception when calling StoreApi->placeOrder: $e\n');
}
```

View File

@ -40,7 +40,7 @@ var user = new User(); // User | Created user object
try {
api_instance.createUser(user);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
print('Exception when calling UserApi->createUser: $e\n');
}
```
@ -79,12 +79,12 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
var api_instance = new UserApi();
var user = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var user = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithArrayInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
print('Exception when calling UserApi->createUsersWithArrayInput: $e\n');
}
```
@ -92,7 +92,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**user** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -123,12 +123,12 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
var api_instance = new UserApi();
var user = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var user = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithListInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
print('Exception when calling UserApi->createUsersWithListInput: $e\n');
}
```
@ -136,7 +136,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**user** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -174,7 +174,7 @@ var username = username_example; // String | The name that needs to be deleted
try {
api_instance.deleteUser(username);
} catch (e) {
print("Exception when calling UserApi->deleteUser: $e\n");
print('Exception when calling UserApi->deleteUser: $e\n');
}
```
@ -215,7 +215,7 @@ try {
var result = api_instance.getUserByName(username);
print(result);
} catch (e) {
print("Exception when calling UserApi->getUserByName: $e\n");
print('Exception when calling UserApi->getUserByName: $e\n');
}
```
@ -257,7 +257,7 @@ try {
var result = api_instance.loginUser(username, password);
print(result);
} catch (e) {
print("Exception when calling UserApi->loginUser: $e\n");
print('Exception when calling UserApi->loginUser: $e\n');
}
```
@ -301,7 +301,7 @@ var api_instance = new UserApi();
try {
api_instance.logoutUser();
} catch (e) {
print("Exception when calling UserApi->logoutUser: $e\n");
print('Exception when calling UserApi->logoutUser: $e\n');
}
```
@ -345,7 +345,7 @@ var user = new User(); // User | Updated user object
try {
api_instance.updateUser(username, user);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
print('Exception when calling UserApi->updateUser: $e\n');
}
```

View File

@ -17,7 +17,7 @@ class Openapi {
Dio dio;
Serializers serializers;
String basePath = "http://petstore.swagger.io/v2";
String basePath = 'http://petstore.swagger.io/v2';
Openapi({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
if (dio == null) {

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -19,19 +18,26 @@ class PetApi {
/// Add a new pet to the store
///
///
Future<Response<Pet>>addPet(Pet pet,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Pet>>addPet(
Pet pet, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(pet);
final jsonpet = json.encode(serializedBody);
@ -45,15 +51,19 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Pet);
final data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -68,24 +78,29 @@ class PetApi {
);
});
}
/// Deletes a pet
///
///
Future<Response>deletePet(int petId,{ String apiKey,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deletePet(
int petId, {
String apiKey,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'api_key'] = apiKey;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -95,33 +110,42 @@ class PetApi {
method: 'delete'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Finds Pets by status
///
/// Multiple status values can be provided with comma separated strings
Future<Response<BuiltList<Pet>>>findPetsByStatus(BuiltList<String> status,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByStatus(
BuiltList<String> status, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByStatus';
String _path = "/pet/findByStatus";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'status'] = status;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -131,15 +155,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -155,24 +183,28 @@ class PetApi {
);
});
}
/// Finds Pets by tags
///
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Future<Response<BuiltList<Pet>>>findPetsByTags(BuiltList<String> tags,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByTags(
BuiltList<String> tags, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByTags';
String _path = "/pet/findByTags";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'tags'] = tags;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -182,15 +214,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -206,23 +242,27 @@ class PetApi {
);
});
}
/// Find pet by ID
///
/// Returns a single pet
Future<Response<Pet>>getPetById(int petId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Pet>>getPetById(
int petId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -232,15 +272,21 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Pet);
final data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -255,22 +301,30 @@ class PetApi {
);
});
}
/// Update an existing pet
///
///
Future<Response<Pet>>updatePet(Pet pet,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Pet>>updatePet(
Pet pet, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(pet);
final jsonpet = json.encode(serializedBody);
@ -284,15 +338,19 @@ class PetApi {
method: 'put'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Pet);
final data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -307,28 +365,37 @@ class PetApi {
);
});
}
/// Updates a pet in the store with form data
///
///
Future<Response>updatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updatePetWithForm(
int petId, {
String name,
String status,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['name'] = parameterToString(_serializers, name);
formData['status'] = parameterToString(_serializers, status);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -337,30 +404,45 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// uploads an image
///
///
Future<Response<ApiResponse>>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<ApiResponse>>uploadFile(
int petId, {
String additionalMetadata,
Uint8List file,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}/uploadImage".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["multipart/form-data"];
final List<String> contentTypes = [
'multipart/form-data',
];
final Map<String, dynamic> formData = {};
if (additionalMetadata != null) {
@ -371,7 +453,6 @@ class PetApi {
}
bodyData = FormData.fromMap(formData);
return _dio.request(
_path,
queryParameters: queryParams,
@ -380,15 +461,19 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(ApiResponse);
final data = _serializers.deserializeWith<ApiResponse>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -403,4 +488,5 @@ class PetApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,21 +14,24 @@ class StoreApi {
/// Delete purchase order by ID
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(String orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(
String orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString());
String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -41,30 +43,33 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Returns pet inventories by status
///
/// Returns a map of status codes to quantities
Future<Response<BuiltMap<String, int>>>getInventory({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltMap<String, int>>>getInventory({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/inventory';
String _path = "/store/inventory";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -74,15 +79,21 @@ class StoreApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltMap;
const type = FullType(collectionType, [FullType(String), FullType(int)]);
final BuiltMap<String, int> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -98,23 +109,27 @@ class StoreApi {
);
});
}
/// Find purchase order by ID
///
/// For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(int orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(
int orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{orderId}'.replaceAll('{' r'orderId' '}', orderId.toString());
String _path = "/store/order/{orderId}".replaceAll("{" r'orderId' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -126,13 +141,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -147,22 +161,29 @@ class StoreApi {
);
});
}
/// Place an order for a pet
///
///
Future<Response<Order>>placeOrder(Order order,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Order>>placeOrder(
Order order, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order';
String _path = "/store/order";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(order);
final jsonorder = json.encode(serializedBody);
@ -178,13 +199,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -199,4 +219,5 @@ class StoreApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -16,19 +15,25 @@ class UserApi {
/// Create user
///
/// This can only be done by the logged in user.
Future<Response>createUser(User user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUser(
User user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user';
String _path = "/user";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(user);
final jsonuser = json.encode(serializedBody);
@ -42,31 +47,45 @@ class UserApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithArrayInput(BuiltList<User> user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithArrayInput(
BuiltList<User> user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithArray';
String _path = "/user/createWithArray";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(user, specifiedType: type);
@ -81,31 +100,45 @@ class UserApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithListInput(BuiltList<User> user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithListInput(
BuiltList<User> user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithList';
String _path = "/user/createWithList";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(user, specifiedType: type);
@ -120,32 +153,43 @@ class UserApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Delete user
///
/// This can only be done by the logged in user.
Future<Response>deleteUser(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deleteUser(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -155,32 +199,43 @@ class UserApi {
method: 'delete'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Get user by user name
///
///
Future<Response<User>>getUserByName(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<User>>getUserByName(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -192,13 +247,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(User);
final data = _serializers.deserializeWith<User>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -213,15 +267,22 @@ class UserApi {
);
});
}
/// Logs user into the system
///
///
Future<Response<String>>loginUser(String username,String password,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<String>>loginUser(
String username,
String password, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/login';
String _path = "/user/login";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'username'] = username;
@ -229,9 +290,7 @@ class UserApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -243,13 +302,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as String;
return Response<String>(
@ -263,23 +321,26 @@ class UserApi {
);
});
}
/// Logs out current logged in user session
///
///
Future<Response>logoutUser({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>logoutUser({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/logout';
String _path = "/user/logout";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -289,31 +350,46 @@ class UserApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Updated user
///
/// This can only be done by the logged in user.
Future<Response>updateUser(String username,User user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updateUser(
String username,
User user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(user);
final jsonuser = json.encode(serializedBody);
@ -327,13 +403,21 @@ class UserApi {
method: 'put'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
}

View File

@ -5,7 +5,6 @@ part 'api_response.g.dart';
abstract class ApiResponse implements Built<ApiResponse, ApiResponseBuilder> {
@nullable
@BuiltValueField(wireName: r'code')
int get code;

View File

@ -5,7 +5,6 @@ part 'category.g.dart';
abstract class Category implements Built<Category, CategoryBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;

View File

@ -5,11 +5,12 @@ part 'inline_object.g.dart';
abstract class InlineObject implements Built<InlineObject, InlineObjectBuilder> {
/* Updated name of the pet */
/// Updated name of the pet
@nullable
@BuiltValueField(wireName: r'name')
String get name;
/* Updated status of the pet */
/// Updated status of the pet
@nullable
@BuiltValueField(wireName: r'status')
String get status;

View File

@ -6,11 +6,12 @@ part 'inline_object1.g.dart';
abstract class InlineObject1 implements Built<InlineObject1, InlineObject1Builder> {
/* Additional data to pass to server */
/// Additional data to pass to server
@nullable
@BuiltValueField(wireName: r'additionalMetadata')
String get additionalMetadata;
/* file to upload */
/// file to upload
@nullable
@BuiltValueField(wireName: r'file')
Uint8List get file;

View File

@ -6,7 +6,6 @@ part 'order.g.dart';
abstract class Order implements Built<Order, OrderBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -22,7 +21,8 @@ abstract class Order implements Built<Order, OrderBuilder> {
@nullable
@BuiltValueField(wireName: r'shipDate')
DateTime get shipDate;
/* Order Status */
/// Order Status
@nullable
@BuiltValueField(wireName: r'status')
OrderStatusEnum get status;

View File

@ -8,7 +8,6 @@ part 'pet.g.dart';
abstract class Pet implements Built<Pet, PetBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -28,7 +27,8 @@ abstract class Pet implements Built<Pet, PetBuilder> {
@nullable
@BuiltValueField(wireName: r'tags')
BuiltList<Tag> get tags;
/* pet status in the store */
/// pet status in the store
@nullable
@BuiltValueField(wireName: r'status')
PetStatusEnum get status;

View File

@ -5,7 +5,6 @@ part 'tag.g.dart';
abstract class Tag implements Built<Tag, TagBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;

View File

@ -5,7 +5,6 @@ part 'user.g.dart';
abstract class User implements Built<User, UserBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;
@ -33,7 +32,8 @@ abstract class User implements Built<User, UserBuilder> {
@nullable
@BuiltValueField(wireName: r'phone')
String get phone;
/* User Status */
/// User Status
@nullable
@BuiltValueField(wireName: r'userStatus')
int get userStatus;

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapProperty** | **BuiltMap&lt;String, String&gt;** | | [optional] [default to const {}]
**mapOfMapProperty** | [**BuiltMap&lt;String, BuiltMap&lt;String, String&gt;&gt;**](BuiltMap.md) | | [optional] [default to const {}]
**mapProperty** | **BuiltMap<String, String>** | | [optional] [default to const {}]
**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] [default to const {}]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -30,7 +30,7 @@ try {
var result = api_instance.call123testSpecialTags(client);
print(result);
} catch (e) {
print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n");
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
}
```

View File

@ -8,7 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayArrayNumber** | [**BuiltList&lt;BuiltList&lt;num&gt;&gt;**](BuiltList.md) | | [optional] [default to const []]
**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](BuiltList.md) | | [optional] [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -8,7 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayNumber** | **BuiltList&lt;num&gt;** | | [optional] [default to const []]
**arrayNumber** | **BuiltList<num>** | | [optional] [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -8,9 +8,9 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayOfString** | **BuiltList&lt;String&gt;** | | [optional] [default to const []]
**arrayArrayOfInteger** | [**BuiltList&lt;BuiltList&lt;int&gt;&gt;**](BuiltList.md) | | [optional] [default to const []]
**arrayArrayOfModel** | [**BuiltList&lt;BuiltList&lt;ReadOnlyFirst&gt;&gt;**](BuiltList.md) | | [optional] [default to const []]
**arrayOfString** | **BuiltList<String>** | | [optional] [default to const []]
**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] [default to const []]
**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](BuiltList.md) | | [optional] [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -27,7 +27,7 @@ try {
var result = api_instance.fooGet();
print(result);
} catch (e) {
print("Exception when calling DefaultApi->fooGet: $e\n");
print('Exception when calling DefaultApi->fooGet: $e\n');
}
```

View File

@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**justSymbol** | **String** | | [optional] [default to null]
**arrayEnum** | **BuiltList&lt;String&gt;** | | [optional] [default to const []]
**arrayEnum** | **BuiltList<String>** | | [optional] [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -41,7 +41,7 @@ try {
var result = api_instance.fakeHealthGet();
print(result);
} catch (e) {
print("Exception when calling FakeApi->fakeHealthGet: $e\n");
print('Exception when calling FakeApi->fakeHealthGet: $e\n');
}
```
@ -83,7 +83,7 @@ var header1 = header1_example; // String | header parameter
try {
api_instance.fakeHttpSignatureTest(pet, query1, header1);
} catch (e) {
print("Exception when calling FakeApi->fakeHttpSignatureTest: $e\n");
print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n');
}
```
@ -128,7 +128,7 @@ try {
var result = api_instance.fakeOuterBooleanSerialize(body);
print(result);
} catch (e) {
print("Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n");
print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n');
}
```
@ -171,7 +171,7 @@ try {
var result = api_instance.fakeOuterCompositeSerialize(outerComposite);
print(result);
} catch (e) {
print("Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n");
print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n');
}
```
@ -214,7 +214,7 @@ try {
var result = api_instance.fakeOuterNumberSerialize(body);
print(result);
} catch (e) {
print("Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n");
print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n');
}
```
@ -257,7 +257,7 @@ try {
var result = api_instance.fakeOuterStringSerialize(body);
print(result);
} catch (e) {
print("Exception when calling FakeApi->fakeOuterStringSerialize: $e\n");
print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n');
}
```
@ -299,7 +299,7 @@ var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass |
try {
api_instance.testBodyWithFileSchema(fileSchemaTestClass);
} catch (e) {
print("Exception when calling FakeApi->testBodyWithFileSchema: $e\n");
print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n');
}
```
@ -340,7 +340,7 @@ var user = new User(); // User |
try {
api_instance.testBodyWithQueryParams(query, user);
} catch (e) {
print("Exception when calling FakeApi->testBodyWithQueryParams: $e\n");
print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n');
}
```
@ -384,7 +384,7 @@ try {
var result = api_instance.testClientModel(client);
print(result);
} catch (e) {
print("Exception when calling FakeApi->testClientModel: $e\n");
print('Exception when calling FakeApi->testClientModel: $e\n');
}
```
@ -442,7 +442,7 @@ var callback = callback_example; // String | None
try {
api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback);
} catch (e) {
print("Exception when calling FakeApi->testEndpointParameters: $e\n");
print('Exception when calling FakeApi->testEndpointParameters: $e\n');
}
```
@ -504,7 +504,7 @@ var enumFormString = enumFormString_example; // String | Form parameter enum tes
try {
api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
} catch (e) {
print("Exception when calling FakeApi->testEnumParameters: $e\n");
print('Exception when calling FakeApi->testEnumParameters: $e\n');
}
```
@ -512,14 +512,14 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumHeaderStringArray** | [**BuiltList&lt;String&gt;**](String.md)| Header parameter enum test (string array) | [optional] [default to const []]
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
**enumQueryStringArray** | [**BuiltList&lt;String&gt;**](String.md)| Query parameter enum test (string array) | [optional] [default to const []]
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
**enumHeaderStringArray** | [**BuiltList<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to const []]
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg']
**enumQueryStringArray** | [**BuiltList<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to const []]
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg']
**enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] [default to null]
**enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] [default to null]
**enumFormStringArray** | [**BuiltList&lt;String&gt;**](String.md)| Form parameter enum test (string array) | [optional] [default to &#39;$&#39;]
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
**enumFormStringArray** | [**BuiltList<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$']
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg']
### Return type
@ -561,7 +561,7 @@ var int64Group = 789; // int | Integer in group parameters
try {
api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
} catch (e) {
print("Exception when calling FakeApi->testGroupParameters: $e\n");
print('Exception when calling FakeApi->testGroupParameters: $e\n');
}
```
@ -601,12 +601,12 @@ test inline additionalProperties
import 'package:openapi/api.dart';
var api_instance = new FakeApi();
var requestBody = new BuiltMap&lt;String, String&gt;(); // BuiltMap<String, String> | request body
var requestBody = new BuiltMap<String, String>(); // BuiltMap<String, String> | request body
try {
api_instance.testInlineAdditionalProperties(requestBody);
} catch (e) {
print("Exception when calling FakeApi->testInlineAdditionalProperties: $e\n");
print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n');
}
```
@ -614,7 +614,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**requestBody** | [**BuiltMap&lt;String, String&gt;**](String.md)| request body |
**requestBody** | [**BuiltMap<String, String>**](String.md)| request body |
### Return type
@ -647,7 +647,7 @@ var param2 = param2_example; // String | field2
try {
api_instance.testJsonFormData(param, param2);
} catch (e) {
print("Exception when calling FakeApi->testJsonFormData: $e\n");
print('Exception when calling FakeApi->testJsonFormData: $e\n');
}
```
@ -694,7 +694,7 @@ var context = []; // BuiltList<String> |
try {
api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
} catch (e) {
print("Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n");
print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n');
}
```
@ -702,11 +702,11 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pipe** | [**BuiltList&lt;String&gt;**](String.md)| | [default to const []]
**ioutil** | [**BuiltList&lt;String&gt;**](String.md)| | [default to const []]
**http** | [**BuiltList&lt;String&gt;**](String.md)| | [default to const []]
**url** | [**BuiltList&lt;String&gt;**](String.md)| | [default to const []]
**context** | [**BuiltList&lt;String&gt;**](String.md)| | [default to const []]
**pipe** | [**BuiltList<String>**](String.md)| | [default to const []]
**ioutil** | [**BuiltList<String>**](String.md)| | [default to const []]
**http** | [**BuiltList<String>**](String.md)| | [default to const []]
**url** | [**BuiltList<String>**](String.md)| | [default to const []]
**context** | [**BuiltList<String>**](String.md)| | [default to const []]
### Return type

View File

@ -34,7 +34,7 @@ try {
var result = api_instance.testClassname(client);
print(result);
} catch (e) {
print("Exception when calling FakeClassnameTags123Api->testClassname: $e\n");
print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n');
}
```

View File

@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**file** | [**MultipartFile**](MultipartFile.md) | | [optional] [default to null]
**files** | [**BuiltList&lt;MultipartFile&gt;**](MultipartFile.md) | | [optional] [default to const []]
**files** | [**BuiltList<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -23,7 +23,7 @@ Name | Type | Description | Notes
**uuid** | **String** | | [optional] [default to null]
**password** | **String** | | [default to null]
**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] [default to null]
**patternWithDigitsAndDelimiter** | **String** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional] [default to null]
**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -8,7 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enumFormStringArray** | **BuiltList&lt;String&gt;** | Form parameter enum test (string array) | [optional] [default to const []]
**enumFormStringArray** | **BuiltList<String>** | Form parameter enum test (string array) | [optional] [default to const []]
**enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to &#39;-efg&#39;]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -8,10 +8,10 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapMapOfString** | [**BuiltMap&lt;String, BuiltMap&lt;String, String&gt;&gt;**](BuiltMap.md) | | [optional] [default to const {}]
**mapOfEnumString** | **BuiltMap&lt;String, String&gt;** | | [optional] [default to const {}]
**directMap** | **BuiltMap&lt;String, bool&gt;** | | [optional] [default to const {}]
**indirectMap** | **BuiltMap&lt;String, bool&gt;** | | [optional] [default to const {}]
**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] [default to const {}]
**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] [default to const {}]
**directMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}]
**indirectMap** | **BuiltMap<String, bool>** | | [optional] [default to const {}]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -10,7 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uuid** | **String** | | [optional] [default to null]
**dateTime** | [**DateTime**](DateTime.md) | | [optional] [default to null]
**map** | [**BuiltMap&lt;String, Animal&gt;**](Animal.md) | | [optional] [default to const {}]
**map** | [**BuiltMap<String, Animal>**](Animal.md) | | [optional] [default to const {}]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -14,12 +14,12 @@ Name | Type | Description | Notes
**stringProp** | **String** | | [optional] [default to null]
**dateProp** | [**DateTime**](DateTime.md) | | [optional] [default to null]
**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] [default to null]
**arrayNullableProp** | [**BuiltList&lt;JsonObject&gt;**](JsonObject.md) | | [optional] [default to const []]
**arrayAndItemsNullableProp** | [**BuiltList&lt;JsonObject&gt;**](JsonObject.md) | | [optional] [default to const []]
**arrayItemsNullable** | [**BuiltList&lt;JsonObject&gt;**](JsonObject.md) | | [optional] [default to const []]
**objectNullableProp** | [**BuiltMap&lt;String, JsonObject&gt;**](JsonObject.md) | | [optional] [default to const {}]
**objectAndItemsNullableProp** | [**BuiltMap&lt;String, JsonObject&gt;**](JsonObject.md) | | [optional] [default to const {}]
**objectItemsNullable** | [**BuiltMap&lt;String, JsonObject&gt;**](JsonObject.md) | | [optional] [default to const {}]
**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []]
**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []]
**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] [default to const []]
**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}]
**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}]
**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] [default to const {}]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -11,8 +11,8 @@ Name | Type | Description | Notes
**id** | **int** | | [optional] [default to null]
**category** | [**Category**](Category.md) | | [optional] [default to null]
**name** | **String** | | [default to null]
**photoUrls** | **BuiltList&lt;String&gt;** | | [default to const []]
**tags** | [**BuiltList&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**photoUrls** | **BuiltList<String>** | | [default to const []]
**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -37,7 +37,7 @@ var pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(pet);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
print('Exception when calling PetApi->addPet: $e\n');
}
```
@ -80,7 +80,7 @@ var apiKey = apiKey_example; // String |
try {
api_instance.deletePet(petId, apiKey);
} catch (e) {
print("Exception when calling PetApi->deletePet: $e\n");
print('Exception when calling PetApi->deletePet: $e\n');
}
```
@ -126,7 +126,7 @@ try {
var result = api_instance.findPetsByStatus(status);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByStatus: $e\n");
print('Exception when calling PetApi->findPetsByStatus: $e\n');
}
```
@ -134,7 +134,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**BuiltList&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
**status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type
@ -171,7 +171,7 @@ try {
var result = api_instance.findPetsByTags(tags);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByTags: $e\n");
print('Exception when calling PetApi->findPetsByTags: $e\n');
}
```
@ -179,7 +179,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**BuiltList&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
**tags** | [**BuiltList<String>**](String.md)| Tags to filter by | [default to const []]
### Return type
@ -218,7 +218,7 @@ try {
var result = api_instance.getPetById(petId);
print(result);
} catch (e) {
print("Exception when calling PetApi->getPetById: $e\n");
print('Exception when calling PetApi->getPetById: $e\n');
}
```
@ -260,7 +260,7 @@ var pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.updatePet(pet);
} catch (e) {
print("Exception when calling PetApi->updatePet: $e\n");
print('Exception when calling PetApi->updatePet: $e\n');
}
```
@ -304,7 +304,7 @@ var status = status_example; // String | Updated status of the pet
try {
api_instance.updatePetWithForm(petId, name, status);
} catch (e) {
print("Exception when calling PetApi->updatePetWithForm: $e\n");
print('Exception when calling PetApi->updatePetWithForm: $e\n');
}
```
@ -351,7 +351,7 @@ try {
var result = api_instance.uploadFile(petId, additionalMetadata, file);
print(result);
} catch (e) {
print("Exception when calling PetApi->uploadFile: $e\n");
print('Exception when calling PetApi->uploadFile: $e\n');
}
```
@ -398,7 +398,7 @@ try {
var result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
print(result);
} catch (e) {
print("Exception when calling PetApi->uploadFileWithRequiredFile: $e\n");
print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n');
}
```

View File

@ -32,7 +32,7 @@ var orderId = orderId_example; // String | ID of the order that needs to be dele
try {
api_instance.deleteOrder(orderId);
} catch (e) {
print("Exception when calling StoreApi->deleteOrder: $e\n");
print('Exception when calling StoreApi->deleteOrder: $e\n');
}
```
@ -78,7 +78,7 @@ try {
var result = api_instance.getInventory();
print(result);
} catch (e) {
print("Exception when calling StoreApi->getInventory: $e\n");
print('Exception when calling StoreApi->getInventory: $e\n');
}
```
@ -118,7 +118,7 @@ try {
var result = api_instance.getOrderById(orderId);
print(result);
} catch (e) {
print("Exception when calling StoreApi->getOrderById: $e\n");
print('Exception when calling StoreApi->getOrderById: $e\n');
}
```
@ -159,7 +159,7 @@ try {
var result = api_instance.placeOrder(order);
print(result);
} catch (e) {
print("Exception when calling StoreApi->placeOrder: $e\n");
print('Exception when calling StoreApi->placeOrder: $e\n');
}
```

View File

@ -36,7 +36,7 @@ var user = new User(); // User | Created user object
try {
api_instance.createUser(user);
} catch (e) {
print("Exception when calling UserApi->createUser: $e\n");
print('Exception when calling UserApi->createUser: $e\n');
}
```
@ -71,12 +71,12 @@ Creates list of users with given input array
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var user = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var user = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithArrayInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
print('Exception when calling UserApi->createUsersWithArrayInput: $e\n');
}
```
@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**user** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -111,12 +111,12 @@ Creates list of users with given input array
import 'package:openapi/api.dart';
var api_instance = new UserApi();
var user = [new BuiltList&lt;User&gt;()]; // BuiltList<User> | List of user object
var user = [new BuiltList<User>()]; // BuiltList<User> | List of user object
try {
api_instance.createUsersWithListInput(user);
} catch (e) {
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
print('Exception when calling UserApi->createUsersWithListInput: $e\n');
}
```
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**BuiltList&lt;User&gt;**](User.md)| List of user object |
**user** | [**BuiltList<User>**](User.md)| List of user object |
### Return type
@ -158,7 +158,7 @@ var username = username_example; // String | The name that needs to be deleted
try {
api_instance.deleteUser(username);
} catch (e) {
print("Exception when calling UserApi->deleteUser: $e\n");
print('Exception when calling UserApi->deleteUser: $e\n');
}
```
@ -199,7 +199,7 @@ try {
var result = api_instance.getUserByName(username);
print(result);
} catch (e) {
print("Exception when calling UserApi->getUserByName: $e\n");
print('Exception when calling UserApi->getUserByName: $e\n');
}
```
@ -241,7 +241,7 @@ try {
var result = api_instance.loginUser(username, password);
print(result);
} catch (e) {
print("Exception when calling UserApi->loginUser: $e\n");
print('Exception when calling UserApi->loginUser: $e\n');
}
```
@ -281,7 +281,7 @@ var api_instance = new UserApi();
try {
api_instance.logoutUser();
} catch (e) {
print("Exception when calling UserApi->logoutUser: $e\n");
print('Exception when calling UserApi->logoutUser: $e\n');
}
```
@ -321,7 +321,7 @@ var user = new User(); // User | Updated user object
try {
api_instance.updateUser(username, user);
} catch (e) {
print("Exception when calling UserApi->updateUser: $e\n");
print('Exception when calling UserApi->updateUser: $e\n');
}
```

View File

@ -21,7 +21,7 @@ class Openapi {
Dio dio;
Serializers serializers;
String basePath = "http://petstore.swagger.io:80/v2";
String basePath = 'http://petstore.swagger.io:80/v2';
Openapi({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) {
if (dio == null) {

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,19 +14,25 @@ class AnotherFakeApi {
/// To test special tags
///
/// To test special tags and operation ID starting with number
Future<Response<Client>>call123testSpecialTags(Client client,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Client>>call123testSpecialTags(
Client client, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/another-fake/dummy';
String _path = "/another-fake/dummy";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(client);
final jsonclient = json.encode(serializedBody);
@ -43,13 +48,12 @@ class AnotherFakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Client);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -64,4 +68,5 @@ class AnotherFakeApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,20 +14,22 @@ class DefaultApi {
///
///
///
Future<Response<InlineResponseDefault>>fooGet({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<InlineResponseDefault>>fooGet({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/foo';
String _path = "/foo";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -40,13 +41,12 @@ class DefaultApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(InlineResponseDefault);
final data = _serializers.deserializeWith<InlineResponseDefault>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -61,4 +61,5 @@ class DefaultApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -23,20 +22,22 @@ class FakeApi {
/// Health check endpoint
///
///
Future<Response<HealthCheckResult>>fakeHealthGet({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<HealthCheckResult>>fakeHealthGet({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/health';
String _path = "/fake/health";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -48,13 +49,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(HealthCheckResult);
final data = _serializers.deserializeWith<HealthCheckResult>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -69,15 +69,23 @@ class FakeApi {
);
});
}
/// test http signature authentication
///
///
Future<Response>fakeHttpSignatureTest(Pet pet,{ String query1,String header1,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>fakeHttpSignatureTest(
Pet pet, {
String query1,
String header1,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/http-signature-test';
String _path = "/fake/http-signature-test";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'header_1'] = header1;
@ -85,8 +93,10 @@ class FakeApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(pet);
final jsonpet = json.encode(serializedBody);
@ -100,31 +110,43 @@ class FakeApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "http", "name": "http_signature_test" }],
'secure': [
{
'type': 'http',
'name': 'http_signature_test',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
///
///
/// Test serialization of outer boolean types
Future<Response<bool>>fakeOuterBooleanSerialize({ bool body,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<bool>>fakeOuterBooleanSerialize({
bool body,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/outer/boolean';
String _path = "/fake/outer/boolean";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -140,13 +162,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as bool;
return Response<bool>(
@ -160,22 +181,29 @@ class FakeApi {
);
});
}
///
///
/// Test serialization of object with outer number type
Future<Response<OuterComposite>>fakeOuterCompositeSerialize({ OuterComposite outerComposite,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<OuterComposite>>fakeOuterCompositeSerialize({
OuterComposite outerComposite,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/outer/composite';
String _path = "/fake/outer/composite";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(outerComposite);
final jsonouterComposite = json.encode(serializedBody);
@ -191,13 +219,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(OuterComposite);
final data = _serializers.deserializeWith<OuterComposite>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -212,22 +239,29 @@ class FakeApi {
);
});
}
///
///
/// Test serialization of outer number types
Future<Response<num>>fakeOuterNumberSerialize({ num body,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<num>>fakeOuterNumberSerialize({
num body,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/outer/number';
String _path = "/fake/outer/number";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -243,13 +277,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as num;
return Response<num>(
@ -263,22 +296,29 @@ class FakeApi {
);
});
}
///
///
/// Test serialization of outer string types
Future<Response<String>>fakeOuterStringSerialize({ String body,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<String>>fakeOuterStringSerialize({
String body,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/outer/string';
String _path = "/fake/outer/string";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(body);
final jsonbody = json.encode(serializedBody);
@ -294,13 +334,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as String;
return Response<String>(
@ -314,22 +353,29 @@ class FakeApi {
);
});
}
///
///
/// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
Future<Response>testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For this test, the body for this request much reference a schema named `File`.
Future<Response>testBodyWithFileSchema(
FileSchemaTestClass fileSchemaTestClass, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/body-with-file-schema';
String _path = "/fake/body-with-file-schema";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(fileSchemaTestClass);
final jsonfileSchemaTestClass = json.encode(serializedBody);
@ -345,30 +391,38 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
///
///
///
Future<Response>testBodyWithQueryParams(String query,User user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
String _path = "/fake/body-with-query-params";
///
///
///
Future<Response>testBodyWithQueryParams(
String query,
User user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/body-with-query-params';
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'query'] = query;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(user);
final jsonuser = json.encode(serializedBody);
@ -384,29 +438,36 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// To test \&quot;client\&quot; model
/// To test \"client\" model
///
/// To test \&quot;client\&quot; model
Future<Response<Client>>testClientModel(Client client,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// To test \"client\" model
Future<Response<Client>>testClientModel(
Client client, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake';
String _path = "/fake";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(client);
final jsonclient = json.encode(serializedBody);
@ -422,13 +483,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Client);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -443,21 +503,42 @@ class FakeApi {
);
});
}
/// Fake endpoint for testing various parameters
///
/// Fake endpoint for testing various parameters
Future<Response>testEndpointParameters(num number,double double_,String patternWithoutDelimiter,String byte,{ int integer,int int32,int int64,double float,String string,Uint8List binary,DateTime date,DateTime dateTime,String password,String callback,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testEndpointParameters(
num number,
double double_,
String patternWithoutDelimiter,
String byte, {
int integer,
int int32,
int int64,
double float,
String string,
Uint8List binary,
DateTime date,
DateTime dateTime,
String password,
String callback,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake';
String _path = "/fake";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['integer'] = parameterToString(_serializers, integer);
@ -476,7 +557,6 @@ class FakeApi {
formData['callback'] = parameterToString(_serializers, callback);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -485,24 +565,42 @@ class FakeApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "http", "name": "http_basic_test" }],
'secure': [
{
'type': 'http',
'name': 'http_basic_test',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// To test enum parameters
///
/// To test enum parameters
Future<Response>testEnumParameters({ BuiltList<String> enumHeaderStringArray,String enumHeaderString,BuiltList<String> enumQueryStringArray,String enumQueryString,int enumQueryInteger,double enumQueryDouble,BuiltList<String> enumFormStringArray,String enumFormString,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testEnumParameters({
BuiltList<String> enumHeaderStringArray,
String enumHeaderString,
BuiltList<String> enumQueryStringArray,
String enumQueryString,
int enumQueryInteger,
double enumQueryDouble,
BuiltList<String> enumFormStringArray,
String enumFormString,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake';
String _path = "/fake";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'enum_header_string_array'] = enumHeaderStringArray;
@ -514,14 +612,15 @@ class FakeApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['enum_form_string_array'] = parameterToString(_serializers, enumFormStringArray);
formData['enum_form_string'] = parameterToString(_serializers, enumFormString);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -532,22 +631,33 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Fake endpoint to test group parameters (optional)
///
/// Fake endpoint to test group parameters (optional)
Future<Response>testGroupParameters(int requiredStringGroup,bool requiredBooleanGroup,int requiredInt64Group,{ int stringGroup,bool booleanGroup,int int64Group,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testGroupParameters(
int requiredStringGroup,
bool requiredBooleanGroup,
int requiredInt64Group, {
int stringGroup,
bool booleanGroup,
int int64Group,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake';
String _path = "/fake";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'required_boolean_group'] = requiredBooleanGroup;
@ -559,9 +669,7 @@ class FakeApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -571,31 +679,43 @@ class FakeApi {
method: 'delete'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "http", "name": "bearer_test" }],
'secure': [
{
'type': 'http',
'name': 'bearer_test',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// test inline additionalProperties
///
///
Future<Response>testInlineAdditionalProperties(BuiltMap<String, String> requestBody,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testInlineAdditionalProperties(
BuiltMap<String, String> requestBody, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/inline-additionalProperties';
String _path = "/fake/inline-additionalProperties";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(requestBody);
final jsonrequestBody = json.encode(serializedBody);
@ -611,35 +731,43 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// test json serialization of form data
///
///
Future<Response>testJsonFormData(String param,String param2,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testJsonFormData(
String param,
String param2, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/jsonFormData';
String _path = "/fake/jsonFormData";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['param'] = parameterToString(_serializers, param);
formData['param2'] = parameterToString(_serializers, param2);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -650,22 +778,32 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
///
///
/// To test the collection format in query parameters
Future<Response>testQueryParameterCollectionFormat(BuiltList<String> pipe,BuiltList<String> ioutil,BuiltList<String> http,BuiltList<String> url,BuiltList<String> context,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>testQueryParameterCollectionFormat(
BuiltList<String> pipe,
BuiltList<String> ioutil,
BuiltList<String> http,
BuiltList<String> url,
BuiltList<String> context, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/test-query-paramters';
String _path = "/fake/test-query-paramters";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'pipe'] = pipe;
@ -676,9 +814,7 @@ class FakeApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -690,11 +826,12 @@ class FakeApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,19 +14,25 @@ class FakeClassnameTags123Api {
/// To test class name in snake case
///
/// To test class name in snake case
Future<Response<Client>>testClassname(Client client,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Client>>testClassname(
Client client, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake_classname_test';
String _path = "/fake_classname_test";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(client);
final jsonclient = json.encode(serializedBody);
@ -41,15 +46,21 @@ class FakeClassnameTags123Api {
method: 'patch'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key_query", "keyName": "api_key_query", "where": "query" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key_query',
'keyName': 'api_key_query',
'where': 'query',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Client);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -64,4 +75,5 @@ class FakeClassnameTags123Api {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -19,19 +18,26 @@ class PetApi {
/// Add a new pet to the store
///
///
Future<Response>addPet(Pet pet,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>addPet(
Pet pet, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(pet);
final jsonpet = json.encode(serializedBody);
@ -45,33 +51,43 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Deletes a pet
///
///
Future<Response>deletePet(int petId,{ String apiKey,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deletePet(
int petId, {
String apiKey,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
headerParams[r'api_key'] = apiKey;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -81,33 +97,42 @@ class PetApi {
method: 'delete'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Finds Pets by status
///
/// Multiple status values can be provided with comma separated strings
Future<Response<BuiltList<Pet>>>findPetsByStatus(BuiltList<String> status,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByStatus(
BuiltList<String> status, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByStatus';
String _path = "/pet/findByStatus";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'status'] = status;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -117,15 +142,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -141,24 +170,28 @@ class PetApi {
);
});
}
/// Finds Pets by tags
///
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Future<Response<BuiltList<Pet>>>findPetsByTags(BuiltList<String> tags,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltList<Pet>>>findPetsByTags(
BuiltList<String> tags, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/findByTags';
String _path = "/pet/findByTags";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'tags'] = tags;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -168,15 +201,19 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltList;
const type = FullType(collectionType, [FullType(Pet)]);
final BuiltList<Pet> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -192,23 +229,27 @@ class PetApi {
);
});
}
/// Find pet by ID
///
/// Returns a single pet
Future<Response<Pet>>getPetById(int petId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Pet>>getPetById(
int petId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -218,15 +259,21 @@ class PetApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Pet);
final data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -241,22 +288,30 @@ class PetApi {
);
});
}
/// Update an existing pet
///
///
Future<Response>updatePet(Pet pet,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updatePet(
Pet pet, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet';
String _path = "/pet";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json","application/xml"];
final List<String> contentTypes = [
'application/json',
'application/xml',
];
final serializedBody = _serializers.serialize(pet);
final jsonpet = json.encode(serializedBody);
@ -270,37 +325,51 @@ class PetApi {
method: 'put'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Updates a pet in the store with form data
///
///
Future<Response>updatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updatePetWithForm(
int petId, {
String name,
String status,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/x-www-form-urlencoded"];
final List<String> contentTypes = [
'application/x-www-form-urlencoded',
];
final Map<String, dynamic> formData = {};
formData['name'] = parameterToString(_serializers, name);
formData['status'] = parameterToString(_serializers, status);
bodyData = formData;
return _dio.request(
_path,
queryParameters: queryParams,
@ -309,30 +378,45 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// uploads an image
///
///
Future<Response<ApiResponse>>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<ApiResponse>>uploadFile(
int petId, {
String additionalMetadata,
Uint8List file,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/pet/{petId}/uploadImage".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["multipart/form-data"];
final List<String> contentTypes = [
'multipart/form-data',
];
final Map<String, dynamic> formData = {};
if (additionalMetadata != null) {
@ -343,7 +427,6 @@ class PetApi {
}
bodyData = FormData.fromMap(formData);
return _dio.request(
_path,
queryParameters: queryParams,
@ -352,15 +435,19 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(ApiResponse);
final data = _serializers.deserializeWith<ApiResponse>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -375,21 +462,31 @@ class PetApi {
);
});
}
/// uploads an image (required)
///
///
Future<Response<ApiResponse>>uploadFileWithRequiredFile(int petId,Uint8List requiredFile,{ String additionalMetadata,CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<ApiResponse>>uploadFileWithRequiredFile(
int petId,
Uint8List requiredFile, {
String additionalMetadata,
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString());
String _path = "/fake/{petId}/uploadImageWithRequiredFile".replaceAll("{" r'petId' "}", petId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["multipart/form-data"];
final List<String> contentTypes = [
'multipart/form-data',
];
final Map<String, dynamic> formData = {};
if (additionalMetadata != null) {
@ -400,7 +497,6 @@ class PetApi {
}
bodyData = FormData.fromMap(formData);
return _dio.request(
_path,
queryParameters: queryParams,
@ -409,15 +505,19 @@ class PetApi {
method: 'post'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "oauth2", "name": "petstore_auth" }],
'secure': [
{
'type': 'oauth2',
'name': 'petstore_auth',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(ApiResponse);
final data = _serializers.deserializeWith<ApiResponse>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -432,4 +532,5 @@ class PetApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -15,21 +14,24 @@ class StoreApi {
/// Delete purchase order by ID
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(String orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Future<Response>deleteOrder(
String orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
String _path = "/store/order/{order_id}".replaceAll("{" r'order_id' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -41,30 +43,33 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Returns pet inventories by status
///
/// Returns a map of status codes to quantities
Future<Response<BuiltMap<String, int>>>getInventory({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<BuiltMap<String, int>>>getInventory({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/inventory';
String _path = "/store/inventory";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -74,15 +79,21 @@ class StoreApi {
method: 'get'.toUpperCase(),
headers: headerParams,
extra: {
'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }],
'secure': [
{
'type': 'apiKey',
'name': 'api_key',
'keyName': 'api_key',
'where': 'header',
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
const collectionType = BuiltMap;
const type = FullType(collectionType, [FullType(String), FullType(int)]);
final BuiltMap<String, int> data = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type);
@ -98,23 +109,27 @@ class StoreApi {
);
});
}
/// Find purchase order by ID
///
/// For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(int orderId,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Future<Response<Order>>getOrderById(
int orderId, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString());
String _path = "/store/order/{order_id}".replaceAll("{" r'order_id' "}", orderId.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -126,13 +141,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -147,22 +161,29 @@ class StoreApi {
);
});
}
/// Place an order for a pet
///
///
Future<Response<Order>>placeOrder(Order order,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<Order>>placeOrder(
Order order, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/store/order';
String _path = "/store/order";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(order);
final jsonorder = json.encode(serializedBody);
@ -178,13 +199,12 @@ class StoreApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(Order);
final data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -199,4 +219,5 @@ class StoreApi {
);
});
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart';
@ -16,19 +15,25 @@ class UserApi {
/// Create user
///
/// This can only be done by the logged in user.
Future<Response>createUser(User user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUser(
User user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user';
String _path = "/user";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(user);
final jsonuser = json.encode(serializedBody);
@ -44,29 +49,36 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithArrayInput(BuiltList<User> user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithArrayInput(
BuiltList<User> user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithArray';
String _path = "/user/createWithArray";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(user, specifiedType: type);
@ -83,29 +95,36 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Creates list of users with given input array
///
///
Future<Response>createUsersWithListInput(BuiltList<User> user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>createUsersWithListInput(
BuiltList<User> user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/createWithList';
String _path = "/user/createWithList";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
const type = FullType(BuiltList, [FullType(User)]);
final serializedBody = _serializers.serialize(user, specifiedType: type);
@ -122,30 +141,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Delete user
///
/// This can only be done by the logged in user.
Future<Response>deleteUser(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>deleteUser(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -157,30 +180,34 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Get user by user name
///
///
Future<Response<User>>getUserByName(String username,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<User>>getUserByName(
String username, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -192,13 +219,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final serializer = _serializers.serializerForType(User);
final data = _serializers.deserializeWith<User>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
@ -213,15 +239,22 @@ class UserApi {
);
});
}
/// Logs user into the system
///
///
Future<Response<String>>loginUser(String username,String password,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response<String>>loginUser(
String username,
String password, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/login';
String _path = "/user/login";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams[r'username'] = username;
@ -229,9 +262,7 @@ class UserApi {
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -243,13 +274,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
).then((response) {
final data = response.data as String;
return Response<String>(
@ -263,23 +293,26 @@ class UserApi {
);
});
}
/// Logs out current logged in user session
///
///
Future<Response>logoutUser({ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>logoutUser({
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/logout';
String _path = "/user/logout";
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = [];
final List<String> contentTypes = [];
return _dio.request(
_path,
@ -291,29 +324,37 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
/// Updated user
///
/// This can only be done by the logged in user.
Future<Response>updateUser(String username,User user,{ CancelToken cancelToken, Map<String, String> headers, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress,}) async {
Future<Response>updateUser(
String username,
User user, {
CancelToken cancelToken,
Map<String, String> headers,
ProgressCallback onSendProgress,
ProgressCallback onReceiveProgress,
}) async {
final String _path = '/user/{username}'.replaceAll('{' r'username' '}', username.toString());
String _path = "/user/{username}".replaceAll("{" r'username' "}", username.toString());
Map<String, dynamic> queryParams = {};
Map<String, String> headerParams = Map.from(headers ?? {});
final Map<String, dynamic> queryParams = {};
final Map<String, String> headerParams = Map.from(headers ?? {});
dynamic bodyData;
queryParams.removeWhere((key, value) => value == null);
headerParams.removeWhere((key, value) => value == null);
List<String> contentTypes = ["application/json"];
final List<String> contentTypes = [
'application/json',
];
final serializedBody = _serializers.serialize(user);
final jsonuser = json.encode(serializedBody);
@ -329,11 +370,12 @@ class UserApi {
extra: {
'secure': [],
},
contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
contentType: contentTypes.isNotEmpty ? contentTypes[0] : 'application/json',
),
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
}

View File

@ -6,7 +6,6 @@ part 'additional_properties_class.g.dart';
abstract class AdditionalPropertiesClass implements Built<AdditionalPropertiesClass, AdditionalPropertiesClassBuilder> {
@nullable
@BuiltValueField(wireName: r'map_property')
BuiltMap<String, String> get mapProperty;

View File

@ -5,7 +5,6 @@ part 'animal.g.dart';
abstract class Animal implements Built<Animal, AnimalBuilder> {
@nullable
@BuiltValueField(wireName: r'className')
String get className;

View File

@ -5,7 +5,6 @@ part 'api_response.g.dart';
abstract class ApiResponse implements Built<ApiResponse, ApiResponseBuilder> {
@nullable
@BuiltValueField(wireName: r'code')
int get code;

View File

@ -6,7 +6,6 @@ part 'array_of_array_of_number_only.g.dart';
abstract class ArrayOfArrayOfNumberOnly implements Built<ArrayOfArrayOfNumberOnly, ArrayOfArrayOfNumberOnlyBuilder> {
@nullable
@BuiltValueField(wireName: r'ArrayArrayNumber')
BuiltList<BuiltList<num>> get arrayArrayNumber;

View File

@ -6,7 +6,6 @@ part 'array_of_number_only.g.dart';
abstract class ArrayOfNumberOnly implements Built<ArrayOfNumberOnly, ArrayOfNumberOnlyBuilder> {
@nullable
@BuiltValueField(wireName: r'ArrayNumber')
BuiltList<num> get arrayNumber;

View File

@ -7,7 +7,6 @@ part 'array_test.g.dart';
abstract class ArrayTest implements Built<ArrayTest, ArrayTestBuilder> {
@nullable
@BuiltValueField(wireName: r'array_of_string')
BuiltList<String> get arrayOfString;

View File

@ -5,7 +5,6 @@ part 'capitalization.g.dart';
abstract class Capitalization implements Built<Capitalization, CapitalizationBuilder> {
@nullable
@BuiltValueField(wireName: r'smallCamel')
String get smallCamel;
@ -25,7 +24,8 @@ abstract class Capitalization implements Built<Capitalization, CapitalizationBui
@nullable
@BuiltValueField(wireName: r'SCA_ETH_Flow_Points')
String get sCAETHFlowPoints;
/* Name of the pet */
/// Name of the pet
@nullable
@BuiltValueField(wireName: r'ATT_NAME')
String get ATT_NAME;

View File

@ -7,7 +7,6 @@ part 'cat.g.dart';
abstract class Cat implements Built<Cat, CatBuilder> {
@nullable
@BuiltValueField(wireName: r'className')
String get className;

View File

@ -5,7 +5,6 @@ part 'cat_all_of.g.dart';
abstract class CatAllOf implements Built<CatAllOf, CatAllOfBuilder> {
@nullable
@BuiltValueField(wireName: r'declawed')
bool get declawed;

View File

@ -5,7 +5,6 @@ part 'category.g.dart';
abstract class Category implements Built<Category, CategoryBuilder> {
@nullable
@BuiltValueField(wireName: r'id')
int get id;

View File

@ -5,7 +5,6 @@ part 'class_model.g.dart';
abstract class ClassModel implements Built<ClassModel, ClassModelBuilder> {
@nullable
@BuiltValueField(wireName: r'_class')
String get class_;

View File

@ -5,7 +5,6 @@ part 'client.g.dart';
abstract class Client implements Built<Client, ClientBuilder> {
@nullable
@BuiltValueField(wireName: r'client')
String get client;

View File

@ -7,7 +7,6 @@ part 'dog.g.dart';
abstract class Dog implements Built<Dog, DogBuilder> {
@nullable
@BuiltValueField(wireName: r'className')
String get className;

View File

@ -5,7 +5,6 @@ part 'dog_all_of.g.dart';
abstract class DogAllOf implements Built<DogAllOf, DogAllOfBuilder> {
@nullable
@BuiltValueField(wireName: r'breed')
String get breed;

View File

@ -6,11 +6,10 @@ part 'enum_arrays.g.dart';
abstract class EnumArrays implements Built<EnumArrays, EnumArraysBuilder> {
@nullable
@BuiltValueField(wireName: r'just_symbol')
EnumArraysJustSymbolEnum get justSymbol;
// enum justSymbolEnum { &gt;&#x3D;, $, };
// enum justSymbolEnum { >=, $, };
@nullable
@BuiltValueField(wireName: r'array_enum')

View File

@ -10,7 +10,6 @@ part 'enum_test.g.dart';
abstract class EnumTest implements Built<EnumTest, EnumTestBuilder> {
@nullable
@BuiltValueField(wireName: r'enum_string')
EnumTestEnumStringEnum get enumString;

View File

@ -5,7 +5,7 @@ part 'file.g.dart';
abstract class File implements Built<File, FileBuilder> {
/* Test capitalization */
/// Test capitalization
@nullable
@BuiltValueField(wireName: r'sourceURI')
String get sourceURI;

View File

@ -7,7 +7,6 @@ part 'file_schema_test_class.g.dart';
abstract class FileSchemaTestClass implements Built<FileSchemaTestClass, FileSchemaTestClassBuilder> {
@nullable
@BuiltValueField(wireName: r'file')
MultipartFile get file;

View File

@ -5,7 +5,6 @@ part 'foo.g.dart';
abstract class Foo implements Built<Foo, FooBuilder> {
@nullable
@BuiltValueField(wireName: r'bar')
String get bar;

View File

@ -6,7 +6,6 @@ part 'format_test.g.dart';
abstract class FormatTest implements Built<FormatTest, FormatTestBuilder> {
@nullable
@BuiltValueField(wireName: r'integer')
int get integer;
@ -62,11 +61,13 @@ abstract class FormatTest implements Built<FormatTest, FormatTestBuilder> {
@nullable
@BuiltValueField(wireName: r'password')
String get password;
/* A string that is a 10 digit number. Can have leading zeros. */
/// A string that is a 10 digit number. Can have leading zeros.
@nullable
@BuiltValueField(wireName: r'pattern_with_digits')
String get patternWithDigits;
/* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */
/// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
@nullable
@BuiltValueField(wireName: r'pattern_with_digits_and_delimiter')
String get patternWithDigitsAndDelimiter;

View File

@ -5,7 +5,6 @@ part 'has_only_read_only.g.dart';
abstract class HasOnlyReadOnly implements Built<HasOnlyReadOnly, HasOnlyReadOnlyBuilder> {
@nullable
@BuiltValueField(wireName: r'bar')
String get bar;

View File

@ -5,7 +5,6 @@ part 'health_check_result.g.dart';
abstract class HealthCheckResult implements Built<HealthCheckResult, HealthCheckResultBuilder> {
@nullable
@BuiltValueField(wireName: r'NullableMessage')
String get nullableMessage;

View File

@ -5,11 +5,12 @@ part 'inline_object.g.dart';
abstract class InlineObject implements Built<InlineObject, InlineObjectBuilder> {
/* Updated name of the pet */
/// Updated name of the pet
@nullable
@BuiltValueField(wireName: r'name')
String get name;
/* Updated status of the pet */
/// Updated status of the pet
@nullable
@BuiltValueField(wireName: r'status')
String get status;

View File

@ -6,11 +6,12 @@ part 'inline_object1.g.dart';
abstract class InlineObject1 implements Built<InlineObject1, InlineObject1Builder> {
/* Additional data to pass to server */
/// Additional data to pass to server
@nullable
@BuiltValueField(wireName: r'additionalMetadata')
String get additionalMetadata;
/* file to upload */
/// file to upload
@nullable
@BuiltValueField(wireName: r'file')
Uint8List get file;

View File

@ -6,12 +6,13 @@ part 'inline_object2.g.dart';
abstract class InlineObject2 implements Built<InlineObject2, InlineObject2Builder> {
/* Form parameter enum test (string array) */
/// Form parameter enum test (string array)
@nullable
@BuiltValueField(wireName: r'enum_form_string_array')
BuiltList<InlineObject2EnumFormStringArrayEnum> get enumFormStringArray;
// enum enumFormStringArrayEnum { &gt;, $, };
/* Form parameter enum test (string) */
// enum enumFormStringArrayEnum { >, $, };
/// Form parameter enum test (string)
@nullable
@BuiltValueField(wireName: r'enum_form_string')
InlineObject2EnumFormStringEnum get enumFormString;

View File

@ -6,59 +6,72 @@ part 'inline_object3.g.dart';
abstract class InlineObject3 implements Built<InlineObject3, InlineObject3Builder> {
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'integer')
int get integer;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'int32')
int get int32;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'int64')
int get int64;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'number')
num get number;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'float')
double get float;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'double')
double get double_;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'string')
String get string;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'pattern_without_delimiter')
String get patternWithoutDelimiter;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'byte')
String get byte;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'binary')
Uint8List get binary;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'date')
DateTime get date;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'dateTime')
DateTime get dateTime;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'password')
String get password;
/* None */
/// None
@nullable
@BuiltValueField(wireName: r'callback')
String get callback;

View File

@ -5,11 +5,12 @@ part 'inline_object4.g.dart';
abstract class InlineObject4 implements Built<InlineObject4, InlineObject4Builder> {
/* field1 */
/// field1
@nullable
@BuiltValueField(wireName: r'param')
String get param;
/* field2 */
/// field2
@nullable
@BuiltValueField(wireName: r'param2')
String get param2;

View File

@ -6,11 +6,12 @@ part 'inline_object5.g.dart';
abstract class InlineObject5 implements Built<InlineObject5, InlineObject5Builder> {
/* Additional data to pass to server */
/// Additional data to pass to server
@nullable
@BuiltValueField(wireName: r'additionalMetadata')
String get additionalMetadata;
/* file to upload */
/// file to upload
@nullable
@BuiltValueField(wireName: r'requiredFile')
Uint8List get requiredFile;

View File

@ -6,7 +6,6 @@ part 'inline_response_default.g.dart';
abstract class InlineResponseDefault implements Built<InlineResponseDefault, InlineResponseDefaultBuilder> {
@nullable
@BuiltValueField(wireName: r'string')
Foo get string;

View File

@ -6,7 +6,6 @@ part 'map_test.g.dart';
abstract class MapTest implements Built<MapTest, MapTestBuilder> {
@nullable
@BuiltValueField(wireName: r'map_map_of_string')
BuiltMap<String, BuiltMap<String, String>> get mapMapOfString;

Some files were not shown because too many files have changed in this diff Show More