forked from loafle/openapi-generator-original
Update Dart petstore with OAS3, fix mustache format (#227)
* update dart petstore with oas3, fix mustache format * update default value to null
This commit is contained in:
parent
252a1c2599
commit
c791146b62
51
bin/openapi3/dart-petstore.sh
Executable file
51
bin/openapi3/dart-petstore.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
echo "# START SCRIPT: $SCRIPT"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
|
||||||
|
# Generate non-browserClient
|
||||||
|
ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
|
||||||
|
|
||||||
|
# then options to generate the library for vm would be:
|
||||||
|
#ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm"
|
||||||
|
#java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
|
# Generate browserClient
|
||||||
|
ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true"
|
||||||
|
#java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
|
# Generate non-browserClient and put it to the flutter sample app
|
||||||
|
ags="$@ generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false"
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
|
# There is a proposal to allow importing different libraries depending on the environment:
|
||||||
|
# https://github.com/munificent/dep-interface-libraries
|
||||||
|
# When this is implemented there will only be one library.
|
||||||
|
|
||||||
|
# The current petstore test will then work for both: the browser library and the vm library.
|
||||||
|
|
@ -283,13 +283,18 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toDefaultValue(Schema p) {
|
public String toDefaultValue(Schema schema) {
|
||||||
if (ModelUtils.isMapSchema(p)) {
|
if (ModelUtils.isMapSchema(schema)) {
|
||||||
return "{}";
|
return "{}";
|
||||||
} else if (ModelUtils.isArraySchema(p)) {
|
} else if (ModelUtils.isArraySchema(schema)) {
|
||||||
return "[]";
|
return "[]";
|
||||||
}
|
}
|
||||||
return super.toDefaultValue(p);
|
|
||||||
|
if (schema.getDefault() != null) {
|
||||||
|
return schema.getDefault().toString();
|
||||||
|
} else {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,8 @@ class {{classname}} {
|
|||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{#headerParams}}headerParams["{{baseName}}"] = {{paramName}};
|
{{#headerParams}}
|
||||||
|
headerParams["{{baseName}}"] = {{paramName}};
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
List<String> contentTypes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}];
|
List<String> contentTypes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}];
|
||||||
@ -90,20 +91,25 @@ class {{classname}} {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return
|
|
||||||
{{#isListContainer}}
|
{{#isListContainer}}
|
||||||
{{#returnType}}(apiClient.deserialize(response.body, '{{{returnType}}}') as List).map((item) => item as {{returnBaseType}}).toList();{{/returnType}}
|
{{#returnType}}
|
||||||
|
return (apiClient.deserialize(response.body, '{{{returnType}}}') as List).map((item) => item as {{returnBaseType}}).toList();
|
||||||
|
{{/returnType}}
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
{{^isListContainer}}
|
{{^isListContainer}}
|
||||||
{{#isMapContainer}}
|
{{#isMapContainer}}
|
||||||
{{#returnType}}new {{{returnType}}}.from(apiClient.deserialize(response.body, '{{{returnType}}}')) {{/returnType}};
|
{{#returnType}}
|
||||||
|
return new {{{returnType}}}.from(apiClient.deserialize(response.body, '{{{returnType}}}'));
|
||||||
|
{{/returnType}};
|
||||||
{{/isMapContainer}}
|
{{/isMapContainer}}
|
||||||
{{^isMapContainer}}
|
{{^isMapContainer}}
|
||||||
{{#returnType}}apiClient.deserialize(response.body, '{{{returnType}}}') as {{{returnType}}} {{/returnType}};
|
{{#returnType}}
|
||||||
|
return apiClient.deserialize(response.body, '{{{returnType}}}') as {{{returnType}}};
|
||||||
|
{{/returnType}}
|
||||||
{{/isMapContainer}}
|
{{/isMapContainer}}
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
} else {
|
} else {
|
||||||
return {{#returnType}}null{{/returnType}};
|
return{{#returnType}} null{{/returnType}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
class {{classname}} {
|
class {{classname}} {
|
||||||
{{#vars}}{{#description}}/* {{{description}}} */{{/description}}
|
{{#vars}}
|
||||||
|
{{#description}}/* {{{description}}} */{{/description}}
|
||||||
{{{datatype}}} {{name}} = {{{defaultValue}}};
|
{{{datatype}}} {{name}} = {{{defaultValue}}};
|
||||||
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}}
|
{{#allowableValues}}
|
||||||
|
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{
|
||||||
|
{{/allowableValues}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
{{classname}}();
|
{{classname}}();
|
||||||
|
|
||||||
@ -17,20 +20,27 @@ class {{classname}} {
|
|||||||
{{name}} = json['{{name}}'] == null ? null : DateTime.parse(json['{{name}}']);
|
{{name}} = json['{{name}}'] == null ? null : DateTime.parse(json['{{name}}']);
|
||||||
{{/isDateTime}}
|
{{/isDateTime}}
|
||||||
{{^isDateTime}}
|
{{^isDateTime}}
|
||||||
{{name}} =
|
|
||||||
{{#complexType}}
|
{{#complexType}}
|
||||||
{{#isListContainer}}{{complexType}}.listFromJson(json['{{name}}']){{/isListContainer}}{{^isListContainer}}
|
{{#isListContainer}}
|
||||||
{{#isMapContainer}}{{complexType}}.mapFromJson(json['{{name}}']){{/isMapContainer}}
|
{{name}} = {{complexType}}.listFromJson(json['{{name}}']);
|
||||||
{{^isMapContainer}}new {{complexType}}.fromJson(json['{{name}}']){{/isMapContainer}}{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
|
{{^isListContainer}}
|
||||||
|
{{#isMapContainer}}
|
||||||
|
{{name}} = {{complexType}}.mapFromJson(json['{{name}}']);
|
||||||
|
{{/isMapContainer}}
|
||||||
|
{{^isMapContainer}}
|
||||||
|
{{name}} = new {{complexType}}.fromJson(json['{{name}}']);
|
||||||
|
{{/isMapContainer}}
|
||||||
|
{{/isListContainer}}
|
||||||
{{/complexType}}
|
{{/complexType}}
|
||||||
{{^complexType}}
|
{{^complexType}}
|
||||||
{{#isListContainer}}
|
{{#isListContainer}}
|
||||||
(json['{{name}}'] as List).map((item) => item as {{items.datatype}}).toList()
|
{{name}} = (json['{{name}}'] as List).map((item) => item as {{items.datatype}}).toList();
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
{{^isListContainer}}
|
{{^isListContainer}}
|
||||||
json['{{name}}']
|
{{name}} = json['{{name}}'];
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
{{/complexType}};
|
{{/complexType}}
|
||||||
{{/isDateTime}}
|
{{/isDateTime}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
@ -38,9 +48,14 @@ class {{classname}} {
|
|||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#isDateTime}}'{{name}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}{{/isDateTime}}{{^isDateTime}}'{{name}}': {{name}}{{^-last}},{{/-last}}{{/isDateTime}}
|
{{#isDateTime}}
|
||||||
|
'{{name}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}}
|
||||||
|
{{/isDateTime}}
|
||||||
|
{{^isDateTime}}
|
||||||
|
'{{name}}': {{name}}{{^-last}},{{/-last}}
|
||||||
|
{{/isDateTime}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<{{classname}}> listFromJson(List<dynamic> json) {
|
static List<{{classname}}> listFromJson(List<dynamic> json) {
|
||||||
|
@ -2,6 +2,11 @@ part of {{pubName}}.api;
|
|||||||
|
|
||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}
|
{{#model}}
|
||||||
{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}}
|
{{#isEnum}}
|
||||||
|
{{>enum}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{^isEnum}}
|
||||||
|
{{>class}}
|
||||||
|
{{/isEnum}}
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -1 +1 @@
|
|||||||
2.4.0-SNAPSHOT
|
3.0.0-SNAPSHOT
|
@ -1,7 +1,7 @@
|
|||||||
# swagger
|
# swagger
|
||||||
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
|
||||||
This Dart package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Build package: org.openapitools.codegen.languages.DartClientCodegen
|
- Build package: org.openapitools.codegen.languages.DartClientCodegen
|
||||||
|
@ -13,7 +13,7 @@ Name | Type | Description | Notes
|
|||||||
**quantity** | **int** | | [optional] [default to null]
|
**quantity** | **int** | | [optional] [default to null]
|
||||||
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
|
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
|
||||||
**status** | **String** | Order Status | [optional] [default to null]
|
**status** | **String** | Order Status | [optional] [default to null]
|
||||||
**complete** | **bool** | | [optional] [default to null]
|
**complete** | **bool** | | [optional] [default to false]
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -312,8 +312,8 @@ try {
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**petId** | **int**| ID of pet that needs to be updated |
|
**petId** | **int**| ID of pet that needs to be updated |
|
||||||
**name** | **String**| Updated name of the pet | [optional]
|
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
||||||
**status** | **String**| Updated status of the pet | [optional]
|
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -359,8 +359,8 @@ try {
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**petId** | **int**| ID of pet to update |
|
**petId** | **int**| ID of pet to update |
|
||||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||||
**file** | **MultipartFile**| file to upload | [optional]
|
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: application/xml, application/json
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
@ -56,7 +56,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
@ -96,7 +96,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
@ -136,7 +136,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
@ -342,7 +342,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
|
@ -25,7 +25,7 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
List<String> contentTypes = ["application/json","application/xml"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -52,9 +52,8 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Deletes a pet
|
/// Deletes a pet
|
||||||
@ -103,9 +102,8 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Finds Pets by status
|
/// Finds Pets by status
|
||||||
@ -126,8 +124,8 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "status", status));
|
queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status));
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -154,7 +152,7 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'List<Pet>') as List<Pet> ;
|
return (apiClient.deserialize(response.body, 'List<Pet>') as List).map((item) => item as Pet).toList();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -177,8 +175,8 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "tags", tags));
|
queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags));
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -205,7 +203,7 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'List<Pet>') as List<Pet> ;
|
return (apiClient.deserialize(response.body, 'List<Pet>') as List).map((item) => item as Pet).toList();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -228,7 +226,7 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -255,7 +253,7 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'Pet') as Pet ;
|
return apiClient.deserialize(response.body, 'Pet') as Pet;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -278,7 +276,7 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
List<String> contentTypes = ["application/json","application/xml"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -305,9 +303,8 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Updates a pet in the store with form data
|
/// Updates a pet in the store with form data
|
||||||
@ -328,7 +325,7 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -367,9 +364,8 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// uploads an image
|
/// uploads an image
|
||||||
@ -390,7 +386,7 @@ class PetApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = ["multipart/form-data"];
|
List<String> contentTypes = ["multipart/form-data"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -428,7 +424,7 @@ class PetApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse ;
|
return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class StoreApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -52,9 +52,8 @@ class StoreApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Returns pet inventories by status
|
/// Returns pet inventories by status
|
||||||
@ -72,7 +71,7 @@ class StoreApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -99,7 +98,8 @@ class StoreApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'Map<String, int>') as Map<String, int> ;
|
return new Map<String, int>.from(apiClient.deserialize(response.body, 'Map<String, int>'));
|
||||||
|
;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ class StoreApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -149,7 +149,7 @@ class StoreApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'Order') as Order ;
|
return apiClient.deserialize(response.body, 'Order') as Order;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -172,8 +172,8 @@ class StoreApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = ["application/json"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
@ -199,7 +199,7 @@ class StoreApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'Order') as Order ;
|
return apiClient.deserialize(response.body, 'Order') as Order;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = ["application/json"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
@ -52,9 +52,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Creates list of users with given input array
|
/// Creates list of users with given input array
|
||||||
@ -75,8 +74,8 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = ["application/json"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
@ -102,9 +101,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Creates list of users with given input array
|
/// Creates list of users with given input array
|
||||||
@ -125,8 +123,8 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = ["application/json"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
@ -152,9 +150,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Delete user
|
/// Delete user
|
||||||
@ -175,7 +172,7 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -202,9 +199,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Get user by user name
|
/// Get user by user name
|
||||||
@ -225,7 +221,7 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -252,7 +248,7 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'User') as User ;
|
return apiClient.deserialize(response.body, 'User') as User;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -280,7 +276,7 @@ class UserApi {
|
|||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "username", username));
|
queryParams.addAll(_convertParametersForCollectionFormat("", "username", username));
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "password", password));
|
queryParams.addAll(_convertParametersForCollectionFormat("", "password", password));
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -307,7 +303,7 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return apiClient.deserialize(response.body, 'String') as String ;
|
return apiClient.deserialize(response.body, 'String') as String;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -327,7 +323,7 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = [];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
@ -354,9 +350,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Updated user
|
/// Updated user
|
||||||
@ -380,8 +375,8 @@ class UserApi {
|
|||||||
List<QueryParam> queryParams = [];
|
List<QueryParam> queryParams = [];
|
||||||
Map<String, String> headerParams = {};
|
Map<String, String> headerParams = {};
|
||||||
Map<String, String> formParams = {};
|
Map<String, String> formParams = {};
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
List<String> contentTypes = ["application/json"];
|
||||||
|
|
||||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||||
List<String> authNames = [];
|
List<String> authNames = [];
|
||||||
@ -407,9 +402,8 @@ class UserApi {
|
|||||||
if(response.statusCode >= 400) {
|
if(response.statusCode >= 400) {
|
||||||
throw new ApiException(response.statusCode, response.body);
|
throw new ApiException(response.statusCode, response.body);
|
||||||
} else if(response.body != null) {
|
} else if(response.body != null) {
|
||||||
return ;
|
|
||||||
} else {
|
} else {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,9 @@ class ApiResponse {
|
|||||||
|
|
||||||
int code = null;
|
int code = null;
|
||||||
|
|
||||||
|
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
|
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
ApiResponse();
|
ApiResponse();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -19,12 +16,9 @@ class ApiResponse {
|
|||||||
|
|
||||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
code =
|
code = json['code'];
|
||||||
json['code'];
|
type = json['type'];
|
||||||
type =
|
message = json['message'];
|
||||||
json['type'];
|
|
||||||
message =
|
|
||||||
json['message'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -32,15 +26,11 @@ class ApiResponse {
|
|||||||
'code': code,
|
'code': code,
|
||||||
'type': type,
|
'type': type,
|
||||||
'message': message
|
'message': message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<ApiResponse> listFromJson(List<Map<String, dynamic>> json) {
|
static List<ApiResponse> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<ApiResponse>();
|
return json == null ? new List<ApiResponse>() : json.map((value) => new ApiResponse.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new ApiResponse.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, ApiResponse> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, ApiResponse> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
@ -4,9 +4,7 @@ class Category {
|
|||||||
|
|
||||||
int id = null;
|
int id = null;
|
||||||
|
|
||||||
|
|
||||||
String name = null;
|
String name = null;
|
||||||
|
|
||||||
Category();
|
Category();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -16,25 +14,19 @@ class Category {
|
|||||||
|
|
||||||
Category.fromJson(Map<String, dynamic> json) {
|
Category.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id =
|
id = json['id'];
|
||||||
json['id'];
|
name = json['name'];
|
||||||
name =
|
|
||||||
json['name'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'name': name
|
'name': name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Category> listFromJson(List<Map<String, dynamic>> json) {
|
static List<Category> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<Category>();
|
return json == null ? new List<Category>() : json.map((value) => new Category.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new Category.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, Category> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, Category> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
@ -4,21 +4,16 @@ class Order {
|
|||||||
|
|
||||||
int id = null;
|
int id = null;
|
||||||
|
|
||||||
|
|
||||||
int petId = null;
|
int petId = null;
|
||||||
|
|
||||||
|
|
||||||
int quantity = null;
|
int quantity = null;
|
||||||
|
|
||||||
|
|
||||||
DateTime shipDate = null;
|
DateTime shipDate = null;
|
||||||
|
/* Order Status */
|
||||||
/* Order Status */
|
|
||||||
String status = null;
|
String status = null;
|
||||||
//enum statusEnum { placed, approved, delivered, };
|
//enum statusEnum { placed, approved, delivered, };{
|
||||||
|
|
||||||
bool complete = null;
|
|
||||||
|
|
||||||
|
bool complete = false;
|
||||||
Order();
|
Order();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -28,17 +23,12 @@ class Order {
|
|||||||
|
|
||||||
Order.fromJson(Map<String, dynamic> json) {
|
Order.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id =
|
id = json['id'];
|
||||||
json['id'];
|
petId = json['petId'];
|
||||||
petId =
|
quantity = json['quantity'];
|
||||||
json['petId'];
|
|
||||||
quantity =
|
|
||||||
json['quantity'];
|
|
||||||
shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']);
|
shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']);
|
||||||
status =
|
status = json['status'];
|
||||||
json['status'];
|
complete = json['complete'];
|
||||||
complete =
|
|
||||||
json['complete'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -49,15 +39,11 @@ class Order {
|
|||||||
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
|
'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(),
|
||||||
'status': status,
|
'status': status,
|
||||||
'complete': complete
|
'complete': complete
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Order> listFromJson(List<Map<String, dynamic>> json) {
|
static List<Order> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<Order>();
|
return json == null ? new List<Order>() : json.map((value) => new Order.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new Order.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, Order> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, Order> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
@ -4,21 +4,16 @@ class Pet {
|
|||||||
|
|
||||||
int id = null;
|
int id = null;
|
||||||
|
|
||||||
|
|
||||||
Category category = null;
|
Category category = null;
|
||||||
|
|
||||||
|
|
||||||
String name = null;
|
String name = null;
|
||||||
|
|
||||||
|
|
||||||
List<String> photoUrls = [];
|
List<String> photoUrls = [];
|
||||||
|
|
||||||
|
|
||||||
List<Tag> tags = [];
|
List<Tag> tags = [];
|
||||||
|
/* pet status in the store */
|
||||||
/* pet status in the store */
|
|
||||||
String status = null;
|
String status = null;
|
||||||
//enum statusEnum { available, pending, sold, };
|
//enum statusEnum { available, pending, sold, };{
|
||||||
Pet();
|
Pet();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -28,22 +23,12 @@ class Pet {
|
|||||||
|
|
||||||
Pet.fromJson(Map<String, dynamic> json) {
|
Pet.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id =
|
id = json['id'];
|
||||||
json['id'];
|
category = new Category.fromJson(json['category']);
|
||||||
category =
|
name = json['name'];
|
||||||
|
photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList();
|
||||||
|
tags = Tag.listFromJson(json['tags']);
|
||||||
new Category.fromJson(json['category'])
|
status = json['status'];
|
||||||
;
|
|
||||||
name =
|
|
||||||
json['name'];
|
|
||||||
photoUrls =
|
|
||||||
json['photoUrls'];
|
|
||||||
tags =
|
|
||||||
Tag.listFromJson(json['tags'])
|
|
||||||
;
|
|
||||||
status =
|
|
||||||
json['status'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -54,15 +39,11 @@ class Pet {
|
|||||||
'photoUrls': photoUrls,
|
'photoUrls': photoUrls,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
'status': status
|
'status': status
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Pet> listFromJson(List<Map<String, dynamic>> json) {
|
static List<Pet> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<Pet>();
|
return json == null ? new List<Pet>() : json.map((value) => new Pet.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new Pet.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, Pet> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, Pet> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
@ -4,9 +4,7 @@ class Tag {
|
|||||||
|
|
||||||
int id = null;
|
int id = null;
|
||||||
|
|
||||||
|
|
||||||
String name = null;
|
String name = null;
|
||||||
|
|
||||||
Tag();
|
Tag();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -16,25 +14,19 @@ class Tag {
|
|||||||
|
|
||||||
Tag.fromJson(Map<String, dynamic> json) {
|
Tag.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id =
|
id = json['id'];
|
||||||
json['id'];
|
name = json['name'];
|
||||||
name =
|
|
||||||
json['name'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
'id': id,
|
'id': id,
|
||||||
'name': name
|
'name': name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Tag> listFromJson(List<Map<String, dynamic>> json) {
|
static List<Tag> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<Tag>();
|
return json == null ? new List<Tag>() : json.map((value) => new Tag.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new Tag.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, Tag> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, Tag> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
@ -4,27 +4,19 @@ class User {
|
|||||||
|
|
||||||
int id = null;
|
int id = null;
|
||||||
|
|
||||||
|
|
||||||
String username = null;
|
String username = null;
|
||||||
|
|
||||||
|
|
||||||
String firstName = null;
|
String firstName = null;
|
||||||
|
|
||||||
|
|
||||||
String lastName = null;
|
String lastName = null;
|
||||||
|
|
||||||
|
|
||||||
String email = null;
|
String email = null;
|
||||||
|
|
||||||
|
|
||||||
String password = null;
|
String password = null;
|
||||||
|
|
||||||
|
|
||||||
String phone = null;
|
String phone = null;
|
||||||
|
/* User Status */
|
||||||
/* User Status */
|
|
||||||
int userStatus = null;
|
int userStatus = null;
|
||||||
|
|
||||||
User();
|
User();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,22 +26,14 @@ class User {
|
|||||||
|
|
||||||
User.fromJson(Map<String, dynamic> json) {
|
User.fromJson(Map<String, dynamic> json) {
|
||||||
if (json == null) return;
|
if (json == null) return;
|
||||||
id =
|
id = json['id'];
|
||||||
json['id'];
|
username = json['username'];
|
||||||
username =
|
firstName = json['firstName'];
|
||||||
json['username'];
|
lastName = json['lastName'];
|
||||||
firstName =
|
email = json['email'];
|
||||||
json['firstName'];
|
password = json['password'];
|
||||||
lastName =
|
phone = json['phone'];
|
||||||
json['lastName'];
|
userStatus = json['userStatus'];
|
||||||
email =
|
|
||||||
json['email'];
|
|
||||||
password =
|
|
||||||
json['password'];
|
|
||||||
phone =
|
|
||||||
json['phone'];
|
|
||||||
userStatus =
|
|
||||||
json['userStatus'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -62,15 +46,11 @@ class User {
|
|||||||
'password': password,
|
'password': password,
|
||||||
'phone': phone,
|
'phone': phone,
|
||||||
'userStatus': userStatus
|
'userStatus': userStatus
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<User> listFromJson(List<Map<String, dynamic>> json) {
|
static List<User> listFromJson(List<dynamic> json) {
|
||||||
var list = new List<User>();
|
return json == null ? new List<User>() : json.map((value) => new User.fromJson(value)).toList();
|
||||||
if (json != null && json.length > 0) {
|
|
||||||
json.forEach((Map<String, dynamic> value) => list.add(new User.fromJson(value)));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, User> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
static Map<String, User> mapFromJson(Map<String, Map<String, dynamic>> json) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user