forked from loafle/openapi-generator-original
Dart2 template linting (#10263)
* Bump jimschubert/query-tag-action from 1 to 2 Bumps [jimschubert/query-tag-action](https://github.com/jimschubert/query-tag-action) from 1 to 2. - [Release notes](https://github.com/jimschubert/query-tag-action/releases) - [Commits](https://github.com/jimschubert/query-tag-action/compare/v1...v2) Signed-off-by: dependabot[bot] <support@github.com> * Updated Dart2 template to fix linting errors when using recommended rules. * Updated Petstore code. * Revert to having no EOF marker at end of few files. * Fix a call on null value. * Updated Petstore code. * Add more checks for nulls. * Updated Petstore code. * Updated Petstore code. * Revert back decoding an enum value. * Revert back decoding an enum value. * Updated Petstore code. * Revert to older version of _convertParametersForCollectionFormat method. * Updated Petstore code. * Updated template and Petstore files. * Adjust doc for analysis_options file. * Updated Petstore sources. * Shorten command to replace path parameters. * Updated Petstore code. * Add a space for readability. * Adjust template per feedback. * Remove unneeded break statements. * Updated Petstore code. * Keep a new line character when replacing parameter names (like before). * Remove string interpolation. * Updated Petstore code. * Remove commented code. * Regenerate Petstore code. * Regenerated Petstore code. * Use another parameter name to stop variable shadowing. * Regenerated Petstore code. * Put description adjacent to the class. * Add another global ignore for all files: constant_identifier_names * Use const for contentTypes and authNames. * Regenerate Petstore code. * Use shorter code to check for an empty array. * Regenerate Petstore code. Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
eef7fdafd4
commit
495f6eb30c
@ -1,3 +0,0 @@
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: true
|
@ -49,7 +49,7 @@ class {{{classname}}} {
|
||||
///
|
||||
{{/-last}}
|
||||
{{/allParams}}
|
||||
Future<Response> {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
|
||||
Future<Response> {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
|
||||
{{#hasParams}}
|
||||
// Verify required params are set.
|
||||
{{#allParams}}
|
||||
@ -61,9 +61,11 @@ class {{{classname}}} {
|
||||
{{/allParams}}
|
||||
|
||||
{{/hasParams}}
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'{{{path}}}'{{#pathParams}}
|
||||
.replaceAll('{' + '{{{baseName}}}' + '}', {{{paramName}}}.toString()){{/pathParams}};
|
||||
.replaceAll({{=<% %>=}}'{<% baseName %>}'<%={{ }}=%>, {{{paramName}}}{{^isString}}.toString(){{/isString}}){{/pathParams}};
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody{{#bodyParam}} = {{{paramName}}}{{/bodyParam}};
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -95,9 +97,8 @@ class {{{classname}}} {
|
||||
{{/headerParams}}
|
||||
{{/hasHeaderParams}}
|
||||
|
||||
final contentTypes = <String>[{{#prioritizedContentTypes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/prioritizedContentTypes}}];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[{{#authMethods}}'{{{name}}}'{{^-last}}, {{/-last}}{{/authMethods}}];
|
||||
const authNames = <String>[{{#authMethods}}'{{{name}}}'{{^-last}}, {{/-last}}{{/authMethods}}];
|
||||
const contentTypes = <String>[{{#prioritizedContentTypes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/prioritizedContentTypes}}];
|
||||
|
||||
{{#isMultipart}}
|
||||
bool hasFields = false;
|
||||
@ -131,14 +132,14 @@ class {{{classname}}} {
|
||||
{{/formParams}}
|
||||
{{/isMultipart}}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'{{{httpMethod}}}',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -173,8 +174,8 @@ class {{{classname}}} {
|
||||
///
|
||||
{{/-last}}
|
||||
{{/allParams}}
|
||||
Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
|
||||
final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}} {{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} {{/hasOptionalParams}});
|
||||
Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{{nickname}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async {
|
||||
final response = await {{{nickname}}}WithHttpInfo({{#allParams}}{{#required}}{{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}} {{#allParams}}{{^required}}{{{paramName}}}: {{{paramName}}},{{^-last}} {{/-last}}{{/required}}{{/allParams}} {{/hasOptionalParams}});
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -185,7 +186,8 @@ class {{{classname}}} {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
{{#native_serialization}}
|
||||
{{#isArray}}
|
||||
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), '{{{returnType}}}') as List)
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, '{{{returnType}}}') as List)
|
||||
.cast<{{{returnBaseType}}}>()
|
||||
.{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}};
|
||||
{{/isArray}}
|
||||
@ -223,7 +225,7 @@ class {{{classname}}} {
|
||||
{{/isArray}}
|
||||
{{/json_serializable}}
|
||||
}
|
||||
return Future<{{{returnType}}}>.value(null);
|
||||
return Future<{{{returnType}}}>.value();
|
||||
{{/returnType}}
|
||||
}
|
||||
{{/operation}}
|
||||
|
@ -84,7 +84,7 @@ class ApiClient {
|
||||
? '?${urlEncodedQueryParams.join('&')}'
|
||||
: '';
|
||||
|
||||
final Uri uri = Uri.parse('$basePath$path$queryString');
|
||||
final uri = Uri.parse('$basePath$path$queryString');
|
||||
|
||||
if (nullableContentType != null) {
|
||||
headerParams['Content-Type'] = nullableContentType;
|
||||
@ -102,7 +102,8 @@ class ApiClient {
|
||||
body.finalize().listen(
|
||||
request.sink.add,
|
||||
onDone: request.sink.close,
|
||||
onError: (error, trace) => request.sink.close(),
|
||||
// ignore: avoid_types_on_closure_parameters
|
||||
onError: (Object error, StackTrace trace) => request.sink.close(),
|
||||
cancelOnError: true,
|
||||
);
|
||||
final response = await _client.send(request);
|
||||
@ -191,18 +192,17 @@ class ApiClient {
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
return '$value';
|
||||
return value is String ? value : value.toString();
|
||||
case 'int':
|
||||
return value is int ? value : int.parse('$value');
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'bool':
|
||||
if (value is bool) {
|
||||
return value;
|
||||
}
|
||||
final valueString = '$value'.toLowerCase();
|
||||
return valueString == 'true' || valueString == '1';
|
||||
break;
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
case '{{{classname}}}':
|
||||
@ -220,25 +220,24 @@ class ApiClient {
|
||||
if (value is List && (match = _regList.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toList(growable: growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return Map.fromIterables(
|
||||
value.keys,
|
||||
value.values.map((v) => _deserialize(v, targetType, growable: growable)),
|
||||
return Map<String, dynamic>.fromIterables(
|
||||
value.keys.cast<String>(),
|
||||
value.values.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable)),
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error, trace) {
|
||||
} on Exception catch (error, trace) {
|
||||
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
|
||||
}
|
||||
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
|
||||
|
@ -21,20 +21,21 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
// preconditions
|
||||
if (name != null && name.isNotEmpty && value != null) {
|
||||
if (value is List) {
|
||||
// get the collection format, default: csv
|
||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
||||
? 'csv'
|
||||
: collectionFormat;
|
||||
|
||||
if (collectionFormat == 'multi') {
|
||||
return value.map((v) => QueryParam(name, parameterToString(v)));
|
||||
return value.map((dynamic v) => QueryParam(name, parameterToString(v)),);
|
||||
}
|
||||
|
||||
// Default collection format is 'csv'.
|
||||
if (collectionFormat == null || collectionFormat.isEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
collectionFormat = 'csv';
|
||||
}
|
||||
|
||||
final delimiter = _delimiters[collectionFormat] ?? ',';
|
||||
|
||||
params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter)));
|
||||
params.add(QueryParam(name, value.map<dynamic>(parameterToString).join(delimiter)),);
|
||||
} else {
|
||||
params.add(QueryParam(name, parameterToString(value)));
|
||||
params.add(QueryParam(name, parameterToString(value),));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,3 +70,36 @@ Future<String> _decodeBodyBytes(Response response) async {
|
||||
? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)
|
||||
: response.body;
|
||||
}
|
||||
|
||||
/// Returns a valid [T] value found at the specified Map [key], null otherwise.
|
||||
T mapValueOfType<T>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is T ? value : null;
|
||||
}
|
||||
|
||||
/// Returns a valid Map<K, V> found at the specified Map [key], null otherwise.
|
||||
Map<K, V> mapCastOfType<K, V>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is Map ? value.cast<K, V>() : null;
|
||||
}
|
||||
|
||||
/// Returns a valid [DateTime] found at the specified Map [key], null otherwise.
|
||||
DateTime mapDateTime(dynamic map, String key, [String pattern]) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
if (value != null) {
|
||||
int millis;
|
||||
if (value is int) {
|
||||
millis = value;
|
||||
} else if (value is String) {
|
||||
if (pattern == _dateEpochMarker) {
|
||||
millis = int.tryParse(value);
|
||||
} else {
|
||||
return DateTime.tryParse(value);
|
||||
}
|
||||
}
|
||||
if (millis != null) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -18,9 +18,11 @@ class ApiKeyAuth implements Authentication {
|
||||
} else if (location == 'header' && value != null) {
|
||||
headerParams[paramName] = value;
|
||||
} else if (location == 'cookie' && value != null) {
|
||||
headerParams.update('Cookie', (String existingCookie) {
|
||||
return '$existingCookie; $paramName=$value';
|
||||
}, ifAbsent: () => '$paramName=$value');
|
||||
headerParams.update(
|
||||
'Cookie',
|
||||
(existingCookie) => '$existingCookie; $paramName=$value',
|
||||
ifAbsent: () => '$paramName=$value',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{{>header}}
|
||||
{{>part_of}}
|
||||
// ignore: one_member_abstracts
|
||||
abstract class Authentication {
|
||||
/// Apply authentication settings to header and query params.
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
||||
|
@ -5,4 +5,5 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
@ -6,7 +6,7 @@ class HttpBasicAuth implements Authentication {
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
final credentials = (username ?? '') + ':' + (password ?? '');
|
||||
final credentials = '${username ?? ''}:${password ?? ''}';
|
||||
headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class HttpBearerAuth implements Authentication {
|
||||
if (accessToken is! String && accessToken is! HttpBearerAuthProvider) {
|
||||
throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().');
|
||||
}
|
||||
this._accessToken = accessToken;
|
||||
_accessToken = accessToken;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5,4 +5,5 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
@ -49,10 +49,7 @@ class {{{classname}}} {
|
||||
Map<String, dynamic> toJson() => _${{{classname}}}ToJson(this);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toJson().toString();
|
||||
}
|
||||
|
||||
String toString() => toJson().toString();
|
||||
}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
|
@ -24,6 +24,7 @@ class {{{classname}}} {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
{{#vars}}
|
||||
({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}}
|
||||
{{/vars}}
|
||||
@ -70,152 +71,143 @@ class {{{classname}}} {
|
||||
}
|
||||
|
||||
/// Returns a new [{{{classname}}}] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static {{{classname}}} fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: {{{classname}}}(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static {{{classname}}} fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return {{{classname}}}(
|
||||
{{#vars}}
|
||||
{{#isDateTime}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
{{#pattern}}
|
||||
: _dateEpochMarker == '{{{pattern}}}'
|
||||
? DateTime.fromMillisecondsSinceEpoch(json[r'{{{baseName}}}'] as int, isUtc: true)
|
||||
: DateTime.parse(json[r'{{{baseName}}}']),
|
||||
{{/pattern}}
|
||||
{{^pattern}}
|
||||
: DateTime.parse(json[r'{{{baseName}}}']),
|
||||
{{/pattern}}
|
||||
{{/isDateTime}}
|
||||
{{#isDate}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
{{#pattern}}
|
||||
: _dateEpochMarker == '{{{pattern}}}'
|
||||
? DateTime.fromMillisecondsSinceEpoch(json[r'{{{baseName}}}'] as int, isUtc: true)
|
||||
: DateTime.parse(json[r'{{{baseName}}}']),
|
||||
{{/pattern}}
|
||||
{{^pattern}}
|
||||
: DateTime.parse(json[r'{{{baseName}}}']),
|
||||
{{/pattern}}
|
||||
{{/isDate}}
|
||||
{{^isDateTime}}
|
||||
{{^isDate}}
|
||||
{{#complexType}}
|
||||
{{#isArray}}
|
||||
{{#items.isArray}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
: (json[r'{{{baseName}}}'] as List).map(
|
||||
{{#items.complexType}}
|
||||
{{items.complexType}}.listFromJson(json[r'{{{baseName}}}'])
|
||||
{{/items.complexType}}
|
||||
{{^items.complexType}}
|
||||
(e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>()
|
||||
{{/items.complexType}}
|
||||
).toList(growable: false),
|
||||
{{/items.isArray}}
|
||||
{{^items.isArray}}
|
||||
{{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']),
|
||||
{{/items.isArray}}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#isMap}}
|
||||
{{#items.isArray}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
{{#isDateTime}}
|
||||
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'),
|
||||
{{/isDateTime}}
|
||||
{{#isDate}}
|
||||
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'),
|
||||
{{/isDate}}
|
||||
{{^isDateTime}}
|
||||
{{^isDate}}
|
||||
{{#complexType}}
|
||||
{{#isArray}}
|
||||
{{#items.isArray}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] is List
|
||||
? (json[r'{{{baseName}}}'] as List).map(
|
||||
{{#items.complexType}}
|
||||
: {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']),
|
||||
{{items.complexType}}.listFromJson(json[r'{{{baseName}}}'])
|
||||
{{/items.complexType}}
|
||||
{{^items.complexType}}
|
||||
: (json[r'{{{baseName}}}'] as Map).cast<String, List>(),
|
||||
(e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>()
|
||||
{{/items.complexType}}
|
||||
{{/items.isArray}}
|
||||
{{^items.isArray}}
|
||||
{{#items.isMap}}
|
||||
).toList(growable: false)
|
||||
: null,
|
||||
{{/items.isArray}}
|
||||
{{^items.isArray}}
|
||||
{{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']),
|
||||
{{/items.isArray}}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#isMap}}
|
||||
{{#items.isArray}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
{{#items.complexType}}
|
||||
: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']),
|
||||
{{/items.complexType}}
|
||||
{{^items.complexType}}
|
||||
: (json[r'{{{baseName}}}'] as Map).cast<String, Map>(),
|
||||
{{/items.complexType}}
|
||||
{{/items.isMap}}
|
||||
{{^items.isMap}}
|
||||
{{{name}}}: json[r'{{{baseName}}}']
|
||||
{{/items.isMap}}
|
||||
{{/items.isArray}}
|
||||
{{/isMap}}
|
||||
{{^isMap}}
|
||||
{{#isBinary}}
|
||||
{{#items.complexType}}
|
||||
: {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']),
|
||||
{{/items.complexType}}
|
||||
{{^items.complexType}}
|
||||
: mapCastOfType<String, List>(json, r'{{{baseName}}}'),
|
||||
{{/items.complexType}}
|
||||
{{/items.isArray}}
|
||||
{{^items.isArray}}
|
||||
{{#items.isMap}}
|
||||
{{#items.complexType}}
|
||||
{{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']),
|
||||
{{/items.complexType}}
|
||||
{{^items.complexType}}
|
||||
{{{name}}}: mapCastOfType<String, dynamic>(json, r'{{{baseName}}}'),
|
||||
{{/items.complexType}}
|
||||
{{/items.isMap}}
|
||||
{{^items.isMap}}
|
||||
{{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'),
|
||||
{{/items.isMap}}
|
||||
{{/items.isArray}}
|
||||
{{/isMap}}
|
||||
{{^isMap}}
|
||||
{{#isBinary}}
|
||||
{{{name}}}: null, // No support for decoding binary content from JSON
|
||||
{{/isBinary}}
|
||||
{{^isBinary}}
|
||||
{{/isBinary}}
|
||||
{{^isBinary}}
|
||||
{{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']),
|
||||
{{/isBinary}}
|
||||
{{/isMap}}
|
||||
{{/isArray}}
|
||||
{{/complexType}}
|
||||
{{^complexType}}
|
||||
{{#isArray}}
|
||||
{{#isEnum}}
|
||||
{{/isBinary}}
|
||||
{{/isMap}}
|
||||
{{/isArray}}
|
||||
{{/complexType}}
|
||||
{{^complexType}}
|
||||
{{#isArray}}
|
||||
{{#isEnum}}
|
||||
{{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']),
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] is {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}
|
||||
? (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>()
|
||||
: null,
|
||||
{{/isEnum}}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#isMap}}
|
||||
{{{name}}}: mapCastOfType<String, {{{items.datatype}}}>(json, r'{{{baseName}}}'),
|
||||
{{/isMap}}
|
||||
{{^isMap}}
|
||||
{{#isNumber}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null
|
||||
? null
|
||||
: (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>(),
|
||||
{{/isEnum}}
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
{{#isMap}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null ?
|
||||
null :
|
||||
(json[r'{{{baseName}}}'] as Map).cast<String, {{{items.datatype}}}>(),
|
||||
{{/isMap}}
|
||||
{{^isMap}}
|
||||
{{#isNumber}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'] == null ?
|
||||
null :
|
||||
json[r'{{{baseName}}}'].toDouble(),
|
||||
{{/isNumber}}
|
||||
{{^isNumber}}
|
||||
{{^isEnum}}
|
||||
{{{name}}}: json[r'{{{baseName}}}'],
|
||||
{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()),
|
||||
{{/isNumber}}
|
||||
{{^isNumber}}
|
||||
{{^isEnum}}
|
||||
{{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'),
|
||||
{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
{{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']),
|
||||
{{/isEnum}}
|
||||
{{/isNumber}}
|
||||
{{/isMap}}
|
||||
{{/isArray}}
|
||||
{{/complexType}}
|
||||
{{/isDate}}
|
||||
{{/isDateTime}}
|
||||
{{/isEnum}}
|
||||
{{/isNumber}}
|
||||
{{/isMap}}
|
||||
{{/isArray}}
|
||||
{{/complexType}}
|
||||
{{/isDate}}
|
||||
{{/isDateTime}}
|
||||
{{/vars}}
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <{{{classname}}}>[]
|
||||
: json.map((dynamic value) => {{{classname}}}.fromJson(value)).toList(growable: true == growable);
|
||||
static List<{{{classname}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map({{{classname}}}.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <{{{classname}}}>[];
|
||||
|
||||
static Map<String, {{{classname}}}> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, {{{classname}}}> mapFromJson(dynamic json) {
|
||||
final map = <String, {{{classname}}}>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = {{{classname}}}.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = {{{classname}}}.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of {{{classname}}}-objects as value to a dart map
|
||||
static Map<String, List<{{{classname}}}>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<{{{classname}}}>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<{{{classname}}}>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = {{{classname}}}.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = {{{classname}}}.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class {{{classname}}} {
|
||||
final {{{dataType}}} value;
|
||||
|
||||
@override
|
||||
String toString() => value{{^isString}}.toString(){{/isString}};
|
||||
String toString() => {{#isString}}value ?? ''{{/isString}}{{^isString}}value == null ? '' : value.toString(){{/isString}};
|
||||
|
||||
{{{dataType}}} toJson() => value;
|
||||
|
||||
@ -29,20 +29,18 @@ class {{{classname}}} {
|
||||
static {{{classname}}} fromJson(dynamic value) =>
|
||||
{{{classname}}}TypeTransformer().decode(value);
|
||||
|
||||
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <{{{classname}}}>[]
|
||||
: json
|
||||
.map((value) => {{{classname}}}.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<{{{classname}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map({{{classname}}}.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <{{{classname}}}>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [{{{classname}}}] to {{{dataType}}},
|
||||
/// and [decode] dynamic data back to [{{{classname}}}].
|
||||
class {{{classname}}}TypeTransformer {
|
||||
const {{{classname}}}TypeTransformer._();
|
||||
factory {{{classname}}}TypeTransformer() => _instance ??= const {{{classname}}}TypeTransformer._();
|
||||
|
||||
factory {{{classname}}}TypeTransformer() => _instance ??= {{{classname}}}TypeTransformer._();
|
||||
const {{{classname}}}TypeTransformer._();
|
||||
|
||||
{{{dataType}}} encode({{{classname}}} data) => data.value;
|
||||
|
||||
@ -55,20 +53,22 @@ class {{{classname}}}TypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
{{{classname}}} decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{#isString}}r{{/isString}}{{{value}}}: return {{{classname}}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{#isString}}r{{/isString}}{{{value}}}: return {{{classname}}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [{{{classname}}}TypeTransformer] instance.
|
||||
static {{{classname}}}TypeTransformer _instance;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class {{{enumName}}} {
|
||||
final {{{dataType}}} value;
|
||||
|
||||
@override
|
||||
String toString() => value{{^isString}}.toString(){{/isString}};
|
||||
String toString() => {{#isString}}value ?? ''{{/isString}}{{^isString}}value == null ? '' : value.toString(){{/isString}};
|
||||
|
||||
{{{dataType}}} toJson() => value;
|
||||
|
||||
@ -29,20 +29,18 @@ class {{{enumName}}} {
|
||||
static {{{enumName}}} fromJson(dynamic value) =>
|
||||
{{{enumName}}}TypeTransformer().decode(value);
|
||||
|
||||
static List<{{{enumName}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <{{{enumName}}}>[]
|
||||
: json
|
||||
.map((value) => {{{enumName}}}.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<{{{enumName}}}> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map({{{enumName}}}.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <{{{enumName}}}>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [{{{enumName}}}] to {{{dataType}}},
|
||||
/// and [decode] dynamic data back to [{{{enumName}}}].
|
||||
class {{{enumName}}}TypeTransformer {
|
||||
const {{{enumName}}}TypeTransformer._();
|
||||
factory {{{enumName}}}TypeTransformer() => _instance ??= const {{{enumName}}}TypeTransformer._();
|
||||
|
||||
factory {{{enumName}}}TypeTransformer() => _instance ??= {{{enumName}}}TypeTransformer._();
|
||||
const {{{enumName}}}TypeTransformer._();
|
||||
|
||||
{{{dataType}}} encode({{{enumName}}} data) => data.value;
|
||||
|
||||
@ -55,20 +53,22 @@ class {{{enumName}}}TypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
{{{enumName}}} decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{#isString}}r{{/isString}}{{{value}}}: return {{{enumName}}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{#isString}}r{{/isString}}{{{value}}}: return {{{enumName}}}.{{{name}}};
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [{{{enumName}}}TypeTransformer] instance.
|
||||
static {{{enumName}}}TypeTransformer _instance;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: true
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
library openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,33 +24,34 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Response> addPetWithHttpInfo(Pet pet) async {
|
||||
Future<Response> addPetWithHttpInfo(Pet pet,) async {
|
||||
// Verify required params are set.
|
||||
if (pet == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = pet;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json', 'application/xml'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/json', 'application/xml'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -60,8 +62,8 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Pet> addPet(Pet pet) async {
|
||||
final response = await addPetWithHttpInfo(pet);
|
||||
Future<Pet> addPet(Pet pet,) async {
|
||||
final response = await addPetWithHttpInfo(pet,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -71,7 +73,7 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
|
||||
}
|
||||
return Future<Pet>.value(null);
|
||||
return Future<Pet>.value();
|
||||
}
|
||||
|
||||
/// Deletes a pet
|
||||
@ -84,15 +86,17 @@ class PetApi {
|
||||
/// Pet id to delete
|
||||
///
|
||||
/// * [String] apiKey:
|
||||
Future<Response> deletePetWithHttpInfo(int petId, { String apiKey }) async {
|
||||
Future<Response> deletePetWithHttpInfo(int petId, { String apiKey, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -103,19 +107,18 @@ class PetApi {
|
||||
headerParams[r'api_key'] = parameterToString(apiKey);
|
||||
}
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -128,8 +131,8 @@ class PetApi {
|
||||
/// Pet id to delete
|
||||
///
|
||||
/// * [String] apiKey:
|
||||
Future<void> deletePet(int petId, { String apiKey }) async {
|
||||
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey );
|
||||
Future<void> deletePet(int petId, { String apiKey, }) async {
|
||||
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -145,14 +148,16 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] status (required):
|
||||
/// Status values that need to be considered for filter
|
||||
Future<Response> findPetsByStatusWithHttpInfo(List<String> status) async {
|
||||
Future<Response> findPetsByStatusWithHttpInfo(List<String> status,) async {
|
||||
// Verify required params are set.
|
||||
if (status == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: status');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/findByStatus';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -161,19 +166,18 @@ class PetApi {
|
||||
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -186,8 +190,8 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] status (required):
|
||||
/// Status values that need to be considered for filter
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
||||
final response = await findPetsByStatusWithHttpInfo(status);
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status,) async {
|
||||
final response = await findPetsByStatusWithHttpInfo(status,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -195,11 +199,12 @@ class PetApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List<Pet>') as List)
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<Pet>') as List)
|
||||
.cast<Pet>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return Future<List<Pet>>.value(null);
|
||||
return Future<List<Pet>>.value();
|
||||
}
|
||||
|
||||
/// Finds Pets by tags
|
||||
@ -212,14 +217,16 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] tags (required):
|
||||
/// Tags to filter by
|
||||
Future<Response> findPetsByTagsWithHttpInfo(List<String> tags) async {
|
||||
Future<Response> findPetsByTagsWithHttpInfo(List<String> tags,) async {
|
||||
// Verify required params are set.
|
||||
if (tags == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: tags');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/findByTags';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -228,19 +235,18 @@ class PetApi {
|
||||
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -253,8 +259,8 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] tags (required):
|
||||
/// Tags to filter by
|
||||
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
||||
final response = await findPetsByTagsWithHttpInfo(tags);
|
||||
Future<List<Pet>> findPetsByTags(List<String> tags,) async {
|
||||
final response = await findPetsByTagsWithHttpInfo(tags,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -262,11 +268,12 @@ class PetApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List<Pet>') as List)
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<Pet>') as List)
|
||||
.cast<Pet>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return Future<List<Pet>>.value(null);
|
||||
return Future<List<Pet>>.value();
|
||||
}
|
||||
|
||||
/// Find pet by ID
|
||||
@ -279,34 +286,35 @@ class PetApi {
|
||||
///
|
||||
/// * [int] petId (required):
|
||||
/// ID of pet to return
|
||||
Future<Response> getPetByIdWithHttpInfo(int petId) async {
|
||||
Future<Response> getPetByIdWithHttpInfo(int petId,) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -319,8 +327,8 @@ class PetApi {
|
||||
///
|
||||
/// * [int] petId (required):
|
||||
/// ID of pet to return
|
||||
Future<Pet> getPetById(int petId) async {
|
||||
final response = await getPetByIdWithHttpInfo(petId);
|
||||
Future<Pet> getPetById(int petId,) async {
|
||||
final response = await getPetByIdWithHttpInfo(petId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -330,7 +338,7 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
|
||||
}
|
||||
return Future<Pet>.value(null);
|
||||
return Future<Pet>.value();
|
||||
}
|
||||
|
||||
/// Update an existing pet
|
||||
@ -341,33 +349,34 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Response> updatePetWithHttpInfo(Pet pet) async {
|
||||
Future<Response> updatePetWithHttpInfo(Pet pet,) async {
|
||||
// Verify required params are set.
|
||||
if (pet == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = pet;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json', 'application/xml'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/json', 'application/xml'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -378,8 +387,8 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Pet> updatePet(Pet pet) async {
|
||||
final response = await updatePetWithHttpInfo(pet);
|
||||
Future<Pet> updatePet(Pet pet,) async {
|
||||
final response = await updatePetWithHttpInfo(pet,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -389,7 +398,7 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
|
||||
}
|
||||
return Future<Pet>.value(null);
|
||||
return Future<Pet>.value();
|
||||
}
|
||||
|
||||
/// Updates a pet in the store with form data
|
||||
@ -406,24 +415,25 @@ class PetApi {
|
||||
///
|
||||
/// * [String] status:
|
||||
/// Updated status of the pet
|
||||
Future<Response> updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async {
|
||||
Future<Response> updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
|
||||
if (name != null) {
|
||||
formParams[r'name'] = parameterToString(name);
|
||||
@ -432,14 +442,14 @@ class PetApi {
|
||||
formParams[r'status'] = parameterToString(status);
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -456,8 +466,8 @@ class PetApi {
|
||||
///
|
||||
/// * [String] status:
|
||||
/// Updated status of the pet
|
||||
Future<void> updatePetWithForm(int petId, { String name, String status }) async {
|
||||
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status );
|
||||
Future<void> updatePetWithForm(int petId, { String name, String status, }) async {
|
||||
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -477,24 +487,25 @@ class PetApi {
|
||||
///
|
||||
/// * [MultipartFile] file:
|
||||
/// file to upload
|
||||
Future<Response> uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||
Future<Response> uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}/uploadImage'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['multipart/form-data'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['multipart/form-data'];
|
||||
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest('POST', Uri.parse(path));
|
||||
@ -511,14 +522,14 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -535,8 +546,8 @@ class PetApi {
|
||||
///
|
||||
/// * [MultipartFile] file:
|
||||
/// file to upload
|
||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file );
|
||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async {
|
||||
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -546,6 +557,6 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse;
|
||||
}
|
||||
return Future<ApiResponse>.value(null);
|
||||
return Future<ApiResponse>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,34 +26,35 @@ class StoreApi {
|
||||
///
|
||||
/// * [String] orderId (required):
|
||||
/// ID of the order that needs to be deleted
|
||||
Future<Response> deleteOrderWithHttpInfo(String orderId) async {
|
||||
Future<Response> deleteOrderWithHttpInfo(String orderId,) async {
|
||||
// Verify required params are set.
|
||||
if (orderId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order/{orderId}'
|
||||
.replaceAll('{' + 'orderId' + '}', orderId.toString());
|
||||
.replaceAll('{orderId}', orderId);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -65,8 +67,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [String] orderId (required):
|
||||
/// ID of the order that needs to be deleted
|
||||
Future<void> deleteOrder(String orderId) async {
|
||||
final response = await deleteOrderWithHttpInfo(orderId);
|
||||
Future<void> deleteOrder(String orderId,) async {
|
||||
final response = await deleteOrderWithHttpInfo(orderId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -78,27 +80,28 @@ class StoreApi {
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> getInventoryWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/inventory';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -117,7 +120,7 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return Map<String, int>.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map<String, int>'),);
|
||||
}
|
||||
return Future<Map<String, int>>.value(null);
|
||||
return Future<Map<String, int>>.value();
|
||||
}
|
||||
|
||||
/// Find purchase order by ID
|
||||
@ -130,34 +133,35 @@ class StoreApi {
|
||||
///
|
||||
/// * [int] orderId (required):
|
||||
/// ID of pet that needs to be fetched
|
||||
Future<Response> getOrderByIdWithHttpInfo(int orderId) async {
|
||||
Future<Response> getOrderByIdWithHttpInfo(int orderId,) async {
|
||||
// Verify required params are set.
|
||||
if (orderId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order/{orderId}'
|
||||
.replaceAll('{' + 'orderId' + '}', orderId.toString());
|
||||
.replaceAll('{orderId}', orderId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -170,8 +174,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [int] orderId (required):
|
||||
/// ID of pet that needs to be fetched
|
||||
Future<Order> getOrderById(int orderId) async {
|
||||
final response = await getOrderByIdWithHttpInfo(orderId);
|
||||
Future<Order> getOrderById(int orderId,) async {
|
||||
final response = await getOrderByIdWithHttpInfo(orderId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -181,7 +185,7 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
|
||||
}
|
||||
return Future<Order>.value(null);
|
||||
return Future<Order>.value();
|
||||
}
|
||||
|
||||
/// Place an order for a pet
|
||||
@ -192,33 +196,34 @@ class StoreApi {
|
||||
///
|
||||
/// * [Order] order (required):
|
||||
/// order placed for purchasing the pet
|
||||
Future<Response> placeOrderWithHttpInfo(Order order) async {
|
||||
Future<Response> placeOrderWithHttpInfo(Order order,) async {
|
||||
// Verify required params are set.
|
||||
if (order == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: order');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = order;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -229,8 +234,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [Order] order (required):
|
||||
/// order placed for purchasing the pet
|
||||
Future<Order> placeOrder(Order order) async {
|
||||
final response = await placeOrderWithHttpInfo(order);
|
||||
Future<Order> placeOrder(Order order,) async {
|
||||
final response = await placeOrderWithHttpInfo(order,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -240,6 +245,6 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
|
||||
}
|
||||
return Future<Order>.value(null);
|
||||
return Future<Order>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,33 +26,34 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Created user object
|
||||
Future<Response> createUserWithHttpInfo(User user) async {
|
||||
Future<Response> createUserWithHttpInfo(User user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -64,8 +66,8 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Created user object
|
||||
Future<void> createUser(User user) async {
|
||||
final response = await createUserWithHttpInfo(user);
|
||||
Future<void> createUser(User user,) async {
|
||||
final response = await createUserWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -79,33 +81,34 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<Response> createUsersWithArrayInputWithHttpInfo(List<User> user) async {
|
||||
Future<Response> createUsersWithArrayInputWithHttpInfo(List<User> user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/createWithArray';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -116,8 +119,8 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<void> createUsersWithArrayInput(List<User> user) async {
|
||||
final response = await createUsersWithArrayInputWithHttpInfo(user);
|
||||
Future<void> createUsersWithArrayInput(List<User> user,) async {
|
||||
final response = await createUsersWithArrayInputWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -131,33 +134,34 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<Response> createUsersWithListInputWithHttpInfo(List<User> user) async {
|
||||
Future<Response> createUsersWithListInputWithHttpInfo(List<User> user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/createWithList';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -168,8 +172,8 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<void> createUsersWithListInput(List<User> user) async {
|
||||
final response = await createUsersWithListInputWithHttpInfo(user);
|
||||
Future<void> createUsersWithListInput(List<User> user,) async {
|
||||
final response = await createUsersWithListInputWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -185,34 +189,35 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be deleted
|
||||
Future<Response> deleteUserWithHttpInfo(String username) async {
|
||||
Future<Response> deleteUserWithHttpInfo(String username,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -225,8 +230,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be deleted
|
||||
Future<void> deleteUser(String username) async {
|
||||
final response = await deleteUserWithHttpInfo(username);
|
||||
Future<void> deleteUser(String username,) async {
|
||||
final response = await deleteUserWithHttpInfo(username,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -240,34 +245,35 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be fetched. Use user1 for testing.
|
||||
Future<Response> getUserByNameWithHttpInfo(String username) async {
|
||||
Future<Response> getUserByNameWithHttpInfo(String username,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -278,8 +284,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be fetched. Use user1 for testing.
|
||||
Future<User> getUserByName(String username) async {
|
||||
final response = await getUserByNameWithHttpInfo(username);
|
||||
Future<User> getUserByName(String username,) async {
|
||||
final response = await getUserByNameWithHttpInfo(username,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -289,7 +295,7 @@ class UserApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User;
|
||||
}
|
||||
return Future<User>.value(null);
|
||||
return Future<User>.value();
|
||||
}
|
||||
|
||||
/// Logs user into the system
|
||||
@ -303,7 +309,7 @@ class UserApi {
|
||||
///
|
||||
/// * [String] password (required):
|
||||
/// The password for login in clear text
|
||||
Future<Response> loginUserWithHttpInfo(String username, String password) async {
|
||||
Future<Response> loginUserWithHttpInfo(String username, String password,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
@ -312,8 +318,10 @@ class UserApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: password');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/login';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -323,19 +331,18 @@ class UserApi {
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username));
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -349,8 +356,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] password (required):
|
||||
/// The password for login in clear text
|
||||
Future<String> loginUser(String username, String password) async {
|
||||
final response = await loginUserWithHttpInfo(username, password);
|
||||
Future<String> loginUser(String username, String password,) async {
|
||||
final response = await loginUserWithHttpInfo(username, password,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -360,34 +367,35 @@ class UserApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
|
||||
}
|
||||
return Future<String>.value(null);
|
||||
return Future<String>.value();
|
||||
}
|
||||
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> logoutUserWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/logout';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -413,7 +421,7 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Updated user object
|
||||
Future<Response> updateUserWithHttpInfo(String username, User user) async {
|
||||
Future<Response> updateUserWithHttpInfo(String username, User user,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
@ -422,28 +430,29 @@ class UserApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -459,8 +468,8 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Updated user object
|
||||
Future<void> updateUser(String username, User user) async {
|
||||
final response = await updateUserWithHttpInfo(username, user);
|
||||
Future<void> updateUser(String username, User user,) async {
|
||||
final response = await updateUserWithHttpInfo(username, user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -77,7 +78,7 @@ class ApiClient {
|
||||
? '?${urlEncodedQueryParams.join('&')}'
|
||||
: '';
|
||||
|
||||
final Uri uri = Uri.parse('$basePath$path$queryString');
|
||||
final uri = Uri.parse('$basePath$path$queryString');
|
||||
|
||||
if (nullableContentType != null) {
|
||||
headerParams['Content-Type'] = nullableContentType;
|
||||
@ -95,7 +96,8 @@ class ApiClient {
|
||||
body.finalize().listen(
|
||||
request.sink.add,
|
||||
onDone: request.sink.close,
|
||||
onError: (error, trace) => request.sink.close(),
|
||||
// ignore: avoid_types_on_closure_parameters
|
||||
onError: (Object error, StackTrace trace) => request.sink.close(),
|
||||
cancelOnError: true,
|
||||
);
|
||||
final response = await _client.send(request);
|
||||
@ -181,18 +183,17 @@ class ApiClient {
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
return '$value';
|
||||
return value is String ? value : value.toString();
|
||||
case 'int':
|
||||
return value is int ? value : int.parse('$value');
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'bool':
|
||||
if (value is bool) {
|
||||
return value;
|
||||
}
|
||||
final valueString = '$value'.toLowerCase();
|
||||
return valueString == 'true' || valueString == '1';
|
||||
break;
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'ApiResponse':
|
||||
return ApiResponse.fromJson(value);
|
||||
case 'Category':
|
||||
@ -210,25 +211,24 @@ class ApiClient {
|
||||
if (value is List && (match = _regList.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toList(growable: growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return Map.fromIterables(
|
||||
value.keys,
|
||||
value.values.map((v) => _deserialize(v, targetType, growable: growable)),
|
||||
return Map<String, dynamic>.fromIterables(
|
||||
value.keys.cast<String>(),
|
||||
value.values.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable)),
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error, trace) {
|
||||
} on Exception catch (error, trace) {
|
||||
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
|
||||
}
|
||||
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -30,20 +31,21 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
// preconditions
|
||||
if (name != null && name.isNotEmpty && value != null) {
|
||||
if (value is List) {
|
||||
// get the collection format, default: csv
|
||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
||||
? 'csv'
|
||||
: collectionFormat;
|
||||
|
||||
if (collectionFormat == 'multi') {
|
||||
return value.map((v) => QueryParam(name, parameterToString(v)));
|
||||
return value.map((dynamic v) => QueryParam(name, parameterToString(v)),);
|
||||
}
|
||||
|
||||
// Default collection format is 'csv'.
|
||||
if (collectionFormat == null || collectionFormat.isEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
collectionFormat = 'csv';
|
||||
}
|
||||
|
||||
final delimiter = _delimiters[collectionFormat] ?? ',';
|
||||
|
||||
params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter)));
|
||||
params.add(QueryParam(name, value.map<dynamic>(parameterToString).join(delimiter)),);
|
||||
} else {
|
||||
params.add(QueryParam(name, parameterToString(value)));
|
||||
params.add(QueryParam(name, parameterToString(value),));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,3 +71,36 @@ Future<String> _decodeBodyBytes(Response response) async {
|
||||
? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)
|
||||
: response.body;
|
||||
}
|
||||
|
||||
/// Returns a valid [T] value found at the specified Map [key], null otherwise.
|
||||
T mapValueOfType<T>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is T ? value : null;
|
||||
}
|
||||
|
||||
/// Returns a valid Map<K, V> found at the specified Map [key], null otherwise.
|
||||
Map<K, V> mapCastOfType<K, V>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is Map ? value.cast<K, V>() : null;
|
||||
}
|
||||
|
||||
/// Returns a valid [DateTime] found at the specified Map [key], null otherwise.
|
||||
DateTime mapDateTime(dynamic map, String key, [String pattern]) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
if (value != null) {
|
||||
int millis;
|
||||
if (value is int) {
|
||||
millis = value;
|
||||
} else if (value is String) {
|
||||
if (pattern == _dateEpochMarker) {
|
||||
millis = int.tryParse(value);
|
||||
} else {
|
||||
return DateTime.tryParse(value);
|
||||
}
|
||||
}
|
||||
if (millis != null) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,9 +28,11 @@ class ApiKeyAuth implements Authentication {
|
||||
} else if (location == 'header' && value != null) {
|
||||
headerParams[paramName] = value;
|
||||
} else if (location == 'cookie' && value != null) {
|
||||
headerParams.update('Cookie', (String existingCookie) {
|
||||
return '$existingCookie; $paramName=$value';
|
||||
}, ifAbsent: () => '$paramName=$value');
|
||||
headerParams.update(
|
||||
'Cookie',
|
||||
(existingCookie) => '$existingCookie; $paramName=$value',
|
||||
ifAbsent: () => '$paramName=$value',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
// ignore: one_member_abstracts
|
||||
abstract class Authentication {
|
||||
/// Apply authentication settings to header and query params.
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -15,7 +16,7 @@ class HttpBasicAuth implements Authentication {
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
final credentials = (username ?? '') + ':' + (password ?? '');
|
||||
final credentials = '${username ?? ''}:${password ?? ''}';
|
||||
headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -22,7 +23,7 @@ class HttpBearerAuth implements Authentication {
|
||||
if (accessToken is! String && accessToken is! HttpBearerAuthProvider) {
|
||||
throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().');
|
||||
}
|
||||
this._accessToken = accessToken;
|
||||
_accessToken = accessToken;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class ApiResponse {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(code == null ? 0 : code.hashCode) +
|
||||
(type == null ? 0 : type.hashCode) +
|
||||
(message == null ? 0 : message.hashCode);
|
||||
@ -53,35 +55,48 @@ class ApiResponse {
|
||||
}
|
||||
|
||||
/// Returns a new [ApiResponse] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ApiResponse fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ApiResponse(
|
||||
code: json[r'code'],
|
||||
type: json[r'type'],
|
||||
message: json[r'message'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ApiResponse fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ApiResponse(
|
||||
code: mapValueOfType<int>(json, r'code'),
|
||||
type: mapValueOfType<String>(json, r'type'),
|
||||
message: mapValueOfType<String>(json, r'message'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ApiResponse> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ApiResponse>[]
|
||||
: json.map((dynamic value) => ApiResponse.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ApiResponse> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ApiResponse.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ApiResponse>[];
|
||||
|
||||
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ApiResponse> mapFromJson(dynamic json) {
|
||||
final map = <String, ApiResponse>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ApiResponse.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ApiResponse.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ApiResponse-objects as value to a dart map
|
||||
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ApiResponse>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ApiResponse>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ApiResponse.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ApiResponse.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Category {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(name == null ? 0 : name.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class Category {
|
||||
}
|
||||
|
||||
/// Returns a new [Category] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Category fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Category(
|
||||
id: json[r'id'],
|
||||
name: json[r'name'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Category fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Category(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Category> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Category>[]
|
||||
: json.map((dynamic value) => Category.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Category> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Category.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Category>[];
|
||||
|
||||
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Category> mapFromJson(dynamic json) {
|
||||
final map = <String, Category>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Category.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Category.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Category-objects as value to a dart map
|
||||
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Category>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Category>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Category.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Category.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -44,6 +45,7 @@ class Order {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(petId == null ? 0 : petId.hashCode) +
|
||||
(quantity == null ? 0 : quantity.hashCode) +
|
||||
@ -78,40 +80,51 @@ class Order {
|
||||
}
|
||||
|
||||
/// Returns a new [Order] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Order fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Order(
|
||||
id: json[r'id'],
|
||||
petId: json[r'petId'],
|
||||
quantity: json[r'quantity'],
|
||||
shipDate: json[r'shipDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'shipDate']),
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Order fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Order(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
petId: mapValueOfType<int>(json, r'petId'),
|
||||
quantity: mapValueOfType<int>(json, r'quantity'),
|
||||
shipDate: mapDateTime(json, r'shipDate', ''),
|
||||
status: OrderStatusEnum.fromJson(json[r'status']),
|
||||
complete: json[r'complete'],
|
||||
);
|
||||
complete: mapValueOfType<bool>(json, r'complete'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Order> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Order>[]
|
||||
: json.map((dynamic value) => Order.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Order> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Order.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Order>[];
|
||||
|
||||
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Order> mapFromJson(dynamic json) {
|
||||
final map = <String, Order>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Order.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Order.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Order-objects as value to a dart map
|
||||
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Order>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Order>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Order.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Order.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -126,7 +139,7 @@ class OrderStatusEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -144,20 +157,18 @@ class OrderStatusEnum {
|
||||
static OrderStatusEnum fromJson(dynamic value) =>
|
||||
OrderStatusEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<OrderStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OrderStatusEnum>[]
|
||||
: json
|
||||
.map((value) => OrderStatusEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OrderStatusEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OrderStatusEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OrderStatusEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String,
|
||||
/// and [decode] dynamic data back to [OrderStatusEnum].
|
||||
class OrderStatusEnumTypeTransformer {
|
||||
const OrderStatusEnumTypeTransformer._();
|
||||
factory OrderStatusEnumTypeTransformer() => _instance ??= const OrderStatusEnumTypeTransformer._();
|
||||
|
||||
factory OrderStatusEnumTypeTransformer() => _instance ??= OrderStatusEnumTypeTransformer._();
|
||||
const OrderStatusEnumTypeTransformer._();
|
||||
|
||||
String encode(OrderStatusEnum data) => data.value;
|
||||
|
||||
@ -170,14 +181,16 @@ class OrderStatusEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OrderStatusEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'placed': return OrderStatusEnum.placed;
|
||||
case r'approved': return OrderStatusEnum.approved;
|
||||
case r'delivered': return OrderStatusEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'placed': return OrderStatusEnum.placed;
|
||||
case r'approved': return OrderStatusEnum.approved;
|
||||
case r'delivered': return OrderStatusEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -186,3 +199,4 @@ class OrderStatusEnumTypeTransformer {
|
||||
static OrderStatusEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -44,6 +45,7 @@ class Pet {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(category == null ? 0 : category.hashCode) +
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
@ -74,40 +76,53 @@ class Pet {
|
||||
}
|
||||
|
||||
/// Returns a new [Pet] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Pet fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Pet(
|
||||
id: json[r'id'],
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Pet fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Pet(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
category: Category.fromJson(json[r'category']),
|
||||
name: json[r'name'],
|
||||
photoUrls: json[r'photoUrls'] == null
|
||||
? null
|
||||
: (json[r'photoUrls'] as List).cast<String>(),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
photoUrls: json[r'photoUrls'] is List
|
||||
? (json[r'photoUrls'] as List).cast<String>()
|
||||
: null,
|
||||
tags: Tag.listFromJson(json[r'tags']),
|
||||
status: PetStatusEnum.fromJson(json[r'status']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Pet> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Pet>[]
|
||||
: json.map((dynamic value) => Pet.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Pet> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Pet.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Pet>[];
|
||||
|
||||
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Pet> mapFromJson(dynamic json) {
|
||||
final map = <String, Pet>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Pet.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Pet.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Pet-objects as value to a dart map
|
||||
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Pet>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Pet>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Pet.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Pet.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -122,7 +137,7 @@ class PetStatusEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -140,20 +155,18 @@ class PetStatusEnum {
|
||||
static PetStatusEnum fromJson(dynamic value) =>
|
||||
PetStatusEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<PetStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <PetStatusEnum>[]
|
||||
: json
|
||||
.map((value) => PetStatusEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<PetStatusEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(PetStatusEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <PetStatusEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [PetStatusEnum] to String,
|
||||
/// and [decode] dynamic data back to [PetStatusEnum].
|
||||
class PetStatusEnumTypeTransformer {
|
||||
const PetStatusEnumTypeTransformer._();
|
||||
factory PetStatusEnumTypeTransformer() => _instance ??= const PetStatusEnumTypeTransformer._();
|
||||
|
||||
factory PetStatusEnumTypeTransformer() => _instance ??= PetStatusEnumTypeTransformer._();
|
||||
const PetStatusEnumTypeTransformer._();
|
||||
|
||||
String encode(PetStatusEnum data) => data.value;
|
||||
|
||||
@ -166,14 +179,16 @@ class PetStatusEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
PetStatusEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'available': return PetStatusEnum.available;
|
||||
case r'pending': return PetStatusEnum.pending;
|
||||
case r'sold': return PetStatusEnum.sold;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'available': return PetStatusEnum.available;
|
||||
case r'pending': return PetStatusEnum.pending;
|
||||
case r'sold': return PetStatusEnum.sold;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -182,3 +197,4 @@ class PetStatusEnumTypeTransformer {
|
||||
static PetStatusEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Tag {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(name == null ? 0 : name.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class Tag {
|
||||
}
|
||||
|
||||
/// Returns a new [Tag] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Tag fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Tag(
|
||||
id: json[r'id'],
|
||||
name: json[r'name'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Tag fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Tag(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Tag> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Tag>[]
|
||||
: json.map((dynamic value) => Tag.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Tag> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Tag.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Tag>[];
|
||||
|
||||
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Tag> mapFromJson(dynamic json) {
|
||||
final map = <String, Tag>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Tag.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Tag.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Tag-objects as value to a dart map
|
||||
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Tag>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Tag>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Tag.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Tag.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -52,6 +53,7 @@ class User {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(username == null ? 0 : username.hashCode) +
|
||||
(firstName == null ? 0 : firstName.hashCode) +
|
||||
@ -94,40 +96,53 @@ class User {
|
||||
}
|
||||
|
||||
/// Returns a new [User] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static User fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: User(
|
||||
id: json[r'id'],
|
||||
username: json[r'username'],
|
||||
firstName: json[r'firstName'],
|
||||
lastName: json[r'lastName'],
|
||||
email: json[r'email'],
|
||||
password: json[r'password'],
|
||||
phone: json[r'phone'],
|
||||
userStatus: json[r'userStatus'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static User fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return User(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
username: mapValueOfType<String>(json, r'username'),
|
||||
firstName: mapValueOfType<String>(json, r'firstName'),
|
||||
lastName: mapValueOfType<String>(json, r'lastName'),
|
||||
email: mapValueOfType<String>(json, r'email'),
|
||||
password: mapValueOfType<String>(json, r'password'),
|
||||
phone: mapValueOfType<String>(json, r'phone'),
|
||||
userStatus: mapValueOfType<int>(json, r'userStatus'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<User> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <User>[]
|
||||
: json.map((dynamic value) => User.fromJson(value)).toList(growable: true == growable);
|
||||
static List<User> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(User.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <User>[];
|
||||
|
||||
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, User> mapFromJson(dynamic json) {
|
||||
final map = <String, User>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = User.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = User.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of User-objects as value to a dart map
|
||||
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<User>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<User>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = User.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = User.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: true
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
library openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,33 +26,34 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient) async {
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async {
|
||||
// Verify required params are set.
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/another-fake/dummy';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PATCH',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -64,8 +66,8 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<ModelClient> call123testSpecialTags(ModelClient modelClient) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(modelClient);
|
||||
Future<ModelClient> call123testSpecialTags(ModelClient modelClient,) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(modelClient,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -75,6 +77,6 @@ class AnotherFakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient;
|
||||
}
|
||||
return Future<ModelClient>.value(null);
|
||||
return Future<ModelClient>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -17,27 +18,28 @@ class DefaultApi {
|
||||
|
||||
/// Performs an HTTP 'GET /foo' operation and returns the [Response].
|
||||
Future<Response> fooGetWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/foo';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -53,6 +55,6 @@ class DefaultApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'InlineResponseDefault',) as InlineResponseDefault;
|
||||
}
|
||||
return Future<InlineResponseDefault>.value(null);
|
||||
return Future<InlineResponseDefault>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -19,27 +20,28 @@ class FakeApi {
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> fakeHealthGetWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/health';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -56,7 +58,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult;
|
||||
}
|
||||
return Future<HealthCheckResult>.value(null);
|
||||
return Future<HealthCheckResult>.value();
|
||||
}
|
||||
|
||||
/// test http signature authentication
|
||||
@ -73,14 +75,16 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] header1:
|
||||
/// header parameter
|
||||
Future<Response> fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1 }) async {
|
||||
Future<Response> fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1, }) async {
|
||||
// Verify required params are set.
|
||||
if (pet == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/http-signature-test';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = pet;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -95,19 +99,18 @@ class FakeApi {
|
||||
headerParams[r'header_1'] = parameterToString(header1);
|
||||
}
|
||||
|
||||
final contentTypes = <String>['application/json', 'application/xml'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['http_signature_test'];
|
||||
const authNames = <String>['http_signature_test'];
|
||||
const contentTypes = <String>['application/json', 'application/xml'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -124,8 +127,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] header1:
|
||||
/// header parameter
|
||||
Future<void> fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async {
|
||||
final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1 );
|
||||
Future<void> fakeHttpSignatureTest(Pet pet, { String query1, String header1, }) async {
|
||||
final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -139,30 +142,31 @@ class FakeApi {
|
||||
///
|
||||
/// * [bool] body:
|
||||
/// Input boolean as post body
|
||||
Future<Response> fakeOuterBooleanSerializeWithHttpInfo({ bool body }) async {
|
||||
Future<Response> fakeOuterBooleanSerializeWithHttpInfo({ bool body, }) async {
|
||||
// Verify required params are set.
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/outer/boolean';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = body;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -173,8 +177,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [bool] body:
|
||||
/// Input boolean as post body
|
||||
Future<bool> fakeOuterBooleanSerialize({ bool body }) async {
|
||||
final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body );
|
||||
Future<bool> fakeOuterBooleanSerialize({ bool body, }) async {
|
||||
final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -184,7 +188,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool;
|
||||
}
|
||||
return Future<bool>.value(null);
|
||||
return Future<bool>.value();
|
||||
}
|
||||
|
||||
/// Test serialization of object with outer number type
|
||||
@ -195,30 +199,31 @@ class FakeApi {
|
||||
///
|
||||
/// * [OuterComposite] outerComposite:
|
||||
/// Input composite as post body
|
||||
Future<Response> fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite }) async {
|
||||
Future<Response> fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite, }) async {
|
||||
// Verify required params are set.
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/outer/composite';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = outerComposite;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -229,8 +234,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [OuterComposite] outerComposite:
|
||||
/// Input composite as post body
|
||||
Future<OuterComposite> fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async {
|
||||
final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite );
|
||||
Future<OuterComposite> fakeOuterCompositeSerialize({ OuterComposite outerComposite, }) async {
|
||||
final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -240,7 +245,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite;
|
||||
}
|
||||
return Future<OuterComposite>.value(null);
|
||||
return Future<OuterComposite>.value();
|
||||
}
|
||||
|
||||
/// Test serialization of outer number types
|
||||
@ -251,30 +256,31 @@ class FakeApi {
|
||||
///
|
||||
/// * [num] body:
|
||||
/// Input number as post body
|
||||
Future<Response> fakeOuterNumberSerializeWithHttpInfo({ num body }) async {
|
||||
Future<Response> fakeOuterNumberSerializeWithHttpInfo({ num body, }) async {
|
||||
// Verify required params are set.
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/outer/number';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = body;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -285,8 +291,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [num] body:
|
||||
/// Input number as post body
|
||||
Future<num> fakeOuterNumberSerialize({ num body }) async {
|
||||
final response = await fakeOuterNumberSerializeWithHttpInfo( body: body );
|
||||
Future<num> fakeOuterNumberSerialize({ num body, }) async {
|
||||
final response = await fakeOuterNumberSerializeWithHttpInfo( body: body, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -296,7 +302,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num;
|
||||
}
|
||||
return Future<num>.value(null);
|
||||
return Future<num>.value();
|
||||
}
|
||||
|
||||
/// Test serialization of outer string types
|
||||
@ -307,30 +313,31 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] body:
|
||||
/// Input string as post body
|
||||
Future<Response> fakeOuterStringSerializeWithHttpInfo({ String body }) async {
|
||||
Future<Response> fakeOuterStringSerializeWithHttpInfo({ String body, }) async {
|
||||
// Verify required params are set.
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/outer/string';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = body;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -341,8 +348,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] body:
|
||||
/// Input string as post body
|
||||
Future<String> fakeOuterStringSerialize({ String body }) async {
|
||||
final response = await fakeOuterStringSerializeWithHttpInfo( body: body );
|
||||
Future<String> fakeOuterStringSerialize({ String body, }) async {
|
||||
final response = await fakeOuterStringSerializeWithHttpInfo( body: body, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -352,7 +359,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
|
||||
}
|
||||
return Future<String>.value(null);
|
||||
return Future<String>.value();
|
||||
}
|
||||
|
||||
/// Test serialization of enum (int) properties with examples
|
||||
@ -363,33 +370,34 @@ class FakeApi {
|
||||
///
|
||||
/// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
|
||||
/// Input enum (int) as post body
|
||||
Future<Response> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
|
||||
Future<Response> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async {
|
||||
// Verify required params are set.
|
||||
if (outerObjectWithEnumProperty == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/property/enum-int';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = outerObjectWithEnumProperty;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -400,8 +408,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
|
||||
/// Input enum (int) as post body
|
||||
Future<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
|
||||
final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty);
|
||||
Future<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async {
|
||||
final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -411,7 +419,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty;
|
||||
}
|
||||
return Future<OuterObjectWithEnumProperty>.value(null);
|
||||
return Future<OuterObjectWithEnumProperty>.value();
|
||||
}
|
||||
|
||||
/// For this test, the body has to be a binary file.
|
||||
@ -422,33 +430,34 @@ class FakeApi {
|
||||
///
|
||||
/// * [MultipartFile] body (required):
|
||||
/// image to upload
|
||||
Future<Response> testBodyWithBinaryWithHttpInfo(MultipartFile body) async {
|
||||
Future<Response> testBodyWithBinaryWithHttpInfo(MultipartFile body,) async {
|
||||
// Verify required params are set.
|
||||
if (body == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: body');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/body-with-binary';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = body;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['image/png'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['image/png'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -459,8 +468,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [MultipartFile] body (required):
|
||||
/// image to upload
|
||||
Future<void> testBodyWithBinary(MultipartFile body) async {
|
||||
final response = await testBodyWithBinaryWithHttpInfo(body);
|
||||
Future<void> testBodyWithBinary(MultipartFile body,) async {
|
||||
final response = await testBodyWithBinaryWithHttpInfo(body,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -473,33 +482,34 @@ class FakeApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [FileSchemaTestClass] fileSchemaTestClass (required):
|
||||
Future<Response> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) async {
|
||||
Future<Response> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async {
|
||||
// Verify required params are set.
|
||||
if (fileSchemaTestClass == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/body-with-file-schema';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = fileSchemaTestClass;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -509,8 +519,8 @@ class FakeApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [FileSchemaTestClass] fileSchemaTestClass (required):
|
||||
Future<void> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async {
|
||||
final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass);
|
||||
Future<void> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async {
|
||||
final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -522,7 +532,7 @@ class FakeApi {
|
||||
/// * [String] query (required):
|
||||
///
|
||||
/// * [User] user (required):
|
||||
Future<Response> testBodyWithQueryParamsWithHttpInfo(String query, User user) async {
|
||||
Future<Response> testBodyWithQueryParamsWithHttpInfo(String query, User user,) async {
|
||||
// Verify required params are set.
|
||||
if (query == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: query');
|
||||
@ -531,8 +541,10 @@ class FakeApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/body-with-query-params';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -541,19 +553,18 @@ class FakeApi {
|
||||
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query));
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -563,8 +574,8 @@ class FakeApi {
|
||||
/// * [String] query (required):
|
||||
///
|
||||
/// * [User] user (required):
|
||||
Future<void> testBodyWithQueryParams(String query, User user) async {
|
||||
final response = await testBodyWithQueryParamsWithHttpInfo(query, user);
|
||||
Future<void> testBodyWithQueryParams(String query, User user,) async {
|
||||
final response = await testBodyWithQueryParamsWithHttpInfo(query, user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -580,33 +591,34 @@ class FakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> testClientModelWithHttpInfo(ModelClient modelClient) async {
|
||||
Future<Response> testClientModelWithHttpInfo(ModelClient modelClient,) async {
|
||||
// Verify required params are set.
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PATCH',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -619,8 +631,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<ModelClient> testClientModel(ModelClient modelClient) async {
|
||||
final response = await testClientModelWithHttpInfo(modelClient);
|
||||
Future<ModelClient> testClientModel(ModelClient modelClient,) async {
|
||||
final response = await testClientModelWithHttpInfo(modelClient,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -630,7 +642,7 @@ class FakeApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient;
|
||||
}
|
||||
return Future<ModelClient>.value(null);
|
||||
return Future<ModelClient>.value();
|
||||
}
|
||||
|
||||
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -682,7 +694,7 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] callback:
|
||||
/// None
|
||||
Future<Response> testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async {
|
||||
Future<Response> testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async {
|
||||
// Verify required params are set.
|
||||
if (number == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: number');
|
||||
@ -697,17 +709,18 @@ class FakeApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: byte');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['http_basic_test'];
|
||||
const authNames = <String>['http_basic_test'];
|
||||
const contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
|
||||
if (integer != null) {
|
||||
formParams[r'integer'] = parameterToString(integer);
|
||||
@ -749,14 +762,14 @@ class FakeApi {
|
||||
formParams[r'callback'] = parameterToString(callback);
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -808,8 +821,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] callback:
|
||||
/// None
|
||||
Future<void> testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async {
|
||||
final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback );
|
||||
Future<void> testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback, }) async {
|
||||
final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -846,11 +859,13 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] enumFormString:
|
||||
/// Form parameter enum test (string)
|
||||
Future<Response> testEnumParametersWithHttpInfo({ List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List<String> enumFormStringArray, String enumFormString }) async {
|
||||
Future<Response> testEnumParametersWithHttpInfo({ List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List<String> enumFormStringArray, String enumFormString, }) async {
|
||||
// Verify required params are set.
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -877,9 +892,8 @@ class FakeApi {
|
||||
headerParams[r'enum_header_string'] = parameterToString(enumHeaderString);
|
||||
}
|
||||
|
||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
|
||||
if (enumFormStringArray != null) {
|
||||
formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray);
|
||||
@ -888,14 +902,14 @@ class FakeApi {
|
||||
formParams[r'enum_form_string'] = parameterToString(enumFormString);
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -929,8 +943,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] enumFormString:
|
||||
/// Form parameter enum test (string)
|
||||
Future<void> testEnumParameters({ List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List<String> enumFormStringArray, String enumFormString }) async {
|
||||
final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString );
|
||||
Future<void> testEnumParameters({ List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List<String> enumFormStringArray, String enumFormString, }) async {
|
||||
final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -961,7 +975,7 @@ class FakeApi {
|
||||
///
|
||||
/// * [int] int64Group:
|
||||
/// Integer in group parameters
|
||||
Future<Response> testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async {
|
||||
Future<Response> testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async {
|
||||
// Verify required params are set.
|
||||
if (requiredStringGroup == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup');
|
||||
@ -973,8 +987,10 @@ class FakeApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -995,19 +1011,18 @@ class FakeApi {
|
||||
headerParams[r'boolean_group'] = parameterToString(booleanGroup);
|
||||
}
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer_test'];
|
||||
const authNames = <String>['bearer_test'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -1035,8 +1050,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [int] int64Group:
|
||||
/// Integer in group parameters
|
||||
Future<void> testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async {
|
||||
final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group );
|
||||
Future<void> testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group, }) async {
|
||||
final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -1050,33 +1065,34 @@ class FakeApi {
|
||||
///
|
||||
/// * [Map<String, String>] requestBody (required):
|
||||
/// request body
|
||||
Future<Response> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> requestBody) async {
|
||||
Future<Response> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> requestBody,) async {
|
||||
// Verify required params are set.
|
||||
if (requestBody == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/inline-additionalProperties';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = requestBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -1087,8 +1103,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [Map<String, String>] requestBody (required):
|
||||
/// request body
|
||||
Future<void> testInlineAdditionalProperties(Map<String, String> requestBody) async {
|
||||
final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody);
|
||||
Future<void> testInlineAdditionalProperties(Map<String, String> requestBody,) async {
|
||||
final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -1105,7 +1121,7 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] param2 (required):
|
||||
/// field2
|
||||
Future<Response> testJsonFormDataWithHttpInfo(String param, String param2) async {
|
||||
Future<Response> testJsonFormDataWithHttpInfo(String param, String param2,) async {
|
||||
// Verify required params are set.
|
||||
if (param == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: param');
|
||||
@ -1114,17 +1130,18 @@ class FakeApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: param2');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/jsonFormData';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
|
||||
if (param != null) {
|
||||
formParams[r'param'] = parameterToString(param);
|
||||
@ -1133,14 +1150,14 @@ class FakeApi {
|
||||
formParams[r'param2'] = parameterToString(param2);
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -1154,8 +1171,8 @@ class FakeApi {
|
||||
///
|
||||
/// * [String] param2 (required):
|
||||
/// field2
|
||||
Future<void> testJsonFormData(String param, String param2) async {
|
||||
final response = await testJsonFormDataWithHttpInfo(param, param2);
|
||||
Future<void> testJsonFormData(String param, String param2,) async {
|
||||
final response = await testJsonFormDataWithHttpInfo(param, param2,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -1180,7 +1197,7 @@ class FakeApi {
|
||||
/// * [String] allowEmpty (required):
|
||||
///
|
||||
/// * [Map<String, String>] language:
|
||||
Future<Response> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, { Map<String, String> language }) async {
|
||||
Future<Response> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, { Map<String, String> language, }) async {
|
||||
// Verify required params are set.
|
||||
if (pipe == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe');
|
||||
@ -1201,8 +1218,10 @@ class FakeApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: allowEmpty');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/test-query-parameters';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -1219,19 +1238,18 @@ class FakeApi {
|
||||
}
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'allowEmpty', allowEmpty));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -1253,8 +1271,8 @@ class FakeApi {
|
||||
/// * [String] allowEmpty (required):
|
||||
///
|
||||
/// * [Map<String, String>] language:
|
||||
Future<void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, { Map<String, String> language }) async {
|
||||
final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language );
|
||||
Future<void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, { Map<String, String> language, }) async {
|
||||
final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,33 +26,34 @@ class FakeClassnameTags123Api {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> testClassnameWithHttpInfo(ModelClient modelClient) async {
|
||||
Future<Response> testClassnameWithHttpInfo(ModelClient modelClient,) async {
|
||||
// Verify required params are set.
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake_classname_test';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key_query'];
|
||||
const authNames = <String>['api_key_query'];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PATCH',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -64,8 +66,8 @@ class FakeClassnameTags123Api {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<ModelClient> testClassname(ModelClient modelClient) async {
|
||||
final response = await testClassnameWithHttpInfo(modelClient);
|
||||
Future<ModelClient> testClassname(ModelClient modelClient,) async {
|
||||
final response = await testClassnameWithHttpInfo(modelClient,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -75,6 +77,6 @@ class FakeClassnameTags123Api {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient;
|
||||
}
|
||||
return Future<ModelClient>.value(null);
|
||||
return Future<ModelClient>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,33 +24,34 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Response> addPetWithHttpInfo(Pet pet) async {
|
||||
Future<Response> addPetWithHttpInfo(Pet pet,) async {
|
||||
// Verify required params are set.
|
||||
if (pet == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = pet;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json', 'application/xml'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/json', 'application/xml'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -60,8 +62,8 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<void> addPet(Pet pet) async {
|
||||
final response = await addPetWithHttpInfo(pet);
|
||||
Future<void> addPet(Pet pet,) async {
|
||||
final response = await addPetWithHttpInfo(pet,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -77,15 +79,17 @@ class PetApi {
|
||||
/// Pet id to delete
|
||||
///
|
||||
/// * [String] apiKey:
|
||||
Future<Response> deletePetWithHttpInfo(int petId, { String apiKey }) async {
|
||||
Future<Response> deletePetWithHttpInfo(int petId, { String apiKey, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -96,19 +100,18 @@ class PetApi {
|
||||
headerParams[r'api_key'] = parameterToString(apiKey);
|
||||
}
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -121,8 +124,8 @@ class PetApi {
|
||||
/// Pet id to delete
|
||||
///
|
||||
/// * [String] apiKey:
|
||||
Future<void> deletePet(int petId, { String apiKey }) async {
|
||||
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey );
|
||||
Future<void> deletePet(int petId, { String apiKey, }) async {
|
||||
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -138,14 +141,16 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] status (required):
|
||||
/// Status values that need to be considered for filter
|
||||
Future<Response> findPetsByStatusWithHttpInfo(List<String> status) async {
|
||||
Future<Response> findPetsByStatusWithHttpInfo(List<String> status,) async {
|
||||
// Verify required params are set.
|
||||
if (status == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: status');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/findByStatus';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -154,19 +159,18 @@ class PetApi {
|
||||
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -179,8 +183,8 @@ class PetApi {
|
||||
///
|
||||
/// * [List<String>] status (required):
|
||||
/// Status values that need to be considered for filter
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
||||
final response = await findPetsByStatusWithHttpInfo(status);
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status,) async {
|
||||
final response = await findPetsByStatusWithHttpInfo(status,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -188,11 +192,12 @@ class PetApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'List<Pet>') as List)
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<Pet>') as List)
|
||||
.cast<Pet>()
|
||||
.toList(growable: false);
|
||||
}
|
||||
return Future<List<Pet>>.value(null);
|
||||
return Future<List<Pet>>.value();
|
||||
}
|
||||
|
||||
/// Finds Pets by tags
|
||||
@ -205,14 +210,16 @@ class PetApi {
|
||||
///
|
||||
/// * [Set<String>] tags (required):
|
||||
/// Tags to filter by
|
||||
Future<Response> findPetsByTagsWithHttpInfo(Set<String> tags) async {
|
||||
Future<Response> findPetsByTagsWithHttpInfo(Set<String> tags,) async {
|
||||
// Verify required params are set.
|
||||
if (tags == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: tags');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/findByTags';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -221,19 +228,18 @@ class PetApi {
|
||||
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -246,8 +252,8 @@ class PetApi {
|
||||
///
|
||||
/// * [Set<String>] tags (required):
|
||||
/// Tags to filter by
|
||||
Future<Set<Pet>> findPetsByTags(Set<String> tags) async {
|
||||
final response = await findPetsByTagsWithHttpInfo(tags);
|
||||
Future<Set<Pet>> findPetsByTags(Set<String> tags,) async {
|
||||
final response = await findPetsByTagsWithHttpInfo(tags,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -255,11 +261,12 @@ class PetApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return (await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Set<Pet>') as List)
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'Set<Pet>') as List)
|
||||
.cast<Pet>()
|
||||
.toSet();
|
||||
}
|
||||
return Future<Set<Pet>>.value(null);
|
||||
return Future<Set<Pet>>.value();
|
||||
}
|
||||
|
||||
/// Find pet by ID
|
||||
@ -272,34 +279,35 @@ class PetApi {
|
||||
///
|
||||
/// * [int] petId (required):
|
||||
/// ID of pet to return
|
||||
Future<Response> getPetByIdWithHttpInfo(int petId) async {
|
||||
Future<Response> getPetByIdWithHttpInfo(int petId,) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -312,8 +320,8 @@ class PetApi {
|
||||
///
|
||||
/// * [int] petId (required):
|
||||
/// ID of pet to return
|
||||
Future<Pet> getPetById(int petId) async {
|
||||
final response = await getPetByIdWithHttpInfo(petId);
|
||||
Future<Pet> getPetById(int petId,) async {
|
||||
final response = await getPetByIdWithHttpInfo(petId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -323,7 +331,7 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
|
||||
}
|
||||
return Future<Pet>.value(null);
|
||||
return Future<Pet>.value();
|
||||
}
|
||||
|
||||
/// Update an existing pet
|
||||
@ -334,33 +342,34 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<Response> updatePetWithHttpInfo(Pet pet) async {
|
||||
Future<Response> updatePetWithHttpInfo(Pet pet,) async {
|
||||
// Verify required params are set.
|
||||
if (pet == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = pet;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json', 'application/xml'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/json', 'application/xml'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -371,8 +380,8 @@ class PetApi {
|
||||
///
|
||||
/// * [Pet] pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
Future<void> updatePet(Pet pet) async {
|
||||
final response = await updatePetWithHttpInfo(pet);
|
||||
Future<void> updatePet(Pet pet,) async {
|
||||
final response = await updatePetWithHttpInfo(pet,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -392,24 +401,25 @@ class PetApi {
|
||||
///
|
||||
/// * [String] status:
|
||||
/// Updated status of the pet
|
||||
Future<Response> updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async {
|
||||
Future<Response> updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||
|
||||
if (name != null) {
|
||||
formParams[r'name'] = parameterToString(name);
|
||||
@ -418,14 +428,14 @@ class PetApi {
|
||||
formParams[r'status'] = parameterToString(status);
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -442,8 +452,8 @@ class PetApi {
|
||||
///
|
||||
/// * [String] status:
|
||||
/// Updated status of the pet
|
||||
Future<void> updatePetWithForm(int petId, { String name, String status }) async {
|
||||
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status );
|
||||
Future<void> updatePetWithForm(int petId, { String name, String status, }) async {
|
||||
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -463,24 +473,25 @@ class PetApi {
|
||||
///
|
||||
/// * [MultipartFile] file:
|
||||
/// file to upload
|
||||
Future<Response> uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||
Future<Response> uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/pet/{petId}/uploadImage'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['multipart/form-data'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['multipart/form-data'];
|
||||
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest('POST', Uri.parse(path));
|
||||
@ -497,14 +508,14 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -521,8 +532,8 @@ class PetApi {
|
||||
///
|
||||
/// * [MultipartFile] file:
|
||||
/// file to upload
|
||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
||||
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file );
|
||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async {
|
||||
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -532,7 +543,7 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse;
|
||||
}
|
||||
return Future<ApiResponse>.value(null);
|
||||
return Future<ApiResponse>.value();
|
||||
}
|
||||
|
||||
/// uploads an image (required)
|
||||
@ -549,7 +560,7 @@ class PetApi {
|
||||
///
|
||||
/// * [String] additionalMetadata:
|
||||
/// Additional data to pass to server
|
||||
Future<Response> uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata }) async {
|
||||
Future<Response> uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async {
|
||||
// Verify required params are set.
|
||||
if (petId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
|
||||
@ -558,18 +569,19 @@ class PetApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/fake/{petId}/uploadImageWithRequiredFile'
|
||||
.replaceAll('{' + 'petId' + '}', petId.toString());
|
||||
.replaceAll('{petId}', petId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['multipart/form-data'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['petstore_auth'];
|
||||
const authNames = <String>['petstore_auth'];
|
||||
const contentTypes = <String>['multipart/form-data'];
|
||||
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest('POST', Uri.parse(path));
|
||||
@ -586,14 +598,14 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -610,8 +622,8 @@ class PetApi {
|
||||
///
|
||||
/// * [String] additionalMetadata:
|
||||
/// Additional data to pass to server
|
||||
Future<ApiResponse> uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async {
|
||||
final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata );
|
||||
Future<ApiResponse> uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata, }) async {
|
||||
final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -621,6 +633,6 @@ class PetApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse;
|
||||
}
|
||||
return Future<ApiResponse>.value(null);
|
||||
return Future<ApiResponse>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,34 +26,35 @@ class StoreApi {
|
||||
///
|
||||
/// * [String] orderId (required):
|
||||
/// ID of the order that needs to be deleted
|
||||
Future<Response> deleteOrderWithHttpInfo(String orderId) async {
|
||||
Future<Response> deleteOrderWithHttpInfo(String orderId,) async {
|
||||
// Verify required params are set.
|
||||
if (orderId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order/{order_id}'
|
||||
.replaceAll('{' + 'order_id' + '}', orderId.toString());
|
||||
.replaceAll('{order_id}', orderId);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -65,8 +67,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [String] orderId (required):
|
||||
/// ID of the order that needs to be deleted
|
||||
Future<void> deleteOrder(String orderId) async {
|
||||
final response = await deleteOrderWithHttpInfo(orderId);
|
||||
Future<void> deleteOrder(String orderId,) async {
|
||||
final response = await deleteOrderWithHttpInfo(orderId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -78,27 +80,28 @@ class StoreApi {
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> getInventoryWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/inventory';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['api_key'];
|
||||
const authNames = <String>['api_key'];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -117,7 +120,7 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return Map<String, int>.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map<String, int>'),);
|
||||
}
|
||||
return Future<Map<String, int>>.value(null);
|
||||
return Future<Map<String, int>>.value();
|
||||
}
|
||||
|
||||
/// Find purchase order by ID
|
||||
@ -130,34 +133,35 @@ class StoreApi {
|
||||
///
|
||||
/// * [int] orderId (required):
|
||||
/// ID of pet that needs to be fetched
|
||||
Future<Response> getOrderByIdWithHttpInfo(int orderId) async {
|
||||
Future<Response> getOrderByIdWithHttpInfo(int orderId,) async {
|
||||
// Verify required params are set.
|
||||
if (orderId == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order/{order_id}'
|
||||
.replaceAll('{' + 'order_id' + '}', orderId.toString());
|
||||
.replaceAll('{order_id}', orderId.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -170,8 +174,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [int] orderId (required):
|
||||
/// ID of pet that needs to be fetched
|
||||
Future<Order> getOrderById(int orderId) async {
|
||||
final response = await getOrderByIdWithHttpInfo(orderId);
|
||||
Future<Order> getOrderById(int orderId,) async {
|
||||
final response = await getOrderByIdWithHttpInfo(orderId,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -181,7 +185,7 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
|
||||
}
|
||||
return Future<Order>.value(null);
|
||||
return Future<Order>.value();
|
||||
}
|
||||
|
||||
/// Place an order for a pet
|
||||
@ -192,33 +196,34 @@ class StoreApi {
|
||||
///
|
||||
/// * [Order] order (required):
|
||||
/// order placed for purchasing the pet
|
||||
Future<Response> placeOrderWithHttpInfo(Order order) async {
|
||||
Future<Response> placeOrderWithHttpInfo(Order order,) async {
|
||||
// Verify required params are set.
|
||||
if (order == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: order');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/store/order';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = order;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -229,8 +234,8 @@ class StoreApi {
|
||||
///
|
||||
/// * [Order] order (required):
|
||||
/// order placed for purchasing the pet
|
||||
Future<Order> placeOrder(Order order) async {
|
||||
final response = await placeOrderWithHttpInfo(order);
|
||||
Future<Order> placeOrder(Order order,) async {
|
||||
final response = await placeOrderWithHttpInfo(order,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -240,6 +245,6 @@ class StoreApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
|
||||
}
|
||||
return Future<Order>.value(null);
|
||||
return Future<Order>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,33 +26,34 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Created user object
|
||||
Future<Response> createUserWithHttpInfo(User user) async {
|
||||
Future<Response> createUserWithHttpInfo(User user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -64,8 +66,8 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Created user object
|
||||
Future<void> createUser(User user) async {
|
||||
final response = await createUserWithHttpInfo(user);
|
||||
Future<void> createUser(User user,) async {
|
||||
final response = await createUserWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -79,33 +81,34 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<Response> createUsersWithArrayInputWithHttpInfo(List<User> user) async {
|
||||
Future<Response> createUsersWithArrayInputWithHttpInfo(List<User> user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/createWithArray';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -116,8 +119,8 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<void> createUsersWithArrayInput(List<User> user) async {
|
||||
final response = await createUsersWithArrayInputWithHttpInfo(user);
|
||||
Future<void> createUsersWithArrayInput(List<User> user,) async {
|
||||
final response = await createUsersWithArrayInputWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -131,33 +134,34 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<Response> createUsersWithListInputWithHttpInfo(List<User> user) async {
|
||||
Future<Response> createUsersWithListInputWithHttpInfo(List<User> user,) async {
|
||||
// Verify required params are set.
|
||||
if (user == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/createWithList';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -168,8 +172,8 @@ class UserApi {
|
||||
///
|
||||
/// * [List<User>] user (required):
|
||||
/// List of user object
|
||||
Future<void> createUsersWithListInput(List<User> user) async {
|
||||
final response = await createUsersWithListInputWithHttpInfo(user);
|
||||
Future<void> createUsersWithListInput(List<User> user,) async {
|
||||
final response = await createUsersWithListInputWithHttpInfo(user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -185,34 +189,35 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be deleted
|
||||
Future<Response> deleteUserWithHttpInfo(String username) async {
|
||||
Future<Response> deleteUserWithHttpInfo(String username,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -225,8 +230,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be deleted
|
||||
Future<void> deleteUser(String username) async {
|
||||
final response = await deleteUserWithHttpInfo(username);
|
||||
Future<void> deleteUser(String username,) async {
|
||||
final response = await deleteUserWithHttpInfo(username,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -240,34 +245,35 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be fetched. Use user1 for testing.
|
||||
Future<Response> getUserByNameWithHttpInfo(String username) async {
|
||||
Future<Response> getUserByNameWithHttpInfo(String username,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -278,8 +284,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] username (required):
|
||||
/// The name that needs to be fetched. Use user1 for testing.
|
||||
Future<User> getUserByName(String username) async {
|
||||
final response = await getUserByNameWithHttpInfo(username);
|
||||
Future<User> getUserByName(String username,) async {
|
||||
final response = await getUserByNameWithHttpInfo(username,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -289,7 +295,7 @@ class UserApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User;
|
||||
}
|
||||
return Future<User>.value(null);
|
||||
return Future<User>.value();
|
||||
}
|
||||
|
||||
/// Logs user into the system
|
||||
@ -303,7 +309,7 @@ class UserApi {
|
||||
///
|
||||
/// * [String] password (required):
|
||||
/// The password for login in clear text
|
||||
Future<Response> loginUserWithHttpInfo(String username, String password) async {
|
||||
Future<Response> loginUserWithHttpInfo(String username, String password,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
@ -312,8 +318,10 @@ class UserApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: password');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/login';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
@ -323,19 +331,18 @@ class UserApi {
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username));
|
||||
queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password));
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -349,8 +356,8 @@ class UserApi {
|
||||
///
|
||||
/// * [String] password (required):
|
||||
/// The password for login in clear text
|
||||
Future<String> loginUser(String username, String password) async {
|
||||
final response = await loginUserWithHttpInfo(username, password);
|
||||
Future<String> loginUser(String username, String password,) async {
|
||||
final response = await loginUserWithHttpInfo(username, password,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -360,34 +367,35 @@ class UserApi {
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
|
||||
}
|
||||
return Future<String>.value(null);
|
||||
return Future<String>.value();
|
||||
}
|
||||
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> logoutUserWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/logout';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -413,7 +421,7 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Updated user object
|
||||
Future<Response> updateUserWithHttpInfo(String username, User user) async {
|
||||
Future<Response> updateUserWithHttpInfo(String username, User user,) async {
|
||||
// Verify required params are set.
|
||||
if (username == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
|
||||
@ -422,28 +430,29 @@ class UserApi {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/user/{username}'
|
||||
.replaceAll('{' + 'username' + '}', username.toString());
|
||||
.replaceAll('{username}', username);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = user;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -459,8 +468,8 @@ class UserApi {
|
||||
///
|
||||
/// * [User] user (required):
|
||||
/// Updated user object
|
||||
Future<void> updateUser(String username, User user) async {
|
||||
final response = await updateUserWithHttpInfo(username, user);
|
||||
Future<void> updateUser(String username, User user,) async {
|
||||
final response = await updateUserWithHttpInfo(username, user,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -80,7 +81,7 @@ class ApiClient {
|
||||
? '?${urlEncodedQueryParams.join('&')}'
|
||||
: '';
|
||||
|
||||
final Uri uri = Uri.parse('$basePath$path$queryString');
|
||||
final uri = Uri.parse('$basePath$path$queryString');
|
||||
|
||||
if (nullableContentType != null) {
|
||||
headerParams['Content-Type'] = nullableContentType;
|
||||
@ -98,7 +99,8 @@ class ApiClient {
|
||||
body.finalize().listen(
|
||||
request.sink.add,
|
||||
onDone: request.sink.close,
|
||||
onError: (error, trace) => request.sink.close(),
|
||||
// ignore: avoid_types_on_closure_parameters
|
||||
onError: (Object error, StackTrace trace) => request.sink.close(),
|
||||
cancelOnError: true,
|
||||
);
|
||||
final response = await _client.send(request);
|
||||
@ -184,18 +186,17 @@ class ApiClient {
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
return '$value';
|
||||
return value is String ? value : value.toString();
|
||||
case 'int':
|
||||
return value is int ? value : int.parse('$value');
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'bool':
|
||||
if (value is bool) {
|
||||
return value;
|
||||
}
|
||||
final valueString = '$value'.toLowerCase();
|
||||
return valueString == 'true' || valueString == '1';
|
||||
break;
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'AdditionalPropertiesClass':
|
||||
return AdditionalPropertiesClass.fromJson(value);
|
||||
case 'Animal':
|
||||
@ -298,25 +299,24 @@ class ApiClient {
|
||||
if (value is List && (match = _regList.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toList(growable: growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return value
|
||||
.map((v) => _deserialize(v, targetType, growable: growable))
|
||||
.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
|
||||
targetType = match[1]; // ignore: parameter_assignments
|
||||
return Map.fromIterables(
|
||||
value.keys,
|
||||
value.values.map((v) => _deserialize(v, targetType, growable: growable)),
|
||||
return Map<String, dynamic>.fromIterables(
|
||||
value.keys.cast<String>(),
|
||||
value.values.map<dynamic>((dynamic v) => _deserialize(v, targetType, growable: growable)),
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error, trace) {
|
||||
} on Exception catch (error, trace) {
|
||||
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
|
||||
}
|
||||
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -30,20 +31,21 @@ Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
// preconditions
|
||||
if (name != null && name.isNotEmpty && value != null) {
|
||||
if (value is List) {
|
||||
// get the collection format, default: csv
|
||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
||||
? 'csv'
|
||||
: collectionFormat;
|
||||
|
||||
if (collectionFormat == 'multi') {
|
||||
return value.map((v) => QueryParam(name, parameterToString(v)));
|
||||
return value.map((dynamic v) => QueryParam(name, parameterToString(v)),);
|
||||
}
|
||||
|
||||
// Default collection format is 'csv'.
|
||||
if (collectionFormat == null || collectionFormat.isEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
collectionFormat = 'csv';
|
||||
}
|
||||
|
||||
final delimiter = _delimiters[collectionFormat] ?? ',';
|
||||
|
||||
params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter)));
|
||||
params.add(QueryParam(name, value.map<dynamic>(parameterToString).join(delimiter)),);
|
||||
} else {
|
||||
params.add(QueryParam(name, parameterToString(value)));
|
||||
params.add(QueryParam(name, parameterToString(value),));
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,3 +86,36 @@ Future<String> _decodeBodyBytes(Response response) async {
|
||||
? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)
|
||||
: response.body;
|
||||
}
|
||||
|
||||
/// Returns a valid [T] value found at the specified Map [key], null otherwise.
|
||||
T mapValueOfType<T>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is T ? value : null;
|
||||
}
|
||||
|
||||
/// Returns a valid Map<K, V> found at the specified Map [key], null otherwise.
|
||||
Map<K, V> mapCastOfType<K, V>(dynamic map, String key) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
return value is Map ? value.cast<K, V>() : null;
|
||||
}
|
||||
|
||||
/// Returns a valid [DateTime] found at the specified Map [key], null otherwise.
|
||||
DateTime mapDateTime(dynamic map, String key, [String pattern]) {
|
||||
final dynamic value = map is Map ? map[key] : null;
|
||||
if (value != null) {
|
||||
int millis;
|
||||
if (value is int) {
|
||||
millis = value;
|
||||
} else if (value is String) {
|
||||
if (pattern == _dateEpochMarker) {
|
||||
millis = int.tryParse(value);
|
||||
} else {
|
||||
return DateTime.tryParse(value);
|
||||
}
|
||||
}
|
||||
if (millis != null) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,9 +28,11 @@ class ApiKeyAuth implements Authentication {
|
||||
} else if (location == 'header' && value != null) {
|
||||
headerParams[paramName] = value;
|
||||
} else if (location == 'cookie' && value != null) {
|
||||
headerParams.update('Cookie', (String existingCookie) {
|
||||
return '$existingCookie; $paramName=$value';
|
||||
}, ifAbsent: () => '$paramName=$value');
|
||||
headerParams.update(
|
||||
'Cookie',
|
||||
(existingCookie) => '$existingCookie; $paramName=$value',
|
||||
ifAbsent: () => '$paramName=$value',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
// ignore: one_member_abstracts
|
||||
abstract class Authentication {
|
||||
/// Apply authentication settings to header and query params.
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -15,7 +16,7 @@ class HttpBasicAuth implements Authentication {
|
||||
|
||||
@override
|
||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
||||
final credentials = (username ?? '') + ':' + (password ?? '');
|
||||
final credentials = '${username ?? ''}:${password ?? ''}';
|
||||
headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -22,7 +23,7 @@ class HttpBearerAuth implements Authentication {
|
||||
if (accessToken is! String && accessToken is! HttpBearerAuthProvider) {
|
||||
throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().');
|
||||
}
|
||||
this._accessToken = accessToken;
|
||||
_accessToken = accessToken;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class AdditionalPropertiesClass {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(mapProperty == null ? 0 : mapProperty.hashCode) +
|
||||
(mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode);
|
||||
|
||||
@ -45,38 +47,47 @@ class AdditionalPropertiesClass {
|
||||
}
|
||||
|
||||
/// Returns a new [AdditionalPropertiesClass] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static AdditionalPropertiesClass fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: AdditionalPropertiesClass(
|
||||
mapProperty: json[r'map_property'] == null ?
|
||||
null :
|
||||
(json[r'map_property'] as Map).cast<String, String>(),
|
||||
mapOfMapProperty: json[r'map_of_map_property'] == null
|
||||
? null
|
||||
: (json[r'map_of_map_property'] as Map).cast<String, Map>(),
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static AdditionalPropertiesClass fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return AdditionalPropertiesClass(
|
||||
mapProperty: mapCastOfType<String, String>(json, r'map_property'),
|
||||
mapOfMapProperty: mapCastOfType<String, dynamic>(json, r'map_of_map_property'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<AdditionalPropertiesClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <AdditionalPropertiesClass>[]
|
||||
: json.map((dynamic value) => AdditionalPropertiesClass.fromJson(value)).toList(growable: true == growable);
|
||||
static List<AdditionalPropertiesClass> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(AdditionalPropertiesClass.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <AdditionalPropertiesClass>[];
|
||||
|
||||
static Map<String, AdditionalPropertiesClass> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, AdditionalPropertiesClass> mapFromJson(dynamic json) {
|
||||
final map = <String, AdditionalPropertiesClass>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = AdditionalPropertiesClass.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = AdditionalPropertiesClass.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map
|
||||
static Map<String, List<AdditionalPropertiesClass>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<AdditionalPropertiesClass>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<AdditionalPropertiesClass>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = AdditionalPropertiesClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = AdditionalPropertiesClass.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Animal {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(className == null ? 0 : className.hashCode) +
|
||||
(color == null ? 0 : color.hashCode);
|
||||
|
||||
@ -43,34 +45,47 @@ class Animal {
|
||||
}
|
||||
|
||||
/// Returns a new [Animal] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Animal fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Animal(
|
||||
className: json[r'className'],
|
||||
color: json[r'color'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Animal fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Animal(
|
||||
className: mapValueOfType<String>(json, r'className'),
|
||||
color: mapValueOfType<String>(json, r'color'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Animal> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Animal>[]
|
||||
: json.map((dynamic value) => Animal.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Animal> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Animal.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Animal>[];
|
||||
|
||||
static Map<String, Animal> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Animal> mapFromJson(dynamic json) {
|
||||
final map = <String, Animal>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Animal.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Animal.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Animal-objects as value to a dart map
|
||||
static Map<String, List<Animal>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Animal>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Animal>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Animal.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Animal.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class ApiResponse {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(code == null ? 0 : code.hashCode) +
|
||||
(type == null ? 0 : type.hashCode) +
|
||||
(message == null ? 0 : message.hashCode);
|
||||
@ -53,35 +55,48 @@ class ApiResponse {
|
||||
}
|
||||
|
||||
/// Returns a new [ApiResponse] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ApiResponse fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ApiResponse(
|
||||
code: json[r'code'],
|
||||
type: json[r'type'],
|
||||
message: json[r'message'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ApiResponse fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ApiResponse(
|
||||
code: mapValueOfType<int>(json, r'code'),
|
||||
type: mapValueOfType<String>(json, r'type'),
|
||||
message: mapValueOfType<String>(json, r'message'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ApiResponse> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ApiResponse>[]
|
||||
: json.map((dynamic value) => ApiResponse.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ApiResponse> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ApiResponse.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ApiResponse>[];
|
||||
|
||||
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ApiResponse> mapFromJson(dynamic json) {
|
||||
final map = <String, ApiResponse>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ApiResponse.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ApiResponse.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ApiResponse-objects as value to a dart map
|
||||
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ApiResponse>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ApiResponse>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ApiResponse.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ApiResponse.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ArrayOfArrayOfNumberOnly {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,37 +39,50 @@ class ArrayOfArrayOfNumberOnly {
|
||||
}
|
||||
|
||||
/// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ArrayOfArrayOfNumberOnly fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ArrayOfArrayOfNumberOnly(
|
||||
arrayArrayNumber: json[r'ArrayArrayNumber'] == null
|
||||
? null
|
||||
: (json[r'ArrayArrayNumber'] as List).map(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ArrayOfArrayOfNumberOnly fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ArrayOfArrayOfNumberOnly(
|
||||
arrayArrayNumber: json[r'ArrayArrayNumber'] is List
|
||||
? (json[r'ArrayArrayNumber'] as List).map(
|
||||
(e) => e == null ? null : (e as List).cast<num>()
|
||||
).toList(growable: false),
|
||||
);
|
||||
).toList(growable: false)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ArrayOfArrayOfNumberOnly> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ArrayOfArrayOfNumberOnly>[]
|
||||
: json.map((dynamic value) => ArrayOfArrayOfNumberOnly.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ArrayOfArrayOfNumberOnly> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ArrayOfArrayOfNumberOnly.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ArrayOfArrayOfNumberOnly>[];
|
||||
|
||||
static Map<String, ArrayOfArrayOfNumberOnly> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ArrayOfArrayOfNumberOnly> mapFromJson(dynamic json) {
|
||||
final map = <String, ArrayOfArrayOfNumberOnly>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map
|
||||
static Map<String, List<ArrayOfArrayOfNumberOnly>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ArrayOfArrayOfNumberOnly>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ArrayOfArrayOfNumberOnly>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ArrayOfArrayOfNumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ArrayOfArrayOfNumberOnly.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ArrayOfNumberOnly {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(arrayNumber == null ? 0 : arrayNumber.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,35 +39,48 @@ class ArrayOfNumberOnly {
|
||||
}
|
||||
|
||||
/// Returns a new [ArrayOfNumberOnly] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ArrayOfNumberOnly fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ArrayOfNumberOnly(
|
||||
arrayNumber: json[r'ArrayNumber'] == null
|
||||
? null
|
||||
: (json[r'ArrayNumber'] as List).cast<num>(),
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ArrayOfNumberOnly fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ArrayOfNumberOnly(
|
||||
arrayNumber: json[r'ArrayNumber'] is List
|
||||
? (json[r'ArrayNumber'] as List).cast<num>()
|
||||
: null,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ArrayOfNumberOnly> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ArrayOfNumberOnly>[]
|
||||
: json.map((dynamic value) => ArrayOfNumberOnly.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ArrayOfNumberOnly> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ArrayOfNumberOnly.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ArrayOfNumberOnly>[];
|
||||
|
||||
static Map<String, ArrayOfNumberOnly> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ArrayOfNumberOnly> mapFromJson(dynamic json) {
|
||||
final map = <String, ArrayOfNumberOnly>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ArrayOfNumberOnly.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ArrayOfNumberOnly.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map
|
||||
static Map<String, List<ArrayOfNumberOnly>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ArrayOfNumberOnly>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ArrayOfNumberOnly>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ArrayOfNumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ArrayOfNumberOnly.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class ArrayTest {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(arrayOfString == null ? 0 : arrayOfString.hashCode) +
|
||||
(arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) +
|
||||
(arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode);
|
||||
@ -53,45 +55,58 @@ class ArrayTest {
|
||||
}
|
||||
|
||||
/// Returns a new [ArrayTest] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ArrayTest fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ArrayTest(
|
||||
arrayOfString: json[r'array_of_string'] == null
|
||||
? null
|
||||
: (json[r'array_of_string'] as List).cast<String>(),
|
||||
arrayArrayOfInteger: json[r'array_array_of_integer'] == null
|
||||
? null
|
||||
: (json[r'array_array_of_integer'] as List).map(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ArrayTest fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ArrayTest(
|
||||
arrayOfString: json[r'array_of_string'] is List
|
||||
? (json[r'array_of_string'] as List).cast<String>()
|
||||
: null,
|
||||
arrayArrayOfInteger: json[r'array_array_of_integer'] is List
|
||||
? (json[r'array_array_of_integer'] as List).map(
|
||||
(e) => e == null ? null : (e as List).cast<int>()
|
||||
).toList(growable: false),
|
||||
arrayArrayOfModel: json[r'array_array_of_model'] == null
|
||||
? null
|
||||
: (json[r'array_array_of_model'] as List).map(
|
||||
).toList(growable: false)
|
||||
: null,
|
||||
arrayArrayOfModel: json[r'array_array_of_model'] is List
|
||||
? (json[r'array_array_of_model'] as List).map(
|
||||
ReadOnlyFirst.listFromJson(json[r'array_array_of_model'])
|
||||
).toList(growable: false),
|
||||
);
|
||||
).toList(growable: false)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ArrayTest> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ArrayTest>[]
|
||||
: json.map((dynamic value) => ArrayTest.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ArrayTest> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ArrayTest.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ArrayTest>[];
|
||||
|
||||
static Map<String, ArrayTest> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ArrayTest> mapFromJson(dynamic json) {
|
||||
final map = <String, ArrayTest>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ArrayTest.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ArrayTest.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ArrayTest-objects as value to a dart map
|
||||
static Map<String, List<ArrayTest>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ArrayTest>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ArrayTest>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ArrayTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ArrayTest.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -44,6 +45,7 @@ class Capitalization {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(smallCamel == null ? 0 : smallCamel.hashCode) +
|
||||
(capitalCamel == null ? 0 : capitalCamel.hashCode) +
|
||||
(smallSnake == null ? 0 : smallSnake.hashCode) +
|
||||
@ -78,38 +80,51 @@ class Capitalization {
|
||||
}
|
||||
|
||||
/// Returns a new [Capitalization] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Capitalization fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Capitalization(
|
||||
smallCamel: json[r'smallCamel'],
|
||||
capitalCamel: json[r'CapitalCamel'],
|
||||
smallSnake: json[r'small_Snake'],
|
||||
capitalSnake: json[r'Capital_Snake'],
|
||||
sCAETHFlowPoints: json[r'SCA_ETH_Flow_Points'],
|
||||
ATT_NAME: json[r'ATT_NAME'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Capitalization fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Capitalization(
|
||||
smallCamel: mapValueOfType<String>(json, r'smallCamel'),
|
||||
capitalCamel: mapValueOfType<String>(json, r'CapitalCamel'),
|
||||
smallSnake: mapValueOfType<String>(json, r'small_Snake'),
|
||||
capitalSnake: mapValueOfType<String>(json, r'Capital_Snake'),
|
||||
sCAETHFlowPoints: mapValueOfType<String>(json, r'SCA_ETH_Flow_Points'),
|
||||
ATT_NAME: mapValueOfType<String>(json, r'ATT_NAME'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Capitalization> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Capitalization>[]
|
||||
: json.map((dynamic value) => Capitalization.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Capitalization> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Capitalization.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Capitalization>[];
|
||||
|
||||
static Map<String, Capitalization> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Capitalization> mapFromJson(dynamic json) {
|
||||
final map = <String, Capitalization>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Capitalization.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Capitalization.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Capitalization-objects as value to a dart map
|
||||
static Map<String, List<Capitalization>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Capitalization>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Capitalization>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Capitalization.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Capitalization.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class Cat {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(className == null ? 0 : className.hashCode) +
|
||||
(color == null ? 0 : color.hashCode) +
|
||||
(declawed == null ? 0 : declawed.hashCode);
|
||||
@ -51,35 +53,48 @@ class Cat {
|
||||
}
|
||||
|
||||
/// Returns a new [Cat] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Cat fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Cat(
|
||||
className: json[r'className'],
|
||||
color: json[r'color'],
|
||||
declawed: json[r'declawed'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Cat fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Cat(
|
||||
className: mapValueOfType<String>(json, r'className'),
|
||||
color: mapValueOfType<String>(json, r'color'),
|
||||
declawed: mapValueOfType<bool>(json, r'declawed'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Cat> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Cat>[]
|
||||
: json.map((dynamic value) => Cat.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Cat> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Cat.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Cat>[];
|
||||
|
||||
static Map<String, Cat> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Cat> mapFromJson(dynamic json) {
|
||||
final map = <String, Cat>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Cat.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Cat.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Cat-objects as value to a dart map
|
||||
static Map<String, List<Cat>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Cat>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Cat>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Cat.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Cat.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class CatAllOf {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(declawed == null ? 0 : declawed.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class CatAllOf {
|
||||
}
|
||||
|
||||
/// Returns a new [CatAllOf] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static CatAllOf fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: CatAllOf(
|
||||
declawed: json[r'declawed'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static CatAllOf fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return CatAllOf(
|
||||
declawed: mapValueOfType<bool>(json, r'declawed'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<CatAllOf> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <CatAllOf>[]
|
||||
: json.map((dynamic value) => CatAllOf.fromJson(value)).toList(growable: true == growable);
|
||||
static List<CatAllOf> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(CatAllOf.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <CatAllOf>[];
|
||||
|
||||
static Map<String, CatAllOf> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, CatAllOf> mapFromJson(dynamic json) {
|
||||
final map = <String, CatAllOf>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = CatAllOf.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = CatAllOf.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of CatAllOf-objects as value to a dart map
|
||||
static Map<String, List<CatAllOf>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<CatAllOf>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<CatAllOf>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = CatAllOf.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = CatAllOf.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Category {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(name == null ? 0 : name.hashCode);
|
||||
|
||||
@ -43,34 +45,47 @@ class Category {
|
||||
}
|
||||
|
||||
/// Returns a new [Category] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Category fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Category(
|
||||
id: json[r'id'],
|
||||
name: json[r'name'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Category fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Category(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Category> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Category>[]
|
||||
: json.map((dynamic value) => Category.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Category> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Category.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Category>[];
|
||||
|
||||
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Category> mapFromJson(dynamic json) {
|
||||
final map = <String, Category>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Category.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Category.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Category-objects as value to a dart map
|
||||
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Category>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Category>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Category.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Category.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ClassModel {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(class_ == null ? 0 : class_.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class ClassModel {
|
||||
}
|
||||
|
||||
/// Returns a new [ClassModel] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ClassModel fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ClassModel(
|
||||
class_: json[r'_class'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ClassModel fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ClassModel(
|
||||
class_: mapValueOfType<String>(json, r'_class'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ClassModel> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ClassModel>[]
|
||||
: json.map((dynamic value) => ClassModel.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ClassModel> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ClassModel.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ClassModel>[];
|
||||
|
||||
static Map<String, ClassModel> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ClassModel> mapFromJson(dynamic json) {
|
||||
final map = <String, ClassModel>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ClassModel.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ClassModel.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ClassModel-objects as value to a dart map
|
||||
static Map<String, List<ClassModel>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ClassModel>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ClassModel>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ClassModel.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ClassModel.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class DeprecatedObject {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(name == null ? 0 : name.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class DeprecatedObject {
|
||||
}
|
||||
|
||||
/// Returns a new [DeprecatedObject] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static DeprecatedObject fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: DeprecatedObject(
|
||||
name: json[r'name'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static DeprecatedObject fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return DeprecatedObject(
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<DeprecatedObject> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <DeprecatedObject>[]
|
||||
: json.map((dynamic value) => DeprecatedObject.fromJson(value)).toList(growable: true == growable);
|
||||
static List<DeprecatedObject> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(DeprecatedObject.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <DeprecatedObject>[];
|
||||
|
||||
static Map<String, DeprecatedObject> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, DeprecatedObject> mapFromJson(dynamic json) {
|
||||
final map = <String, DeprecatedObject>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = DeprecatedObject.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = DeprecatedObject.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of DeprecatedObject-objects as value to a dart map
|
||||
static Map<String, List<DeprecatedObject>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<DeprecatedObject>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<DeprecatedObject>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = DeprecatedObject.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = DeprecatedObject.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class Dog {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(className == null ? 0 : className.hashCode) +
|
||||
(color == null ? 0 : color.hashCode) +
|
||||
(breed == null ? 0 : breed.hashCode);
|
||||
@ -51,35 +53,48 @@ class Dog {
|
||||
}
|
||||
|
||||
/// Returns a new [Dog] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Dog fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Dog(
|
||||
className: json[r'className'],
|
||||
color: json[r'color'],
|
||||
breed: json[r'breed'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Dog fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Dog(
|
||||
className: mapValueOfType<String>(json, r'className'),
|
||||
color: mapValueOfType<String>(json, r'color'),
|
||||
breed: mapValueOfType<String>(json, r'breed'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Dog> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Dog>[]
|
||||
: json.map((dynamic value) => Dog.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Dog> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Dog.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Dog>[];
|
||||
|
||||
static Map<String, Dog> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Dog> mapFromJson(dynamic json) {
|
||||
final map = <String, Dog>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Dog.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Dog.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Dog-objects as value to a dart map
|
||||
static Map<String, List<Dog>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Dog>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Dog>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Dog.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Dog.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class DogAllOf {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(breed == null ? 0 : breed.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class DogAllOf {
|
||||
}
|
||||
|
||||
/// Returns a new [DogAllOf] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static DogAllOf fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: DogAllOf(
|
||||
breed: json[r'breed'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static DogAllOf fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return DogAllOf(
|
||||
breed: mapValueOfType<String>(json, r'breed'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<DogAllOf> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <DogAllOf>[]
|
||||
: json.map((dynamic value) => DogAllOf.fromJson(value)).toList(growable: true == growable);
|
||||
static List<DogAllOf> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(DogAllOf.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <DogAllOf>[];
|
||||
|
||||
static Map<String, DogAllOf> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, DogAllOf> mapFromJson(dynamic json) {
|
||||
final map = <String, DogAllOf>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = DogAllOf.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = DogAllOf.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of DogAllOf-objects as value to a dart map
|
||||
static Map<String, List<DogAllOf>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<DogAllOf>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<DogAllOf>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = DogAllOf.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = DogAllOf.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class EnumArrays {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(justSymbol == null ? 0 : justSymbol.hashCode) +
|
||||
(arrayEnum == null ? 0 : arrayEnum.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class EnumArrays {
|
||||
}
|
||||
|
||||
/// Returns a new [EnumArrays] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static EnumArrays fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: EnumArrays(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static EnumArrays fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return EnumArrays(
|
||||
justSymbol: EnumArraysJustSymbolEnum.fromJson(json[r'just_symbol']),
|
||||
arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json[r'array_enum']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<EnumArrays> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumArrays>[]
|
||||
: json.map((dynamic value) => EnumArrays.fromJson(value)).toList(growable: true == growable);
|
||||
static List<EnumArrays> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumArrays.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumArrays>[];
|
||||
|
||||
static Map<String, EnumArrays> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, EnumArrays> mapFromJson(dynamic json) {
|
||||
final map = <String, EnumArrays>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = EnumArrays.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = EnumArrays.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of EnumArrays-objects as value to a dart map
|
||||
static Map<String, List<EnumArrays>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<EnumArrays>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<EnumArrays>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = EnumArrays.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = EnumArrays.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -87,7 +102,7 @@ class EnumArraysJustSymbolEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -103,20 +118,18 @@ class EnumArraysJustSymbolEnum {
|
||||
static EnumArraysJustSymbolEnum fromJson(dynamic value) =>
|
||||
EnumArraysJustSymbolEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumArraysJustSymbolEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumArraysJustSymbolEnum>[]
|
||||
: json
|
||||
.map((value) => EnumArraysJustSymbolEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumArraysJustSymbolEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumArraysJustSymbolEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumArraysJustSymbolEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumArraysJustSymbolEnum] to String,
|
||||
/// and [decode] dynamic data back to [EnumArraysJustSymbolEnum].
|
||||
class EnumArraysJustSymbolEnumTypeTransformer {
|
||||
const EnumArraysJustSymbolEnumTypeTransformer._();
|
||||
factory EnumArraysJustSymbolEnumTypeTransformer() => _instance ??= const EnumArraysJustSymbolEnumTypeTransformer._();
|
||||
|
||||
factory EnumArraysJustSymbolEnumTypeTransformer() => _instance ??= EnumArraysJustSymbolEnumTypeTransformer._();
|
||||
const EnumArraysJustSymbolEnumTypeTransformer._();
|
||||
|
||||
String encode(EnumArraysJustSymbolEnum data) => data.value;
|
||||
|
||||
@ -129,13 +142,15 @@ class EnumArraysJustSymbolEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumArraysJustSymbolEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'>=': return EnumArraysJustSymbolEnum.greaterThanEqual;
|
||||
case r'$': return EnumArraysJustSymbolEnum.dollar;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'>=': return EnumArraysJustSymbolEnum.greaterThanEqual;
|
||||
case r'$': return EnumArraysJustSymbolEnum.dollar;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -145,6 +160,7 @@ class EnumArraysJustSymbolEnumTypeTransformer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class EnumArraysArrayEnumEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const EnumArraysArrayEnumEnum._(this.value);
|
||||
@ -153,7 +169,7 @@ class EnumArraysArrayEnumEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -169,20 +185,18 @@ class EnumArraysArrayEnumEnum {
|
||||
static EnumArraysArrayEnumEnum fromJson(dynamic value) =>
|
||||
EnumArraysArrayEnumEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumArraysArrayEnumEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumArraysArrayEnumEnum>[]
|
||||
: json
|
||||
.map((value) => EnumArraysArrayEnumEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumArraysArrayEnumEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumArraysArrayEnumEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumArraysArrayEnumEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumArraysArrayEnumEnum] to String,
|
||||
/// and [decode] dynamic data back to [EnumArraysArrayEnumEnum].
|
||||
class EnumArraysArrayEnumEnumTypeTransformer {
|
||||
const EnumArraysArrayEnumEnumTypeTransformer._();
|
||||
factory EnumArraysArrayEnumEnumTypeTransformer() => _instance ??= const EnumArraysArrayEnumEnumTypeTransformer._();
|
||||
|
||||
factory EnumArraysArrayEnumEnumTypeTransformer() => _instance ??= EnumArraysArrayEnumEnumTypeTransformer._();
|
||||
const EnumArraysArrayEnumEnumTypeTransformer._();
|
||||
|
||||
String encode(EnumArraysArrayEnumEnum data) => data.value;
|
||||
|
||||
@ -195,13 +209,15 @@ class EnumArraysArrayEnumEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumArraysArrayEnumEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'fish': return EnumArraysArrayEnumEnum.fish;
|
||||
case r'crab': return EnumArraysArrayEnumEnum.crab;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'fish': return EnumArraysArrayEnumEnum.fish;
|
||||
case r'crab': return EnumArraysArrayEnumEnum.crab;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -210,3 +226,4 @@ class EnumArraysArrayEnumEnumTypeTransformer {
|
||||
static EnumArraysArrayEnumEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -18,7 +19,7 @@ class EnumClass {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -36,20 +37,18 @@ class EnumClass {
|
||||
static EnumClass fromJson(dynamic value) =>
|
||||
EnumClassTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumClass>[]
|
||||
: json
|
||||
.map((value) => EnumClass.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumClass> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumClass.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumClass>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumClass] to String,
|
||||
/// and [decode] dynamic data back to [EnumClass].
|
||||
class EnumClassTypeTransformer {
|
||||
const EnumClassTypeTransformer._();
|
||||
factory EnumClassTypeTransformer() => _instance ??= const EnumClassTypeTransformer._();
|
||||
|
||||
factory EnumClassTypeTransformer() => _instance ??= EnumClassTypeTransformer._();
|
||||
const EnumClassTypeTransformer._();
|
||||
|
||||
String encode(EnumClass data) => data.value;
|
||||
|
||||
@ -62,14 +61,16 @@ class EnumClassTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumClass decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'_abc': return EnumClass.abc;
|
||||
case r'-efg': return EnumClass.efg;
|
||||
case r'(xyz)': return EnumClass.leftParenthesisXyzRightParenthesis;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'_abc': return EnumClass.abc;
|
||||
case r'-efg': return EnumClass.efg;
|
||||
case r'(xyz)': return EnumClass.leftParenthesisXyzRightParenthesis;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -77,3 +78,4 @@ class EnumClassTypeTransformer {
|
||||
/// Singleton [EnumClassTypeTransformer] instance.
|
||||
static EnumClassTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -51,6 +52,7 @@ class EnumTest {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(enumString == null ? 0 : enumString.hashCode) +
|
||||
(enumStringRequired == null ? 0 : enumStringRequired.hashCode) +
|
||||
(enumInteger == null ? 0 : enumInteger.hashCode) +
|
||||
@ -91,10 +93,12 @@ class EnumTest {
|
||||
}
|
||||
|
||||
/// Returns a new [EnumTest] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static EnumTest fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: EnumTest(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static EnumTest fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return EnumTest(
|
||||
enumString: EnumTestEnumStringEnum.fromJson(json[r'enum_string']),
|
||||
enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json[r'enum_string_required']),
|
||||
enumInteger: EnumTestEnumIntegerEnum.fromJson(json[r'enum_integer']),
|
||||
@ -103,28 +107,39 @@ class EnumTest {
|
||||
outerEnumInteger: OuterEnumInteger.fromJson(json[r'outerEnumInteger']),
|
||||
outerEnumDefaultValue: OuterEnumDefaultValue.fromJson(json[r'outerEnumDefaultValue']),
|
||||
outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue.fromJson(json[r'outerEnumIntegerDefaultValue']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<EnumTest> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumTest>[]
|
||||
: json.map((dynamic value) => EnumTest.fromJson(value)).toList(growable: true == growable);
|
||||
static List<EnumTest> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumTest.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumTest>[];
|
||||
|
||||
static Map<String, EnumTest> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, EnumTest> mapFromJson(dynamic json) {
|
||||
final map = <String, EnumTest>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = EnumTest.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = EnumTest.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of EnumTest-objects as value to a dart map
|
||||
static Map<String, List<EnumTest>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<EnumTest>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<EnumTest>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = EnumTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = EnumTest.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -139,7 +154,7 @@ class EnumTestEnumStringEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -157,20 +172,18 @@ class EnumTestEnumStringEnum {
|
||||
static EnumTestEnumStringEnum fromJson(dynamic value) =>
|
||||
EnumTestEnumStringEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumTestEnumStringEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumTestEnumStringEnum>[]
|
||||
: json
|
||||
.map((value) => EnumTestEnumStringEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumTestEnumStringEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumTestEnumStringEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumTestEnumStringEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumTestEnumStringEnum] to String,
|
||||
/// and [decode] dynamic data back to [EnumTestEnumStringEnum].
|
||||
class EnumTestEnumStringEnumTypeTransformer {
|
||||
const EnumTestEnumStringEnumTypeTransformer._();
|
||||
factory EnumTestEnumStringEnumTypeTransformer() => _instance ??= const EnumTestEnumStringEnumTypeTransformer._();
|
||||
|
||||
factory EnumTestEnumStringEnumTypeTransformer() => _instance ??= EnumTestEnumStringEnumTypeTransformer._();
|
||||
const EnumTestEnumStringEnumTypeTransformer._();
|
||||
|
||||
String encode(EnumTestEnumStringEnum data) => data.value;
|
||||
|
||||
@ -183,14 +196,16 @@ class EnumTestEnumStringEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumTestEnumStringEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'UPPER': return EnumTestEnumStringEnum.UPPER;
|
||||
case r'lower': return EnumTestEnumStringEnum.lower;
|
||||
case r'': return EnumTestEnumStringEnum.empty;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'UPPER': return EnumTestEnumStringEnum.UPPER;
|
||||
case r'lower': return EnumTestEnumStringEnum.lower;
|
||||
case r'': return EnumTestEnumStringEnum.empty;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -200,6 +215,7 @@ class EnumTestEnumStringEnumTypeTransformer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class EnumTestEnumStringRequiredEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const EnumTestEnumStringRequiredEnum._(this.value);
|
||||
@ -208,7 +224,7 @@ class EnumTestEnumStringRequiredEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -226,20 +242,18 @@ class EnumTestEnumStringRequiredEnum {
|
||||
static EnumTestEnumStringRequiredEnum fromJson(dynamic value) =>
|
||||
EnumTestEnumStringRequiredEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumTestEnumStringRequiredEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumTestEnumStringRequiredEnum>[]
|
||||
: json
|
||||
.map((value) => EnumTestEnumStringRequiredEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumTestEnumStringRequiredEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumTestEnumStringRequiredEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumTestEnumStringRequiredEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumTestEnumStringRequiredEnum] to String,
|
||||
/// and [decode] dynamic data back to [EnumTestEnumStringRequiredEnum].
|
||||
class EnumTestEnumStringRequiredEnumTypeTransformer {
|
||||
const EnumTestEnumStringRequiredEnumTypeTransformer._();
|
||||
factory EnumTestEnumStringRequiredEnumTypeTransformer() => _instance ??= const EnumTestEnumStringRequiredEnumTypeTransformer._();
|
||||
|
||||
factory EnumTestEnumStringRequiredEnumTypeTransformer() => _instance ??= EnumTestEnumStringRequiredEnumTypeTransformer._();
|
||||
const EnumTestEnumStringRequiredEnumTypeTransformer._();
|
||||
|
||||
String encode(EnumTestEnumStringRequiredEnum data) => data.value;
|
||||
|
||||
@ -252,14 +266,16 @@ class EnumTestEnumStringRequiredEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumTestEnumStringRequiredEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'UPPER': return EnumTestEnumStringRequiredEnum.UPPER;
|
||||
case r'lower': return EnumTestEnumStringRequiredEnum.lower;
|
||||
case r'': return EnumTestEnumStringRequiredEnum.empty;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'UPPER': return EnumTestEnumStringRequiredEnum.UPPER;
|
||||
case r'lower': return EnumTestEnumStringRequiredEnum.lower;
|
||||
case r'': return EnumTestEnumStringRequiredEnum.empty;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -269,6 +285,7 @@ class EnumTestEnumStringRequiredEnumTypeTransformer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class EnumTestEnumIntegerEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const EnumTestEnumIntegerEnum._(this.value);
|
||||
@ -277,7 +294,7 @@ class EnumTestEnumIntegerEnum {
|
||||
final int value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
String toString() => value == null ? '' : value.toString();
|
||||
|
||||
int toJson() => value;
|
||||
|
||||
@ -293,20 +310,18 @@ class EnumTestEnumIntegerEnum {
|
||||
static EnumTestEnumIntegerEnum fromJson(dynamic value) =>
|
||||
EnumTestEnumIntegerEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumTestEnumIntegerEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumTestEnumIntegerEnum>[]
|
||||
: json
|
||||
.map((value) => EnumTestEnumIntegerEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumTestEnumIntegerEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumTestEnumIntegerEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumTestEnumIntegerEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumTestEnumIntegerEnum] to int,
|
||||
/// and [decode] dynamic data back to [EnumTestEnumIntegerEnum].
|
||||
class EnumTestEnumIntegerEnumTypeTransformer {
|
||||
const EnumTestEnumIntegerEnumTypeTransformer._();
|
||||
factory EnumTestEnumIntegerEnumTypeTransformer() => _instance ??= const EnumTestEnumIntegerEnumTypeTransformer._();
|
||||
|
||||
factory EnumTestEnumIntegerEnumTypeTransformer() => _instance ??= EnumTestEnumIntegerEnumTypeTransformer._();
|
||||
const EnumTestEnumIntegerEnumTypeTransformer._();
|
||||
|
||||
int encode(EnumTestEnumIntegerEnum data) => data.value;
|
||||
|
||||
@ -319,13 +334,15 @@ class EnumTestEnumIntegerEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumTestEnumIntegerEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case 1: return EnumTestEnumIntegerEnum.number1;
|
||||
case -1: return EnumTestEnumIntegerEnum.numberNegative1;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case 1: return EnumTestEnumIntegerEnum.number1;
|
||||
case -1: return EnumTestEnumIntegerEnum.numberNegative1;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -335,6 +352,7 @@ class EnumTestEnumIntegerEnumTypeTransformer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class EnumTestEnumNumberEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const EnumTestEnumNumberEnum._(this.value);
|
||||
@ -343,7 +361,7 @@ class EnumTestEnumNumberEnum {
|
||||
final double value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
String toString() => value == null ? '' : value.toString();
|
||||
|
||||
double toJson() => value;
|
||||
|
||||
@ -359,20 +377,18 @@ class EnumTestEnumNumberEnum {
|
||||
static EnumTestEnumNumberEnum fromJson(dynamic value) =>
|
||||
EnumTestEnumNumberEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<EnumTestEnumNumberEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <EnumTestEnumNumberEnum>[]
|
||||
: json
|
||||
.map((value) => EnumTestEnumNumberEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<EnumTestEnumNumberEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(EnumTestEnumNumberEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <EnumTestEnumNumberEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [EnumTestEnumNumberEnum] to double,
|
||||
/// and [decode] dynamic data back to [EnumTestEnumNumberEnum].
|
||||
class EnumTestEnumNumberEnumTypeTransformer {
|
||||
const EnumTestEnumNumberEnumTypeTransformer._();
|
||||
factory EnumTestEnumNumberEnumTypeTransformer() => _instance ??= const EnumTestEnumNumberEnumTypeTransformer._();
|
||||
|
||||
factory EnumTestEnumNumberEnumTypeTransformer() => _instance ??= EnumTestEnumNumberEnumTypeTransformer._();
|
||||
const EnumTestEnumNumberEnumTypeTransformer._();
|
||||
|
||||
double encode(EnumTestEnumNumberEnum data) => data.value;
|
||||
|
||||
@ -385,13 +401,15 @@ class EnumTestEnumNumberEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
EnumTestEnumNumberEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case '1.1': return EnumTestEnumNumberEnum.number1Period1;
|
||||
case '-1.2': return EnumTestEnumNumberEnum.numberNegative1Period2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case '1.1': return EnumTestEnumNumberEnum.number1Period1;
|
||||
case '-1.2': return EnumTestEnumNumberEnum.numberNegative1Period2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -400,3 +418,4 @@ class EnumTestEnumNumberEnumTypeTransformer {
|
||||
static EnumTestEnumNumberEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class FileSchemaTestClass {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(file == null ? 0 : file.hashCode) +
|
||||
(files == null ? 0 : files.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class FileSchemaTestClass {
|
||||
}
|
||||
|
||||
/// Returns a new [FileSchemaTestClass] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static FileSchemaTestClass fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: FileSchemaTestClass(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static FileSchemaTestClass fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return FileSchemaTestClass(
|
||||
file: ModelFile.fromJson(json[r'file']),
|
||||
files: ModelFile.listFromJson(json[r'files']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<FileSchemaTestClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <FileSchemaTestClass>[]
|
||||
: json.map((dynamic value) => FileSchemaTestClass.fromJson(value)).toList(growable: true == growable);
|
||||
static List<FileSchemaTestClass> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(FileSchemaTestClass.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <FileSchemaTestClass>[];
|
||||
|
||||
static Map<String, FileSchemaTestClass> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, FileSchemaTestClass> mapFromJson(dynamic json) {
|
||||
final map = <String, FileSchemaTestClass>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = FileSchemaTestClass.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = FileSchemaTestClass.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of FileSchemaTestClass-objects as value to a dart map
|
||||
static Map<String, List<FileSchemaTestClass>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<FileSchemaTestClass>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<FileSchemaTestClass>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = FileSchemaTestClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = FileSchemaTestClass.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class Foo {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(bar == null ? 0 : bar.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class Foo {
|
||||
}
|
||||
|
||||
/// Returns a new [Foo] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Foo fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Foo(
|
||||
bar: json[r'bar'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Foo fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Foo(
|
||||
bar: mapValueOfType<String>(json, r'bar'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Foo> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Foo>[]
|
||||
: json.map((dynamic value) => Foo.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Foo> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Foo.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Foo>[];
|
||||
|
||||
static Map<String, Foo> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Foo> mapFromJson(dynamic json) {
|
||||
final map = <String, Foo>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Foo.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Foo.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Foo-objects as value to a dart map
|
||||
static Map<String, List<Foo>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Foo>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Foo>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Foo.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Foo.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -95,6 +96,7 @@ class FormatTest {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(integer == null ? 0 : integer.hashCode) +
|
||||
(int32 == null ? 0 : int32.hashCode) +
|
||||
(int64 == null ? 0 : int64.hashCode) +
|
||||
@ -161,54 +163,63 @@ class FormatTest {
|
||||
}
|
||||
|
||||
/// Returns a new [FormatTest] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static FormatTest fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: FormatTest(
|
||||
integer: json[r'integer'],
|
||||
int32: json[r'int32'],
|
||||
int64: json[r'int64'],
|
||||
number: json[r'number'] == null ?
|
||||
null :
|
||||
json[r'number'].toDouble(),
|
||||
float: json[r'float'],
|
||||
double_: json[r'double'],
|
||||
decimal: json[r'decimal'],
|
||||
string: json[r'string'],
|
||||
byte: json[r'byte'],
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static FormatTest fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return FormatTest(
|
||||
integer: mapValueOfType<int>(json, r'integer'),
|
||||
int32: mapValueOfType<int>(json, r'int32'),
|
||||
int64: mapValueOfType<int>(json, r'int64'),
|
||||
number: json[r'number'] == null
|
||||
? null
|
||||
: num.parse(json[r'number'].toString()),
|
||||
float: mapValueOfType<double>(json, r'float'),
|
||||
double_: mapValueOfType<double>(json, r'double'),
|
||||
decimal: mapValueOfType<double>(json, r'decimal'),
|
||||
string: mapValueOfType<String>(json, r'string'),
|
||||
byte: mapValueOfType<String>(json, r'byte'),
|
||||
binary: null, // No support for decoding binary content from JSON
|
||||
date: json[r'date'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'date']),
|
||||
dateTime: json[r'dateTime'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateTime']),
|
||||
uuid: json[r'uuid'],
|
||||
password: json[r'password'],
|
||||
patternWithDigits: json[r'pattern_with_digits'],
|
||||
patternWithDigitsAndDelimiter: json[r'pattern_with_digits_and_delimiter'],
|
||||
);
|
||||
date: mapDateTime(json, r'date', ''),
|
||||
dateTime: mapDateTime(json, r'dateTime', ''),
|
||||
uuid: mapValueOfType<String>(json, r'uuid'),
|
||||
password: mapValueOfType<String>(json, r'password'),
|
||||
patternWithDigits: mapValueOfType<String>(json, r'pattern_with_digits'),
|
||||
patternWithDigitsAndDelimiter: mapValueOfType<String>(json, r'pattern_with_digits_and_delimiter'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<FormatTest> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <FormatTest>[]
|
||||
: json.map((dynamic value) => FormatTest.fromJson(value)).toList(growable: true == growable);
|
||||
static List<FormatTest> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(FormatTest.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <FormatTest>[];
|
||||
|
||||
static Map<String, FormatTest> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, FormatTest> mapFromJson(dynamic json) {
|
||||
final map = <String, FormatTest>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = FormatTest.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = FormatTest.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of FormatTest-objects as value to a dart map
|
||||
static Map<String, List<FormatTest>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<FormatTest>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<FormatTest>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = FormatTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = FormatTest.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class HasOnlyReadOnly {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(bar == null ? 0 : bar.hashCode) +
|
||||
(foo == null ? 0 : foo.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class HasOnlyReadOnly {
|
||||
}
|
||||
|
||||
/// Returns a new [HasOnlyReadOnly] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static HasOnlyReadOnly fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: HasOnlyReadOnly(
|
||||
bar: json[r'bar'],
|
||||
foo: json[r'foo'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static HasOnlyReadOnly fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return HasOnlyReadOnly(
|
||||
bar: mapValueOfType<String>(json, r'bar'),
|
||||
foo: mapValueOfType<String>(json, r'foo'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<HasOnlyReadOnly> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <HasOnlyReadOnly>[]
|
||||
: json.map((dynamic value) => HasOnlyReadOnly.fromJson(value)).toList(growable: true == growable);
|
||||
static List<HasOnlyReadOnly> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(HasOnlyReadOnly.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <HasOnlyReadOnly>[];
|
||||
|
||||
static Map<String, HasOnlyReadOnly> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, HasOnlyReadOnly> mapFromJson(dynamic json) {
|
||||
final map = <String, HasOnlyReadOnly>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = HasOnlyReadOnly.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = HasOnlyReadOnly.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map
|
||||
static Map<String, List<HasOnlyReadOnly>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<HasOnlyReadOnly>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<HasOnlyReadOnly>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = HasOnlyReadOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = HasOnlyReadOnly.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class HealthCheckResult {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(nullableMessage == null ? 0 : nullableMessage.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class HealthCheckResult {
|
||||
}
|
||||
|
||||
/// Returns a new [HealthCheckResult] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static HealthCheckResult fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: HealthCheckResult(
|
||||
nullableMessage: json[r'NullableMessage'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static HealthCheckResult fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return HealthCheckResult(
|
||||
nullableMessage: mapValueOfType<String>(json, r'NullableMessage'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<HealthCheckResult> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <HealthCheckResult>[]
|
||||
: json.map((dynamic value) => HealthCheckResult.fromJson(value)).toList(growable: true == growable);
|
||||
static List<HealthCheckResult> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(HealthCheckResult.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <HealthCheckResult>[];
|
||||
|
||||
static Map<String, HealthCheckResult> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, HealthCheckResult> mapFromJson(dynamic json) {
|
||||
final map = <String, HealthCheckResult>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = HealthCheckResult.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = HealthCheckResult.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of HealthCheckResult-objects as value to a dart map
|
||||
static Map<String, List<HealthCheckResult>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<HealthCheckResult>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<HealthCheckResult>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = HealthCheckResult.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = HealthCheckResult.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class InlineResponseDefault {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(string == null ? 0 : string.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class InlineResponseDefault {
|
||||
}
|
||||
|
||||
/// Returns a new [InlineResponseDefault] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static InlineResponseDefault fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: InlineResponseDefault(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static InlineResponseDefault fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return InlineResponseDefault(
|
||||
string: Foo.fromJson(json[r'string']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<InlineResponseDefault> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <InlineResponseDefault>[]
|
||||
: json.map((dynamic value) => InlineResponseDefault.fromJson(value)).toList(growable: true == growable);
|
||||
static List<InlineResponseDefault> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(InlineResponseDefault.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <InlineResponseDefault>[];
|
||||
|
||||
static Map<String, InlineResponseDefault> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, InlineResponseDefault> mapFromJson(dynamic json) {
|
||||
final map = <String, InlineResponseDefault>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = InlineResponseDefault.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = InlineResponseDefault.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of InlineResponseDefault-objects as value to a dart map
|
||||
static Map<String, List<InlineResponseDefault>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<InlineResponseDefault>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<InlineResponseDefault>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = InlineResponseDefault.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = InlineResponseDefault.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -35,6 +36,7 @@ class MapTest {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(mapMapOfString == null ? 0 : mapMapOfString.hashCode) +
|
||||
(mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) +
|
||||
(directMap == null ? 0 : directMap.hashCode) +
|
||||
@ -61,44 +63,49 @@ class MapTest {
|
||||
}
|
||||
|
||||
/// Returns a new [MapTest] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static MapTest fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: MapTest(
|
||||
mapMapOfString: json[r'map_map_of_string'] == null
|
||||
? null
|
||||
: (json[r'map_map_of_string'] as Map).cast<String, Map>(),
|
||||
mapOfEnumString: json[r'map_of_enum_string'] == null ?
|
||||
null :
|
||||
(json[r'map_of_enum_string'] as Map).cast<String, String>(),
|
||||
directMap: json[r'direct_map'] == null ?
|
||||
null :
|
||||
(json[r'direct_map'] as Map).cast<String, bool>(),
|
||||
indirectMap: json[r'indirect_map'] == null ?
|
||||
null :
|
||||
(json[r'indirect_map'] as Map).cast<String, bool>(),
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static MapTest fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return MapTest(
|
||||
mapMapOfString: mapCastOfType<String, dynamic>(json, r'map_map_of_string'),
|
||||
mapOfEnumString: mapCastOfType<String, String>(json, r'map_of_enum_string'),
|
||||
directMap: mapCastOfType<String, bool>(json, r'direct_map'),
|
||||
indirectMap: mapCastOfType<String, bool>(json, r'indirect_map'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MapTest> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <MapTest>[]
|
||||
: json.map((dynamic value) => MapTest.fromJson(value)).toList(growable: true == growable);
|
||||
static List<MapTest> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(MapTest.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <MapTest>[];
|
||||
|
||||
static Map<String, MapTest> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, MapTest> mapFromJson(dynamic json) {
|
||||
final map = <String, MapTest>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = MapTest.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = MapTest.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of MapTest-objects as value to a dart map
|
||||
static Map<String, List<MapTest>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<MapTest>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<MapTest>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = MapTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = MapTest.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -113,7 +120,7 @@ class MapTestMapOfEnumStringEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -129,20 +136,18 @@ class MapTestMapOfEnumStringEnum {
|
||||
static MapTestMapOfEnumStringEnum fromJson(dynamic value) =>
|
||||
MapTestMapOfEnumStringEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<MapTestMapOfEnumStringEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <MapTestMapOfEnumStringEnum>[]
|
||||
: json
|
||||
.map((value) => MapTestMapOfEnumStringEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<MapTestMapOfEnumStringEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(MapTestMapOfEnumStringEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <MapTestMapOfEnumStringEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [MapTestMapOfEnumStringEnum] to String,
|
||||
/// and [decode] dynamic data back to [MapTestMapOfEnumStringEnum].
|
||||
class MapTestMapOfEnumStringEnumTypeTransformer {
|
||||
const MapTestMapOfEnumStringEnumTypeTransformer._();
|
||||
factory MapTestMapOfEnumStringEnumTypeTransformer() => _instance ??= const MapTestMapOfEnumStringEnumTypeTransformer._();
|
||||
|
||||
factory MapTestMapOfEnumStringEnumTypeTransformer() => _instance ??= MapTestMapOfEnumStringEnumTypeTransformer._();
|
||||
const MapTestMapOfEnumStringEnumTypeTransformer._();
|
||||
|
||||
String encode(MapTestMapOfEnumStringEnum data) => data.value;
|
||||
|
||||
@ -155,13 +160,15 @@ class MapTestMapOfEnumStringEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
MapTestMapOfEnumStringEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'UPPER': return MapTestMapOfEnumStringEnum.UPPER;
|
||||
case r'lower': return MapTestMapOfEnumStringEnum.lower;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'UPPER': return MapTestMapOfEnumStringEnum.UPPER;
|
||||
case r'lower': return MapTestMapOfEnumStringEnum.lower;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -170,3 +177,4 @@ class MapTestMapOfEnumStringEnumTypeTransformer {
|
||||
static MapTestMapOfEnumStringEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(uuid == null ? 0 : uuid.hashCode) +
|
||||
(dateTime == null ? 0 : dateTime.hashCode) +
|
||||
(map == null ? 0 : map.hashCode);
|
||||
@ -53,37 +55,48 @@ class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
}
|
||||
|
||||
/// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static MixedPropertiesAndAdditionalPropertiesClass fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: MixedPropertiesAndAdditionalPropertiesClass(
|
||||
uuid: json[r'uuid'],
|
||||
dateTime: json[r'dateTime'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateTime']),
|
||||
map: json[r'map']
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static MixedPropertiesAndAdditionalPropertiesClass fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return MixedPropertiesAndAdditionalPropertiesClass(
|
||||
uuid: mapValueOfType<String>(json, r'uuid'),
|
||||
dateTime: mapDateTime(json, r'dateTime', ''),
|
||||
map: mapValueOfType<Map<String, Animal>>(json, r'map'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MixedPropertiesAndAdditionalPropertiesClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <MixedPropertiesAndAdditionalPropertiesClass>[]
|
||||
: json.map((dynamic value) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(value)).toList(growable: true == growable);
|
||||
static List<MixedPropertiesAndAdditionalPropertiesClass> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(MixedPropertiesAndAdditionalPropertiesClass.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <MixedPropertiesAndAdditionalPropertiesClass>[];
|
||||
|
||||
static Map<String, MixedPropertiesAndAdditionalPropertiesClass> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, MixedPropertiesAndAdditionalPropertiesClass> mapFromJson(dynamic json) {
|
||||
final map = <String, MixedPropertiesAndAdditionalPropertiesClass>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map
|
||||
static Map<String, List<MixedPropertiesAndAdditionalPropertiesClass>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<MixedPropertiesAndAdditionalPropertiesClass>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<MixedPropertiesAndAdditionalPropertiesClass>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Model200Response {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
(class_ == null ? 0 : class_.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class Model200Response {
|
||||
}
|
||||
|
||||
/// Returns a new [Model200Response] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Model200Response fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Model200Response(
|
||||
name: json[r'name'],
|
||||
class_: json[r'class'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Model200Response fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Model200Response(
|
||||
name: mapValueOfType<int>(json, r'name'),
|
||||
class_: mapValueOfType<String>(json, r'class'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Model200Response> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Model200Response>[]
|
||||
: json.map((dynamic value) => Model200Response.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Model200Response> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Model200Response.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Model200Response>[];
|
||||
|
||||
static Map<String, Model200Response> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Model200Response> mapFromJson(dynamic json) {
|
||||
final map = <String, Model200Response>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Model200Response.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Model200Response.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Model200Response-objects as value to a dart map
|
||||
static Map<String, List<Model200Response>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Model200Response>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Model200Response>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Model200Response.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Model200Response.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ModelClient {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(client == null ? 0 : client.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class ModelClient {
|
||||
}
|
||||
|
||||
/// Returns a new [ModelClient] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelClient fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelClient(
|
||||
client: json[r'client'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ModelClient fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ModelClient(
|
||||
client: mapValueOfType<String>(json, r'client'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ModelClient> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelClient>[]
|
||||
: json.map((dynamic value) => ModelClient.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ModelClient> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ModelClient.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ModelClient>[];
|
||||
|
||||
static Map<String, ModelClient> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ModelClient> mapFromJson(dynamic json) {
|
||||
final map = <String, ModelClient>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ModelClient.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ModelClient.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelClient-objects as value to a dart map
|
||||
static Map<String, List<ModelClient>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ModelClient>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelClient>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ModelClient.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ModelClient.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -24,6 +25,7 @@ class ModelFile {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(sourceURI == null ? 0 : sourceURI.hashCode);
|
||||
|
||||
@override
|
||||
@ -38,33 +40,46 @@ class ModelFile {
|
||||
}
|
||||
|
||||
/// Returns a new [ModelFile] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelFile fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelFile(
|
||||
sourceURI: json[r'sourceURI'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ModelFile fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ModelFile(
|
||||
sourceURI: mapValueOfType<String>(json, r'sourceURI'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ModelFile> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelFile>[]
|
||||
: json.map((dynamic value) => ModelFile.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ModelFile> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ModelFile.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ModelFile>[];
|
||||
|
||||
static Map<String, ModelFile> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ModelFile> mapFromJson(dynamic json) {
|
||||
final map = <String, ModelFile>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ModelFile.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ModelFile.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelFile-objects as value to a dart map
|
||||
static Map<String, List<ModelFile>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ModelFile>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelFile>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ModelFile.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ModelFile.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ModelList {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(n123list == null ? 0 : n123list.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class ModelList {
|
||||
}
|
||||
|
||||
/// Returns a new [ModelList] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelList fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelList(
|
||||
n123list: json[r'123-list'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ModelList fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ModelList(
|
||||
n123list: mapValueOfType<String>(json, r'123-list'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ModelList> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelList>[]
|
||||
: json.map((dynamic value) => ModelList.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ModelList> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ModelList.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ModelList>[];
|
||||
|
||||
static Map<String, ModelList> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ModelList> mapFromJson(dynamic json) {
|
||||
final map = <String, ModelList>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ModelList.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ModelList.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelList-objects as value to a dart map
|
||||
static Map<String, List<ModelList>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ModelList>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelList>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ModelList.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ModelList.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class ModelReturn {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(return_ == null ? 0 : return_.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class ModelReturn {
|
||||
}
|
||||
|
||||
/// Returns a new [ModelReturn] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelReturn fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelReturn(
|
||||
return_: json[r'return'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ModelReturn fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ModelReturn(
|
||||
return_: mapValueOfType<int>(json, r'return'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ModelReturn> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelReturn>[]
|
||||
: json.map((dynamic value) => ModelReturn.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ModelReturn> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ModelReturn.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ModelReturn>[];
|
||||
|
||||
static Map<String, ModelReturn> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ModelReturn> mapFromJson(dynamic json) {
|
||||
final map = <String, ModelReturn>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ModelReturn.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ModelReturn.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelReturn-objects as value to a dart map
|
||||
static Map<String, List<ModelReturn>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ModelReturn>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelReturn>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ModelReturn.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ModelReturn.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -35,6 +36,7 @@ class Name {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
(snakeCase == null ? 0 : snakeCase.hashCode) +
|
||||
(property == null ? 0 : property.hashCode) +
|
||||
@ -59,36 +61,49 @@ class Name {
|
||||
}
|
||||
|
||||
/// Returns a new [Name] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Name fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Name(
|
||||
name: json[r'name'],
|
||||
snakeCase: json[r'snake_case'],
|
||||
property: json[r'property'],
|
||||
n123number: json[r'123Number'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Name fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Name(
|
||||
name: mapValueOfType<int>(json, r'name'),
|
||||
snakeCase: mapValueOfType<int>(json, r'snake_case'),
|
||||
property: mapValueOfType<String>(json, r'property'),
|
||||
n123number: mapValueOfType<int>(json, r'123Number'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Name> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Name>[]
|
||||
: json.map((dynamic value) => Name.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Name> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Name.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Name>[];
|
||||
|
||||
static Map<String, Name> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Name> mapFromJson(dynamic json) {
|
||||
final map = <String, Name>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Name.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Name.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Name-objects as value to a dart map
|
||||
static Map<String, List<Name>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Name>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Name>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Name.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Name.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -67,6 +68,7 @@ class NullableClass {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(integerProp == null ? 0 : integerProp.hashCode) +
|
||||
(numberProp == null ? 0 : numberProp.hashCode) +
|
||||
(booleanProp == null ? 0 : booleanProp.hashCode) +
|
||||
@ -125,50 +127,59 @@ class NullableClass {
|
||||
}
|
||||
|
||||
/// Returns a new [NullableClass] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static NullableClass fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: NullableClass(
|
||||
integerProp: json[r'integer_prop'],
|
||||
numberProp: json[r'number_prop'] == null ?
|
||||
null :
|
||||
json[r'number_prop'].toDouble(),
|
||||
booleanProp: json[r'boolean_prop'],
|
||||
stringProp: json[r'string_prop'],
|
||||
dateProp: json[r'date_prop'] == null
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static NullableClass fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return NullableClass(
|
||||
integerProp: mapValueOfType<int>(json, r'integer_prop'),
|
||||
numberProp: json[r'number_prop'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'date_prop']),
|
||||
datetimeProp: json[r'datetime_prop'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'datetime_prop']),
|
||||
: num.parse(json[r'number_prop'].toString()),
|
||||
booleanProp: mapValueOfType<bool>(json, r'boolean_prop'),
|
||||
stringProp: mapValueOfType<String>(json, r'string_prop'),
|
||||
dateProp: mapDateTime(json, r'date_prop', ''),
|
||||
datetimeProp: mapDateTime(json, r'datetime_prop', ''),
|
||||
arrayNullableProp: Object.listFromJson(json[r'array_nullable_prop']),
|
||||
arrayAndItemsNullableProp: Object.listFromJson(json[r'array_and_items_nullable_prop']),
|
||||
arrayItemsNullable: Object.listFromJson(json[r'array_items_nullable']),
|
||||
objectNullableProp: json[r'object_nullable_prop']
|
||||
objectAndItemsNullableProp: json[r'object_and_items_nullable_prop']
|
||||
objectItemsNullable: json[r'object_items_nullable']
|
||||
);
|
||||
objectNullableProp: mapValueOfType<Map<String, Object>>(json, r'object_nullable_prop'),
|
||||
objectAndItemsNullableProp: mapValueOfType<Map<String, Object>>(json, r'object_and_items_nullable_prop'),
|
||||
objectItemsNullable: mapValueOfType<Map<String, Object>>(json, r'object_items_nullable'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<NullableClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <NullableClass>[]
|
||||
: json.map((dynamic value) => NullableClass.fromJson(value)).toList(growable: true == growable);
|
||||
static List<NullableClass> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(NullableClass.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <NullableClass>[];
|
||||
|
||||
static Map<String, NullableClass> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, NullableClass> mapFromJson(dynamic json) {
|
||||
final map = <String, NullableClass>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = NullableClass.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = NullableClass.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of NullableClass-objects as value to a dart map
|
||||
static Map<String, List<NullableClass>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<NullableClass>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<NullableClass>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = NullableClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = NullableClass.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class NumberOnly {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(justNumber == null ? 0 : justNumber.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,35 +39,48 @@ class NumberOnly {
|
||||
}
|
||||
|
||||
/// Returns a new [NumberOnly] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static NumberOnly fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: NumberOnly(
|
||||
justNumber: json[r'JustNumber'] == null ?
|
||||
null :
|
||||
json[r'JustNumber'].toDouble(),
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static NumberOnly fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return NumberOnly(
|
||||
justNumber: json[r'JustNumber'] == null
|
||||
? null
|
||||
: num.parse(json[r'JustNumber'].toString()),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<NumberOnly> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <NumberOnly>[]
|
||||
: json.map((dynamic value) => NumberOnly.fromJson(value)).toList(growable: true == growable);
|
||||
static List<NumberOnly> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(NumberOnly.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <NumberOnly>[];
|
||||
|
||||
static Map<String, NumberOnly> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, NumberOnly> mapFromJson(dynamic json) {
|
||||
final map = <String, NumberOnly>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = NumberOnly.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = NumberOnly.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of NumberOnly-objects as value to a dart map
|
||||
static Map<String, List<NumberOnly>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<NumberOnly>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<NumberOnly>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = NumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = NumberOnly.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -35,6 +36,7 @@ class ObjectWithDeprecatedFields {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(uuid == null ? 0 : uuid.hashCode) +
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(deprecatedRef == null ? 0 : deprecatedRef.hashCode) +
|
||||
@ -61,40 +63,53 @@ class ObjectWithDeprecatedFields {
|
||||
}
|
||||
|
||||
/// Returns a new [ObjectWithDeprecatedFields] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ObjectWithDeprecatedFields fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ObjectWithDeprecatedFields(
|
||||
uuid: json[r'uuid'],
|
||||
id: json[r'id'] == null ?
|
||||
null :
|
||||
json[r'id'].toDouble(),
|
||||
deprecatedRef: DeprecatedObject.fromJson(json[r'deprecatedRef']),
|
||||
bars: json[r'bars'] == null
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ObjectWithDeprecatedFields fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ObjectWithDeprecatedFields(
|
||||
uuid: mapValueOfType<String>(json, r'uuid'),
|
||||
id: json[r'id'] == null
|
||||
? null
|
||||
: (json[r'bars'] as List).cast<String>(),
|
||||
);
|
||||
: num.parse(json[r'id'].toString()),
|
||||
deprecatedRef: DeprecatedObject.fromJson(json[r'deprecatedRef']),
|
||||
bars: json[r'bars'] is List
|
||||
? (json[r'bars'] as List).cast<String>()
|
||||
: null,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ObjectWithDeprecatedFields> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ObjectWithDeprecatedFields>[]
|
||||
: json.map((dynamic value) => ObjectWithDeprecatedFields.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ObjectWithDeprecatedFields> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ObjectWithDeprecatedFields.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ObjectWithDeprecatedFields>[];
|
||||
|
||||
static Map<String, ObjectWithDeprecatedFields> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ObjectWithDeprecatedFields> mapFromJson(dynamic json) {
|
||||
final map = <String, ObjectWithDeprecatedFields>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ObjectWithDeprecatedFields.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ObjectWithDeprecatedFields.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ObjectWithDeprecatedFields-objects as value to a dart map
|
||||
static Map<String, List<ObjectWithDeprecatedFields>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ObjectWithDeprecatedFields>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ObjectWithDeprecatedFields>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ObjectWithDeprecatedFields.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ObjectWithDeprecatedFields.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -44,6 +45,7 @@ class Order {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(petId == null ? 0 : petId.hashCode) +
|
||||
(quantity == null ? 0 : quantity.hashCode) +
|
||||
@ -78,40 +80,51 @@ class Order {
|
||||
}
|
||||
|
||||
/// Returns a new [Order] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Order fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Order(
|
||||
id: json[r'id'],
|
||||
petId: json[r'petId'],
|
||||
quantity: json[r'quantity'],
|
||||
shipDate: json[r'shipDate'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'shipDate']),
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Order fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Order(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
petId: mapValueOfType<int>(json, r'petId'),
|
||||
quantity: mapValueOfType<int>(json, r'quantity'),
|
||||
shipDate: mapDateTime(json, r'shipDate', ''),
|
||||
status: OrderStatusEnum.fromJson(json[r'status']),
|
||||
complete: json[r'complete'],
|
||||
);
|
||||
complete: mapValueOfType<bool>(json, r'complete'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Order> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Order>[]
|
||||
: json.map((dynamic value) => Order.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Order> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Order.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Order>[];
|
||||
|
||||
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Order> mapFromJson(dynamic json) {
|
||||
final map = <String, Order>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Order.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Order.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Order-objects as value to a dart map
|
||||
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Order>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Order>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Order.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Order.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -126,7 +139,7 @@ class OrderStatusEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -144,20 +157,18 @@ class OrderStatusEnum {
|
||||
static OrderStatusEnum fromJson(dynamic value) =>
|
||||
OrderStatusEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<OrderStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OrderStatusEnum>[]
|
||||
: json
|
||||
.map((value) => OrderStatusEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OrderStatusEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OrderStatusEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OrderStatusEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String,
|
||||
/// and [decode] dynamic data back to [OrderStatusEnum].
|
||||
class OrderStatusEnumTypeTransformer {
|
||||
const OrderStatusEnumTypeTransformer._();
|
||||
factory OrderStatusEnumTypeTransformer() => _instance ??= const OrderStatusEnumTypeTransformer._();
|
||||
|
||||
factory OrderStatusEnumTypeTransformer() => _instance ??= OrderStatusEnumTypeTransformer._();
|
||||
const OrderStatusEnumTypeTransformer._();
|
||||
|
||||
String encode(OrderStatusEnum data) => data.value;
|
||||
|
||||
@ -170,14 +181,16 @@ class OrderStatusEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OrderStatusEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'placed': return OrderStatusEnum.placed;
|
||||
case r'approved': return OrderStatusEnum.approved;
|
||||
case r'delivered': return OrderStatusEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'placed': return OrderStatusEnum.placed;
|
||||
case r'approved': return OrderStatusEnum.approved;
|
||||
case r'delivered': return OrderStatusEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -186,3 +199,4 @@ class OrderStatusEnumTypeTransformer {
|
||||
static OrderStatusEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -31,6 +32,7 @@ class OuterComposite {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(myNumber == null ? 0 : myNumber.hashCode) +
|
||||
(myString == null ? 0 : myString.hashCode) +
|
||||
(myBoolean == null ? 0 : myBoolean.hashCode);
|
||||
@ -53,37 +55,50 @@ class OuterComposite {
|
||||
}
|
||||
|
||||
/// Returns a new [OuterComposite] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static OuterComposite fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: OuterComposite(
|
||||
myNumber: json[r'my_number'] == null ?
|
||||
null :
|
||||
json[r'my_number'].toDouble(),
|
||||
myString: json[r'my_string'],
|
||||
myBoolean: json[r'my_boolean'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static OuterComposite fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return OuterComposite(
|
||||
myNumber: json[r'my_number'] == null
|
||||
? null
|
||||
: num.parse(json[r'my_number'].toString()),
|
||||
myString: mapValueOfType<String>(json, r'my_string'),
|
||||
myBoolean: mapValueOfType<bool>(json, r'my_boolean'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<OuterComposite> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterComposite>[]
|
||||
: json.map((dynamic value) => OuterComposite.fromJson(value)).toList(growable: true == growable);
|
||||
static List<OuterComposite> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterComposite.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterComposite>[];
|
||||
|
||||
static Map<String, OuterComposite> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, OuterComposite> mapFromJson(dynamic json) {
|
||||
final map = <String, OuterComposite>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = OuterComposite.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = OuterComposite.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of OuterComposite-objects as value to a dart map
|
||||
static Map<String, List<OuterComposite>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<OuterComposite>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<OuterComposite>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = OuterComposite.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = OuterComposite.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -18,7 +19,7 @@ class OuterEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -36,20 +37,18 @@ class OuterEnum {
|
||||
static OuterEnum fromJson(dynamic value) =>
|
||||
OuterEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<OuterEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterEnum>[]
|
||||
: json
|
||||
.map((value) => OuterEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OuterEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OuterEnum] to String,
|
||||
/// and [decode] dynamic data back to [OuterEnum].
|
||||
class OuterEnumTypeTransformer {
|
||||
const OuterEnumTypeTransformer._();
|
||||
factory OuterEnumTypeTransformer() => _instance ??= const OuterEnumTypeTransformer._();
|
||||
|
||||
factory OuterEnumTypeTransformer() => _instance ??= OuterEnumTypeTransformer._();
|
||||
const OuterEnumTypeTransformer._();
|
||||
|
||||
String encode(OuterEnum data) => data.value;
|
||||
|
||||
@ -62,14 +61,16 @@ class OuterEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OuterEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'placed': return OuterEnum.placed;
|
||||
case r'approved': return OuterEnum.approved;
|
||||
case r'delivered': return OuterEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'placed': return OuterEnum.placed;
|
||||
case r'approved': return OuterEnum.approved;
|
||||
case r'delivered': return OuterEnum.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -77,3 +78,4 @@ class OuterEnumTypeTransformer {
|
||||
/// Singleton [OuterEnumTypeTransformer] instance.
|
||||
static OuterEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -18,7 +19,7 @@ class OuterEnumDefaultValue {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -36,20 +37,18 @@ class OuterEnumDefaultValue {
|
||||
static OuterEnumDefaultValue fromJson(dynamic value) =>
|
||||
OuterEnumDefaultValueTypeTransformer().decode(value);
|
||||
|
||||
static List<OuterEnumDefaultValue> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterEnumDefaultValue>[]
|
||||
: json
|
||||
.map((value) => OuterEnumDefaultValue.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OuterEnumDefaultValue> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterEnumDefaultValue.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterEnumDefaultValue>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OuterEnumDefaultValue] to String,
|
||||
/// and [decode] dynamic data back to [OuterEnumDefaultValue].
|
||||
class OuterEnumDefaultValueTypeTransformer {
|
||||
const OuterEnumDefaultValueTypeTransformer._();
|
||||
factory OuterEnumDefaultValueTypeTransformer() => _instance ??= const OuterEnumDefaultValueTypeTransformer._();
|
||||
|
||||
factory OuterEnumDefaultValueTypeTransformer() => _instance ??= OuterEnumDefaultValueTypeTransformer._();
|
||||
const OuterEnumDefaultValueTypeTransformer._();
|
||||
|
||||
String encode(OuterEnumDefaultValue data) => data.value;
|
||||
|
||||
@ -62,14 +61,16 @@ class OuterEnumDefaultValueTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OuterEnumDefaultValue decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'placed': return OuterEnumDefaultValue.placed;
|
||||
case r'approved': return OuterEnumDefaultValue.approved;
|
||||
case r'delivered': return OuterEnumDefaultValue.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'placed': return OuterEnumDefaultValue.placed;
|
||||
case r'approved': return OuterEnumDefaultValue.approved;
|
||||
case r'delivered': return OuterEnumDefaultValue.delivered;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -77,3 +78,4 @@ class OuterEnumDefaultValueTypeTransformer {
|
||||
/// Singleton [OuterEnumDefaultValueTypeTransformer] instance.
|
||||
static OuterEnumDefaultValueTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -18,7 +19,7 @@ class OuterEnumInteger {
|
||||
final int value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
String toString() => value == null ? '' : value.toString();
|
||||
|
||||
int toJson() => value;
|
||||
|
||||
@ -36,20 +37,18 @@ class OuterEnumInteger {
|
||||
static OuterEnumInteger fromJson(dynamic value) =>
|
||||
OuterEnumIntegerTypeTransformer().decode(value);
|
||||
|
||||
static List<OuterEnumInteger> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterEnumInteger>[]
|
||||
: json
|
||||
.map((value) => OuterEnumInteger.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OuterEnumInteger> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterEnumInteger.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterEnumInteger>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OuterEnumInteger] to int,
|
||||
/// and [decode] dynamic data back to [OuterEnumInteger].
|
||||
class OuterEnumIntegerTypeTransformer {
|
||||
const OuterEnumIntegerTypeTransformer._();
|
||||
factory OuterEnumIntegerTypeTransformer() => _instance ??= const OuterEnumIntegerTypeTransformer._();
|
||||
|
||||
factory OuterEnumIntegerTypeTransformer() => _instance ??= OuterEnumIntegerTypeTransformer._();
|
||||
const OuterEnumIntegerTypeTransformer._();
|
||||
|
||||
int encode(OuterEnumInteger data) => data.value;
|
||||
|
||||
@ -62,14 +61,16 @@ class OuterEnumIntegerTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OuterEnumInteger decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case 0: return OuterEnumInteger.number0;
|
||||
case 1: return OuterEnumInteger.number1;
|
||||
case 2: return OuterEnumInteger.number2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case 0: return OuterEnumInteger.number0;
|
||||
case 1: return OuterEnumInteger.number1;
|
||||
case 2: return OuterEnumInteger.number2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -77,3 +78,4 @@ class OuterEnumIntegerTypeTransformer {
|
||||
/// Singleton [OuterEnumIntegerTypeTransformer] instance.
|
||||
static OuterEnumIntegerTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -18,7 +19,7 @@ class OuterEnumIntegerDefaultValue {
|
||||
final int value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
String toString() => value == null ? '' : value.toString();
|
||||
|
||||
int toJson() => value;
|
||||
|
||||
@ -36,20 +37,18 @@ class OuterEnumIntegerDefaultValue {
|
||||
static OuterEnumIntegerDefaultValue fromJson(dynamic value) =>
|
||||
OuterEnumIntegerDefaultValueTypeTransformer().decode(value);
|
||||
|
||||
static List<OuterEnumIntegerDefaultValue> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterEnumIntegerDefaultValue>[]
|
||||
: json
|
||||
.map((value) => OuterEnumIntegerDefaultValue.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<OuterEnumIntegerDefaultValue> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterEnumIntegerDefaultValue.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterEnumIntegerDefaultValue>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [OuterEnumIntegerDefaultValue] to int,
|
||||
/// and [decode] dynamic data back to [OuterEnumIntegerDefaultValue].
|
||||
class OuterEnumIntegerDefaultValueTypeTransformer {
|
||||
const OuterEnumIntegerDefaultValueTypeTransformer._();
|
||||
factory OuterEnumIntegerDefaultValueTypeTransformer() => _instance ??= const OuterEnumIntegerDefaultValueTypeTransformer._();
|
||||
|
||||
factory OuterEnumIntegerDefaultValueTypeTransformer() => _instance ??= OuterEnumIntegerDefaultValueTypeTransformer._();
|
||||
const OuterEnumIntegerDefaultValueTypeTransformer._();
|
||||
|
||||
int encode(OuterEnumIntegerDefaultValue data) => data.value;
|
||||
|
||||
@ -62,14 +61,16 @@ class OuterEnumIntegerDefaultValueTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
OuterEnumIntegerDefaultValue decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case 0: return OuterEnumIntegerDefaultValue.number0;
|
||||
case 1: return OuterEnumIntegerDefaultValue.number1;
|
||||
case 2: return OuterEnumIntegerDefaultValue.number2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case 0: return OuterEnumIntegerDefaultValue.number0;
|
||||
case 1: return OuterEnumIntegerDefaultValue.number1;
|
||||
case 2: return OuterEnumIntegerDefaultValue.number2;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -77,3 +78,4 @@ class OuterEnumIntegerDefaultValueTypeTransformer {
|
||||
/// Singleton [OuterEnumIntegerDefaultValueTypeTransformer] instance.
|
||||
static OuterEnumIntegerDefaultValueTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class OuterObjectWithEnumProperty {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(value == null ? 0 : value.hashCode);
|
||||
|
||||
@override
|
||||
@ -35,33 +37,46 @@ class OuterObjectWithEnumProperty {
|
||||
}
|
||||
|
||||
/// Returns a new [OuterObjectWithEnumProperty] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static OuterObjectWithEnumProperty fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: OuterObjectWithEnumProperty(
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static OuterObjectWithEnumProperty fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return OuterObjectWithEnumProperty(
|
||||
value: OuterEnumInteger.fromJson(json[r'value']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<OuterObjectWithEnumProperty> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <OuterObjectWithEnumProperty>[]
|
||||
: json.map((dynamic value) => OuterObjectWithEnumProperty.fromJson(value)).toList(growable: true == growable);
|
||||
static List<OuterObjectWithEnumProperty> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(OuterObjectWithEnumProperty.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <OuterObjectWithEnumProperty>[];
|
||||
|
||||
static Map<String, OuterObjectWithEnumProperty> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, OuterObjectWithEnumProperty> mapFromJson(dynamic json) {
|
||||
final map = <String, OuterObjectWithEnumProperty>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = OuterObjectWithEnumProperty.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = OuterObjectWithEnumProperty.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map
|
||||
static Map<String, List<OuterObjectWithEnumProperty>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<OuterObjectWithEnumProperty>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<OuterObjectWithEnumProperty>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = OuterObjectWithEnumProperty.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = OuterObjectWithEnumProperty.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -44,6 +45,7 @@ class Pet {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(category == null ? 0 : category.hashCode) +
|
||||
(name == null ? 0 : name.hashCode) +
|
||||
@ -74,40 +76,53 @@ class Pet {
|
||||
}
|
||||
|
||||
/// Returns a new [Pet] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Pet fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Pet(
|
||||
id: json[r'id'],
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Pet fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Pet(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
category: Category.fromJson(json[r'category']),
|
||||
name: json[r'name'],
|
||||
photoUrls: json[r'photoUrls'] == null
|
||||
? null
|
||||
: (json[r'photoUrls'] as Set).cast<String>(),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
photoUrls: json[r'photoUrls'] is Set
|
||||
? (json[r'photoUrls'] as Set).cast<String>()
|
||||
: null,
|
||||
tags: Tag.listFromJson(json[r'tags']),
|
||||
status: PetStatusEnum.fromJson(json[r'status']),
|
||||
);
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Pet> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Pet>[]
|
||||
: json.map((dynamic value) => Pet.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Pet> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Pet.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Pet>[];
|
||||
|
||||
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Pet> mapFromJson(dynamic json) {
|
||||
final map = <String, Pet>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Pet.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Pet.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Pet-objects as value to a dart map
|
||||
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Pet>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Pet>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Pet.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Pet.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@ -122,7 +137,7 @@ class PetStatusEnum {
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
String toString() => value ?? '';
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
@ -140,20 +155,18 @@ class PetStatusEnum {
|
||||
static PetStatusEnum fromJson(dynamic value) =>
|
||||
PetStatusEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<PetStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <PetStatusEnum>[]
|
||||
: json
|
||||
.map((value) => PetStatusEnum.fromJson(value))
|
||||
.toList(growable: true == growable);
|
||||
static List<PetStatusEnum> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(PetStatusEnum.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <PetStatusEnum>[];
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [PetStatusEnum] to String,
|
||||
/// and [decode] dynamic data back to [PetStatusEnum].
|
||||
class PetStatusEnumTypeTransformer {
|
||||
const PetStatusEnumTypeTransformer._();
|
||||
factory PetStatusEnumTypeTransformer() => _instance ??= const PetStatusEnumTypeTransformer._();
|
||||
|
||||
factory PetStatusEnumTypeTransformer() => _instance ??= PetStatusEnumTypeTransformer._();
|
||||
const PetStatusEnumTypeTransformer._();
|
||||
|
||||
String encode(PetStatusEnum data) => data.value;
|
||||
|
||||
@ -166,14 +179,16 @@ class PetStatusEnumTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
PetStatusEnum decode(dynamic data, {bool allowNull}) {
|
||||
switch (data) {
|
||||
case r'available': return PetStatusEnum.available;
|
||||
case r'pending': return PetStatusEnum.pending;
|
||||
case r'sold': return PetStatusEnum.sold;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'available': return PetStatusEnum.available;
|
||||
case r'pending': return PetStatusEnum.pending;
|
||||
case r'sold': return PetStatusEnum.sold;
|
||||
default:
|
||||
if (allowNull == false) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -182,3 +197,4 @@ class PetStatusEnumTypeTransformer {
|
||||
static PetStatusEnumTypeTransformer _instance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class ReadOnlyFirst {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(bar == null ? 0 : bar.hashCode) +
|
||||
(baz == null ? 0 : baz.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class ReadOnlyFirst {
|
||||
}
|
||||
|
||||
/// Returns a new [ReadOnlyFirst] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ReadOnlyFirst fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ReadOnlyFirst(
|
||||
bar: json[r'bar'],
|
||||
baz: json[r'baz'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static ReadOnlyFirst fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return ReadOnlyFirst(
|
||||
bar: mapValueOfType<String>(json, r'bar'),
|
||||
baz: mapValueOfType<String>(json, r'baz'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ReadOnlyFirst> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ReadOnlyFirst>[]
|
||||
: json.map((dynamic value) => ReadOnlyFirst.fromJson(value)).toList(growable: true == growable);
|
||||
static List<ReadOnlyFirst> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(ReadOnlyFirst.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <ReadOnlyFirst>[];
|
||||
|
||||
static Map<String, ReadOnlyFirst> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, ReadOnlyFirst> mapFromJson(dynamic json) {
|
||||
final map = <String, ReadOnlyFirst>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = ReadOnlyFirst.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = ReadOnlyFirst.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ReadOnlyFirst-objects as value to a dart map
|
||||
static Map<String, List<ReadOnlyFirst>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<ReadOnlyFirst>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ReadOnlyFirst>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = ReadOnlyFirst.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = ReadOnlyFirst.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -23,6 +24,7 @@ class SpecialModelName {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode);
|
||||
|
||||
@override
|
||||
@ -37,33 +39,46 @@ class SpecialModelName {
|
||||
}
|
||||
|
||||
/// Returns a new [SpecialModelName] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static SpecialModelName fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: SpecialModelName(
|
||||
dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: json[r'$special[property.name]'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SpecialModelName fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return SpecialModelName(
|
||||
dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: mapValueOfType<int>(json, r'$special[property.name]'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SpecialModelName> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <SpecialModelName>[]
|
||||
: json.map((dynamic value) => SpecialModelName.fromJson(value)).toList(growable: true == growable);
|
||||
static List<SpecialModelName> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(SpecialModelName.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <SpecialModelName>[];
|
||||
|
||||
static Map<String, SpecialModelName> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, SpecialModelName> mapFromJson(dynamic json) {
|
||||
final map = <String, SpecialModelName>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = SpecialModelName.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = SpecialModelName.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SpecialModelName-objects as value to a dart map
|
||||
static Map<String, List<SpecialModelName>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<SpecialModelName>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<SpecialModelName>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = SpecialModelName.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = SpecialModelName.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -27,6 +28,7 @@ class Tag {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(name == null ? 0 : name.hashCode);
|
||||
|
||||
@ -45,34 +47,47 @@ class Tag {
|
||||
}
|
||||
|
||||
/// Returns a new [Tag] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Tag fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Tag(
|
||||
id: json[r'id'],
|
||||
name: json[r'name'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Tag fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return Tag(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<Tag> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Tag>[]
|
||||
: json.map((dynamic value) => Tag.fromJson(value)).toList(growable: true == growable);
|
||||
static List<Tag> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(Tag.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <Tag>[];
|
||||
|
||||
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, Tag> mapFromJson(dynamic json) {
|
||||
final map = <String, Tag>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = Tag.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = Tag.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Tag-objects as value to a dart map
|
||||
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<Tag>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Tag>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = Tag.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = Tag.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -52,6 +53,7 @@ class User {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(username == null ? 0 : username.hashCode) +
|
||||
(firstName == null ? 0 : firstName.hashCode) +
|
||||
@ -94,40 +96,53 @@ class User {
|
||||
}
|
||||
|
||||
/// Returns a new [User] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static User fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: User(
|
||||
id: json[r'id'],
|
||||
username: json[r'username'],
|
||||
firstName: json[r'firstName'],
|
||||
lastName: json[r'lastName'],
|
||||
email: json[r'email'],
|
||||
password: json[r'password'],
|
||||
phone: json[r'phone'],
|
||||
userStatus: json[r'userStatus'],
|
||||
);
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static User fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
return User(
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
username: mapValueOfType<String>(json, r'username'),
|
||||
firstName: mapValueOfType<String>(json, r'firstName'),
|
||||
lastName: mapValueOfType<String>(json, r'lastName'),
|
||||
email: mapValueOfType<String>(json, r'email'),
|
||||
password: mapValueOfType<String>(json, r'password'),
|
||||
phone: mapValueOfType<String>(json, r'phone'),
|
||||
userStatus: mapValueOfType<int>(json, r'userStatus'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<User> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <User>[]
|
||||
: json.map((dynamic value) => User.fromJson(value)).toList(growable: true == growable);
|
||||
static List<User> listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
|
||||
json is List && json.isNotEmpty
|
||||
? json.map(User.fromJson).toList(growable: true == growable)
|
||||
: true == emptyIsNull ? null : <User>[];
|
||||
|
||||
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
|
||||
static Map<String, User> mapFromJson(dynamic json) {
|
||||
final map = <String, User>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) => map[key] = User.fromJson(value));
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) => map[key] = User.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of User-objects as value to a dart map
|
||||
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
static Map<String, List<User>> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<User>>{};
|
||||
if (json?.isNotEmpty == true) {
|
||||
json.forEach((key, value) {
|
||||
map[key] = User.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,);
|
||||
});
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json
|
||||
.cast<String, dynamic>()
|
||||
.forEach((key, dynamic value) {
|
||||
map[key] = User.listFromJson(
|
||||
value,
|
||||
emptyIsNull: emptyIsNull,
|
||||
growable: growable,
|
||||
);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: true
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
library openapi.api;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -25,33 +26,34 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient) async {
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async {
|
||||
// Verify required params are set.
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/another-fake/dummy';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PATCH',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -64,8 +66,8 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<ModelClient> call123testSpecialTags(ModelClient modelClient) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(modelClient);
|
||||
Future<ModelClient> call123testSpecialTags(ModelClient modelClient,) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(modelClient,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
@ -76,6 +78,6 @@ class AnotherFakeApi {
|
||||
|
||||
return ModelClient.fromJson(json.decode(response.body));
|
||||
}
|
||||
return Future<ModelClient>.value(null);
|
||||
return Future<ModelClient>.value();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
@ -17,27 +18,28 @@ class DefaultApi {
|
||||
|
||||
/// Performs an HTTP 'GET /foo' operation and returns the [Response].
|
||||
Future<Response> fooGetWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/foo';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>[];
|
||||
const authNames = <String>[];
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
contentTypes.isEmpty ? null : contentTypes[0],
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
@ -54,6 +56,6 @@ class DefaultApi {
|
||||
|
||||
return InlineResponseDefault.fromJson(json.decode(response.body));
|
||||
}
|
||||
return Future<InlineResponseDefault>.value(null);
|
||||
return Future<InlineResponseDefault>.value();
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user