forked from loafle/openapi-generator-original
Don't create redundant samples (#3800)
- removed lines in dart2-petstore.sh that create redundant samples - deleted all dart2 samples - ran dart2-petstore.sh to create only openapi sample
This commit is contained in:
parent
b0549fe6da
commit
f25c6da856
@ -28,23 +28,6 @@ fi
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
|
||||||
# Generate non-browserClient
|
# Generate client
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true $@"
|
||||||
|
|
||||||
# then options to generate the library for vm would be:
|
|
||||||
#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@"
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
# Generate browserClient
|
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=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/dart2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=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.
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
analyzer:
|
|
||||||
strong-mode: true
|
|
@ -1,27 +0,0 @@
|
|||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.buildlog
|
|
||||||
.packages
|
|
||||||
.project
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
pubspec.lock
|
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
4.1.2-SNAPSHOT
|
|
@ -1,11 +0,0 @@
|
|||||||
# https://docs.travis-ci.com/user/languages/dart/
|
|
||||||
#
|
|
||||||
language: dart
|
|
||||||
dart:
|
|
||||||
# Install a specific stable release
|
|
||||||
- "2.2.0"
|
|
||||||
install:
|
|
||||||
- pub get
|
|
||||||
|
|
||||||
script:
|
|
||||||
- pub run test
|
|
@ -1,121 +0,0 @@
|
|||||||
# openapi
|
|
||||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
||||||
|
|
||||||
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
||||||
|
|
||||||
- API version: 1.0.0
|
|
||||||
- Build package: org.openapitools.codegen.languages.DartClientCodegen
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
Dart 1.20.0 or later OR Flutter 0.0.20 or later
|
|
||||||
|
|
||||||
## Installation & Usage
|
|
||||||
|
|
||||||
### Github
|
|
||||||
If this Dart package is published to Github, please include the following in pubspec.yaml
|
|
||||||
```
|
|
||||||
name: openapi
|
|
||||||
version: 1.0.0
|
|
||||||
description: OpenAPI API client
|
|
||||||
dependencies:
|
|
||||||
openapi:
|
|
||||||
git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
|
||||||
version: 'any'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Local
|
|
||||||
To use the package in your local drive, please include the following in pubspec.yaml
|
|
||||||
```
|
|
||||||
dependencies:
|
|
||||||
openapi:
|
|
||||||
path: /path/to/openapi
|
|
||||||
```
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.addPet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->addPet: $e\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*PetApi* | [**addPet**](docs//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
|
||||||
*PetApi* | [**deletePet**](docs//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
||||||
*PetApi* | [**findPetsByStatus**](docs//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
||||||
*PetApi* | [**findPetsByTags**](docs//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
||||||
*PetApi* | [**getPetById**](docs//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
|
||||||
*PetApi* | [**updatePet**](docs//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
|
||||||
*PetApi* | [**updatePetWithForm**](docs//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
||||||
*PetApi* | [**uploadFile**](docs//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
||||||
*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
*StoreApi* | [**getInventory**](docs//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
*StoreApi* | [**getOrderById**](docs//StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
*StoreApi* | [**placeOrder**](docs//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
|
||||||
*UserApi* | [**createUser**](docs//UserApi.md#createuser) | **POST** /user | Create user
|
|
||||||
*UserApi* | [**createUsersWithArrayInput**](docs//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
||||||
*UserApi* | [**createUsersWithListInput**](docs//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
||||||
*UserApi* | [**deleteUser**](docs//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
|
||||||
*UserApi* | [**getUserByName**](docs//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
|
||||||
*UserApi* | [**loginUser**](docs//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
|
||||||
*UserApi* | [**logoutUser**](docs//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
|
||||||
*UserApi* | [**updateUser**](docs//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Models
|
|
||||||
|
|
||||||
- [ApiResponse](docs//ApiResponse.md)
|
|
||||||
- [Category](docs//Category.md)
|
|
||||||
- [Order](docs//Order.md)
|
|
||||||
- [Pet](docs//Pet.md)
|
|
||||||
- [Tag](docs//Tag.md)
|
|
||||||
- [User](docs//User.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Authorization
|
|
||||||
|
|
||||||
|
|
||||||
## api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
## petstore_auth
|
|
||||||
|
|
||||||
- **Type**: OAuth
|
|
||||||
- **Flow**: implicit
|
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
- **Scopes**:
|
|
||||||
- **write:pets**: modify pets in your account
|
|
||||||
- **read:pets**: read your pets
|
|
||||||
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
# openapi.model.ApiResponse
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**code** | **int** | | [optional] [default to null]
|
|
||||||
**type** | **String** | | [optional] [default to null]
|
|
||||||
**message** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# openapi.model.Category
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
# openapi.model.Order
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**petId** | **int** | | [optional] [default to null]
|
|
||||||
**quantity** | **int** | | [optional] [default to null]
|
|
||||||
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
|
|
||||||
**status** | **String** | Order Status | [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)
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
# openapi.model.Pet
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**category** | [**Category**](Category.md) | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [default to null]
|
|
||||||
**photoUrls** | **List<String>** | | [default to []]
|
|
||||||
**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []]
|
|
||||||
**status** | **String** | pet status in the store | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,379 +0,0 @@
|
|||||||
# openapi.api.PetApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
|
||||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
||||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
||||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
||||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
|
||||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
|
||||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
||||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
||||||
|
|
||||||
|
|
||||||
# **addPet**
|
|
||||||
> addPet(body)
|
|
||||||
|
|
||||||
Add a new pet to the store
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.addPet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->addPet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **deletePet**
|
|
||||||
> deletePet(petId, apiKey)
|
|
||||||
|
|
||||||
Deletes a pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | Pet id to delete
|
|
||||||
var apiKey = apiKey_example; // String |
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deletePet(petId, apiKey);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->deletePet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| Pet id to delete | [default to null]
|
|
||||||
**apiKey** | **String**| | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **findPetsByStatus**
|
|
||||||
> List<Pet> findPetsByStatus(status)
|
|
||||||
|
|
||||||
Finds Pets by status
|
|
||||||
|
|
||||||
Multiple status values can be provided with comma separated strings
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var status = []; // List<String> | Status values that need to be considered for filter
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.findPetsByStatus(status);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->findPetsByStatus: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**List<Pet>**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **findPetsByTags**
|
|
||||||
> List<Pet> findPetsByTags(tags)
|
|
||||||
|
|
||||||
Finds Pets by tags
|
|
||||||
|
|
||||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var tags = []; // List<String> | Tags to filter by
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.findPetsByTags(tags);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->findPetsByTags: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**List<Pet>**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **getPetById**
|
|
||||||
> Pet getPetById(petId)
|
|
||||||
|
|
||||||
Find pet by ID
|
|
||||||
|
|
||||||
Returns a single pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure API key authorization: api_key
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet to return
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getPetById(petId);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->getPetById: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet to return | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Pet**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[api_key](../README.md#api_key)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **updatePet**
|
|
||||||
> updatePet(body)
|
|
||||||
|
|
||||||
Update an existing pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updatePet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->updatePet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **updatePetWithForm**
|
|
||||||
> updatePetWithForm(petId, name, status)
|
|
||||||
|
|
||||||
Updates a pet in the store with form data
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet that needs to be updated
|
|
||||||
var name = name_example; // String | Updated name of the pet
|
|
||||||
var status = status_example; // String | Updated status of the pet
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updatePetWithForm(petId, name, status);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->updatePetWithForm: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
|
||||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
|
||||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/x-www-form-urlencoded
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **uploadFile**
|
|
||||||
> ApiResponse uploadFile(petId, additionalMetadata, file)
|
|
||||||
|
|
||||||
uploads an image
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet to update
|
|
||||||
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
|
||||||
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.uploadFile(petId, additionalMetadata, file);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->uploadFile: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet to update | [default to null]
|
|
||||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
|
||||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**ApiResponse**](ApiResponse.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: multipart/form-data
|
|
||||||
- **Accept**: 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)
|
|
||||||
|
|
@ -1,186 +0,0 @@
|
|||||||
# openapi.api.StoreApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
|
||||||
|
|
||||||
|
|
||||||
# **deleteOrder**
|
|
||||||
> deleteOrder(orderId)
|
|
||||||
|
|
||||||
Delete purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var orderId = orderId_example; // String | ID of the order that needs to be deleted
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deleteOrder(orderId);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->deleteOrder: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **getInventory**
|
|
||||||
> Map<String, int> getInventory()
|
|
||||||
|
|
||||||
Returns pet inventories by status
|
|
||||||
|
|
||||||
Returns a map of status codes to quantities
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure API key authorization: api_key
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getInventory();
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->getInventory: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
This endpoint does not need any parameter.
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
**Map<String, int>**
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[api_key](../README.md#api_key)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: 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)
|
|
||||||
|
|
||||||
# **getOrderById**
|
|
||||||
> Order getOrderById(orderId)
|
|
||||||
|
|
||||||
Find purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var orderId = 789; // int | ID of pet that needs to be fetched
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getOrderById(orderId);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->getOrderById: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **placeOrder**
|
|
||||||
> Order placeOrder(body)
|
|
||||||
|
|
||||||
Place an order for a pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var body = Order(); // Order | order placed for purchasing the pet
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.placeOrder(body);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->placeOrder: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# openapi.model.Tag
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
# openapi.model.User
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**username** | **String** | | [optional] [default to null]
|
|
||||||
**firstName** | **String** | | [optional] [default to null]
|
|
||||||
**lastName** | **String** | | [optional] [default to null]
|
|
||||||
**email** | **String** | | [optional] [default to null]
|
|
||||||
**password** | **String** | | [optional] [default to null]
|
|
||||||
**phone** | **String** | | [optional] [default to null]
|
|
||||||
**userStatus** | **int** | User Status | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,349 +0,0 @@
|
|||||||
# openapi.api.UserApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
|
||||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
||||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
||||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
|
||||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
|
||||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
|
||||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
|
||||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
|
||||||
|
|
||||||
|
|
||||||
# **createUser**
|
|
||||||
> createUser(body)
|
|
||||||
|
|
||||||
Create user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = User(); // User | Created user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUser(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**User**](User.md)| Created user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **createUsersWithArrayInput**
|
|
||||||
> createUsersWithArrayInput(body)
|
|
||||||
|
|
||||||
Creates list of users with given input array
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUsersWithArrayInput(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**List<User>**](User.md)| List of user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **createUsersWithListInput**
|
|
||||||
> createUsersWithListInput(body)
|
|
||||||
|
|
||||||
Creates list of users with given input array
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUsersWithListInput(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**List<User>**](User.md)| List of user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **deleteUser**
|
|
||||||
> deleteUser(username)
|
|
||||||
|
|
||||||
Delete user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The name that needs to be deleted
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deleteUser(username);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->deleteUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **getUserByName**
|
|
||||||
> User getUserByName(username)
|
|
||||||
|
|
||||||
Get user by user name
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getUserByName(username);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->getUserByName: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**User**](User.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **loginUser**
|
|
||||||
> String loginUser(username, password)
|
|
||||||
|
|
||||||
Logs user into the system
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The user name for login
|
|
||||||
var password = password_example; // String | The password for login in clear text
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.loginUser(username, password);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->loginUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The user name for login | [default to null]
|
|
||||||
**password** | **String**| The password for login in clear text | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
**String**
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **logoutUser**
|
|
||||||
> logoutUser()
|
|
||||||
|
|
||||||
Logs out current logged in user session
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.logoutUser();
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->logoutUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
This endpoint does not need any parameter.
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **updateUser**
|
|
||||||
> updateUser(username, body)
|
|
||||||
|
|
||||||
Updated user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | name that need to be deleted
|
|
||||||
var body = User(); // User | Updated user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updateUser(username, body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->updateUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| name that need to be deleted | [default to null]
|
|
||||||
**body** | [**User**](User.md)| Updated user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=`git remote`
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
library openapi.api;
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:http/http.dart';
|
|
||||||
|
|
||||||
part 'api_client.dart';
|
|
||||||
part 'api_helper.dart';
|
|
||||||
part 'api_exception.dart';
|
|
||||||
part 'auth/authentication.dart';
|
|
||||||
part 'auth/api_key_auth.dart';
|
|
||||||
part 'auth/oauth.dart';
|
|
||||||
part 'auth/http_basic_auth.dart';
|
|
||||||
|
|
||||||
part 'api/pet_api.dart';
|
|
||||||
part 'api/store_api.dart';
|
|
||||||
part 'api/user_api.dart';
|
|
||||||
|
|
||||||
part 'model/api_response.dart';
|
|
||||||
part 'model/category.dart';
|
|
||||||
part 'model/order.dart';
|
|
||||||
part 'model/pet.dart';
|
|
||||||
part 'model/tag.dart';
|
|
||||||
part 'model/user.dart';
|
|
||||||
|
|
||||||
|
|
||||||
ApiClient defaultApiClient = ApiClient();
|
|
@ -1,432 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PetApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Add a new pet to the store
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future addPet(Pet body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Deletes a pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future deletePet(int petId, { String apiKey }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
headerParams["api_key"] = apiKey;
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Finds Pets by status
|
|
||||||
///
|
|
||||||
/// Multiple status values can be provided with comma separated strings
|
|
||||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(status == null) {
|
|
||||||
throw ApiException(400, "Missing required param: status");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByStatus".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Finds Pets by tags
|
|
||||||
///
|
|
||||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(tags == null) {
|
|
||||||
throw ApiException(400, "Missing required param: tags");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByTags".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Find pet by ID
|
|
||||||
///
|
|
||||||
/// Returns a single pet
|
|
||||||
Future<Pet> getPetById(int petId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["api_key"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Update an existing pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future updatePet(Pet body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'PUT',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Updates a pet in the store with form data
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future updatePetWithForm(int petId, { String name, String status }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if (name != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['name'] = parameterToString(name);
|
|
||||||
}
|
|
||||||
if (status != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['status'] = parameterToString(status);
|
|
||||||
}
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (name != null)
|
|
||||||
formParams['name'] = parameterToString(name);
|
|
||||||
if (status != null)
|
|
||||||
formParams['status'] = parameterToString(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// uploads an image
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["multipart/form-data"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if (additionalMetadata != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
|
|
||||||
}
|
|
||||||
if (file != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['file'] = file.field;
|
|
||||||
mp.files.add(file);
|
|
||||||
}
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (additionalMetadata != null)
|
|
||||||
formParams['additionalMetadata'] = parameterToString(additionalMetadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,207 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class StoreApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Delete purchase order by ID
|
|
||||||
///
|
|
||||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
Future deleteOrder(String orderId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Returns pet inventories by status
|
|
||||||
///
|
|
||||||
/// Returns a map of status codes to quantities
|
|
||||||
Future<Map<String, int>> getInventory() async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/inventory".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["api_key"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Find purchase order by ID
|
|
||||||
///
|
|
||||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
Future<Order> getOrderById(int orderId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Place an order for a pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<Order> placeOrder(Order body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,409 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Create user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future createUser(User body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Creates list of users with given input array
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future createUsersWithArrayInput(List<User> body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/createWithArray".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Creates list of users with given input array
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future createUsersWithListInput(List<User> body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/createWithList".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Delete user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future deleteUser(String username) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Get user by user name
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<User> getUserByName(String username) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Logs user into the system
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<String> loginUser(String username, String password) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
if(password == null) {
|
|
||||||
throw ApiException(400, "Missing required param: password");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/login".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "username", username));
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "password", password));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Logs out current logged in user session
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future logoutUser() async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/logout".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Updated user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future updateUser(String username, User body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'PUT',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class QueryParam {
|
|
||||||
String name;
|
|
||||||
String value;
|
|
||||||
|
|
||||||
QueryParam(this.name, this.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ApiClient {
|
|
||||||
|
|
||||||
String basePath;
|
|
||||||
var client = Client();
|
|
||||||
|
|
||||||
Map<String, String> _defaultHeaderMap = {};
|
|
||||||
Map<String, Authentication> _authentications = {};
|
|
||||||
|
|
||||||
final _regList = RegExp(r'^List<(.*)>$');
|
|
||||||
final _regMap = RegExp(r'^Map<String,(.*)>$');
|
|
||||||
|
|
||||||
ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) {
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
|
||||||
_authentications['api_key'] = ApiKeyAuth("header", "api_key");
|
|
||||||
_authentications['petstore_auth'] = OAuth();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addDefaultHeader(String key, String value) {
|
|
||||||
_defaultHeaderMap[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic _deserialize(dynamic value, String targetType) {
|
|
||||||
try {
|
|
||||||
switch (targetType) {
|
|
||||||
case 'String':
|
|
||||||
return '$value';
|
|
||||||
case 'int':
|
|
||||||
return value is int ? value : int.parse('$value');
|
|
||||||
case 'bool':
|
|
||||||
return value is bool ? value : '$value'.toLowerCase() == 'true';
|
|
||||||
case 'double':
|
|
||||||
return value is double ? value : double.parse('$value');
|
|
||||||
case 'ApiResponse':
|
|
||||||
return ApiResponse.fromJson(value);
|
|
||||||
case 'Category':
|
|
||||||
return Category.fromJson(value);
|
|
||||||
case 'Order':
|
|
||||||
return Order.fromJson(value);
|
|
||||||
case 'Pet':
|
|
||||||
return Pet.fromJson(value);
|
|
||||||
case 'Tag':
|
|
||||||
return Tag.fromJson(value);
|
|
||||||
case 'User':
|
|
||||||
return User.fromJson(value);
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Match match;
|
|
||||||
if (value is List &&
|
|
||||||
(match = _regList.firstMatch(targetType)) != null) {
|
|
||||||
var newTargetType = match[1];
|
|
||||||
return value.map((v) => _deserialize(v, newTargetType)).toList();
|
|
||||||
} else if (value is Map &&
|
|
||||||
(match = _regMap.firstMatch(targetType)) != null) {
|
|
||||||
var newTargetType = match[1];
|
|
||||||
return Map.fromIterables(value.keys,
|
|
||||||
value.values.map((v) => _deserialize(v, newTargetType)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} on Exception catch (e, stack) {
|
|
||||||
throw ApiException.withInner(500, 'Exception during deserialization.', e, stack);
|
|
||||||
}
|
|
||||||
throw ApiException(500, 'Could not find a suitable class for deserialization');
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic deserialize(String json, String targetType) {
|
|
||||||
// Remove all spaces. Necessary for reg expressions as well.
|
|
||||||
targetType = targetType.replaceAll(' ', '');
|
|
||||||
|
|
||||||
if (targetType == 'String') return json;
|
|
||||||
|
|
||||||
var decodedJson = jsonDecode(json);
|
|
||||||
return _deserialize(decodedJson, targetType);
|
|
||||||
}
|
|
||||||
|
|
||||||
String serialize(Object obj) {
|
|
||||||
String serialized = '';
|
|
||||||
if (obj == null) {
|
|
||||||
serialized = '';
|
|
||||||
} else {
|
|
||||||
serialized = json.encode(obj);
|
|
||||||
}
|
|
||||||
return serialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't use a Map<String, String> for queryParams.
|
|
||||||
// If collectionFormat is 'multi' a key might appear multiple times.
|
|
||||||
Future<Response> invokeAPI(String path,
|
|
||||||
String method,
|
|
||||||
Iterable<QueryParam> queryParams,
|
|
||||||
Object body,
|
|
||||||
Map<String, String> headerParams,
|
|
||||||
Map<String, String> formParams,
|
|
||||||
String contentType,
|
|
||||||
List<String> authNames) async {
|
|
||||||
|
|
||||||
_updateParamsForAuth(authNames, queryParams, headerParams);
|
|
||||||
|
|
||||||
var ps = queryParams
|
|
||||||
.where((p) => p.value != null)
|
|
||||||
.map((p) => '${p.name}=${Uri.encodeQueryComponent(p.value)}');
|
|
||||||
|
|
||||||
String queryString = ps.isNotEmpty ?
|
|
||||||
'?' + ps.join('&') :
|
|
||||||
'';
|
|
||||||
|
|
||||||
String url = basePath + path + queryString;
|
|
||||||
|
|
||||||
headerParams.addAll(_defaultHeaderMap);
|
|
||||||
headerParams['Content-Type'] = contentType;
|
|
||||||
|
|
||||||
if(body is MultipartRequest) {
|
|
||||||
var request = MultipartRequest(method, Uri.parse(url));
|
|
||||||
request.fields.addAll(body.fields);
|
|
||||||
request.files.addAll(body.files);
|
|
||||||
request.headers.addAll(body.headers);
|
|
||||||
request.headers.addAll(headerParams);
|
|
||||||
var response = await client.send(request);
|
|
||||||
return Response.fromStream(response);
|
|
||||||
} else {
|
|
||||||
var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body);
|
|
||||||
switch(method) {
|
|
||||||
case "POST":
|
|
||||||
return client.post(url, headers: headerParams, body: msgBody);
|
|
||||||
case "PUT":
|
|
||||||
return client.put(url, headers: headerParams, body: msgBody);
|
|
||||||
case "DELETE":
|
|
||||||
return client.delete(url, headers: headerParams);
|
|
||||||
case "PATCH":
|
|
||||||
return client.patch(url, headers: headerParams, body: msgBody);
|
|
||||||
default:
|
|
||||||
return client.get(url, headers: headerParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update query and header parameters based on authentication settings.
|
|
||||||
/// @param authNames The authentications to apply
|
|
||||||
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
authNames.forEach((authName) {
|
|
||||||
Authentication auth = _authentications[authName];
|
|
||||||
if (auth == null) throw ArgumentError("Authentication undefined: " + authName);
|
|
||||||
auth.applyToParams(queryParams, headerParams);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
T getAuthentication<T extends Authentication>(String name) {
|
|
||||||
var authentication = _authentications[name];
|
|
||||||
|
|
||||||
return authentication is T ? authentication : null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiException implements Exception {
|
|
||||||
int code = 0;
|
|
||||||
String message;
|
|
||||||
Exception innerException;
|
|
||||||
StackTrace stackTrace;
|
|
||||||
|
|
||||||
ApiException(this.code, this.message);
|
|
||||||
|
|
||||||
ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace);
|
|
||||||
|
|
||||||
String toString() {
|
|
||||||
if (message == null) return "ApiException";
|
|
||||||
|
|
||||||
if (innerException == null) {
|
|
||||||
return "ApiException $code: $message";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "ApiException $code: $message (Inner exception: $innerException)\n\n" +
|
|
||||||
stackTrace.toString();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
|
||||||
|
|
||||||
// port from Java version
|
|
||||||
Iterable<QueryParam> _convertParametersForCollectionFormat(
|
|
||||||
String collectionFormat, String name, dynamic value) {
|
|
||||||
var params = <QueryParam>[];
|
|
||||||
|
|
||||||
// preconditions
|
|
||||||
if (name == null || name.isEmpty || value == null) return params;
|
|
||||||
|
|
||||||
if (value is! List) {
|
|
||||||
params.add(QueryParam(name, parameterToString(value)));
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
List values = value as List;
|
|
||||||
|
|
||||||
// get the collection format
|
|
||||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
|
||||||
? "csv"
|
|
||||||
: collectionFormat; // default: csv
|
|
||||||
|
|
||||||
if (collectionFormat == "multi") {
|
|
||||||
return values.map((v) => QueryParam(name, parameterToString(v)));
|
|
||||||
}
|
|
||||||
|
|
||||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
|
||||||
|
|
||||||
params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format the given parameter object into string.
|
|
||||||
String parameterToString(dynamic value) {
|
|
||||||
if (value == null) {
|
|
||||||
return '';
|
|
||||||
} else if (value is DateTime) {
|
|
||||||
return value.toUtc().toIso8601String();
|
|
||||||
} else {
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the decoded body by utf-8 if application/json with the given headers.
|
|
||||||
/// Else, returns the decoded body by default algorithm of dart:http.
|
|
||||||
/// Because avoid to text garbling when header only contains "application/json" without "; charset=utf-8".
|
|
||||||
String _decodeBodyBytes(Response response) {
|
|
||||||
var contentType = response.headers['content-type'];
|
|
||||||
if (contentType != null && contentType.contains("application/json")) {
|
|
||||||
return utf8.decode(response.bodyBytes);
|
|
||||||
} else {
|
|
||||||
return response.body;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiKeyAuth implements Authentication {
|
|
||||||
|
|
||||||
final String location;
|
|
||||||
final String paramName;
|
|
||||||
String _apiKey;
|
|
||||||
String apiKeyPrefix;
|
|
||||||
|
|
||||||
set apiKey(String key) => _apiKey = key;
|
|
||||||
|
|
||||||
ApiKeyAuth(this.location, this.paramName);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
String value;
|
|
||||||
if (apiKeyPrefix != null) {
|
|
||||||
value = '$apiKeyPrefix $_apiKey';
|
|
||||||
} else {
|
|
||||||
value = _apiKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location == 'query' && value != null) {
|
|
||||||
queryParams.add(QueryParam(paramName, value));
|
|
||||||
} else if (location == 'header' && value != null) {
|
|
||||||
headerParams[paramName] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
abstract class Authentication {
|
|
||||||
|
|
||||||
/// Apply authentication settings to header and query params.
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class HttpBasicAuth implements Authentication {
|
|
||||||
|
|
||||||
String _username;
|
|
||||||
String _password;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password);
|
|
||||||
headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
set username(String username) => _username = username;
|
|
||||||
set password(String password) => _password = password;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
|
||||||
String _accessToken;
|
|
||||||
|
|
||||||
OAuth({String accessToken}) : _accessToken = accessToken;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
if (_accessToken != null) {
|
|
||||||
headerParams["Authorization"] = "Bearer $_accessToken";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set accessToken(String accessToken) => _accessToken = accessToken;
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiResponse {
|
|
||||||
|
|
||||||
int code = null;
|
|
||||||
|
|
||||||
String type = null;
|
|
||||||
|
|
||||||
String message = null;
|
|
||||||
ApiResponse();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ApiResponse[code=$code, type=$type, message=$message, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
code = json['code'];
|
|
||||||
type = json['type'];
|
|
||||||
message = json['message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (code != null)
|
|
||||||
json['code'] = code;
|
|
||||||
if (type != null)
|
|
||||||
json['type'] = type;
|
|
||||||
if (message != null)
|
|
||||||
json['message'] = message;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<ApiResponse> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<ApiResponse>() : json.map((value) => ApiResponse.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, ApiResponse>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<ApiResponse>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = ApiResponse.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Category {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
Category();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Category[id=$id, name=$name, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Category.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Category> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Category>() : json.map((value) => Category.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Category>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Category>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Category.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Order {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
int petId = null;
|
|
||||||
|
|
||||||
int quantity = null;
|
|
||||||
|
|
||||||
DateTime shipDate = null;
|
|
||||||
/* Order Status */
|
|
||||||
String status = null;
|
|
||||||
//enum statusEnum { placed, approved, delivered, };{
|
|
||||||
|
|
||||||
bool complete = false;
|
|
||||||
Order();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Order.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
petId = json['petId'];
|
|
||||||
quantity = json['quantity'];
|
|
||||||
shipDate = (json['shipDate'] == null) ?
|
|
||||||
null :
|
|
||||||
DateTime.parse(json['shipDate']);
|
|
||||||
status = json['status'];
|
|
||||||
complete = json['complete'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (petId != null)
|
|
||||||
json['petId'] = petId;
|
|
||||||
if (quantity != null)
|
|
||||||
json['quantity'] = quantity;
|
|
||||||
if (shipDate != null)
|
|
||||||
json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String();
|
|
||||||
if (status != null)
|
|
||||||
json['status'] = status;
|
|
||||||
if (complete != null)
|
|
||||||
json['complete'] = complete;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Order> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Order>() : json.map((value) => Order.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Order>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Order>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Order.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Pet {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
Category category = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
|
|
||||||
List<String> photoUrls = [];
|
|
||||||
|
|
||||||
List<Tag> tags = [];
|
|
||||||
/* pet status in the store */
|
|
||||||
String status = null;
|
|
||||||
//enum statusEnum { available, pending, sold, };{
|
|
||||||
Pet();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Pet.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
category = (json['category'] == null) ?
|
|
||||||
null :
|
|
||||||
Category.fromJson(json['category']);
|
|
||||||
name = json['name'];
|
|
||||||
photoUrls = (json['photoUrls'] == null) ?
|
|
||||||
null :
|
|
||||||
(json['photoUrls'] as List).cast<String>();
|
|
||||||
tags = (json['tags'] == null) ?
|
|
||||||
null :
|
|
||||||
Tag.listFromJson(json['tags']);
|
|
||||||
status = json['status'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (category != null)
|
|
||||||
json['category'] = category;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
if (photoUrls != null)
|
|
||||||
json['photoUrls'] = photoUrls;
|
|
||||||
if (tags != null)
|
|
||||||
json['tags'] = tags;
|
|
||||||
if (status != null)
|
|
||||||
json['status'] = status;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Pet> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Pet>() : json.map((value) => Pet.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Pet>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Pet>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Pet.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Tag {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
Tag();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Tag[id=$id, name=$name, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Tag.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Tag> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Tag>() : json.map((value) => Tag.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Tag>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Tag>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Tag.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class User {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String username = null;
|
|
||||||
|
|
||||||
String firstName = null;
|
|
||||||
|
|
||||||
String lastName = null;
|
|
||||||
|
|
||||||
String email = null;
|
|
||||||
|
|
||||||
String password = null;
|
|
||||||
|
|
||||||
String phone = null;
|
|
||||||
/* User Status */
|
|
||||||
int userStatus = null;
|
|
||||||
User();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
User.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
username = json['username'];
|
|
||||||
firstName = json['firstName'];
|
|
||||||
lastName = json['lastName'];
|
|
||||||
email = json['email'];
|
|
||||||
password = json['password'];
|
|
||||||
phone = json['phone'];
|
|
||||||
userStatus = json['userStatus'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (username != null)
|
|
||||||
json['username'] = username;
|
|
||||||
if (firstName != null)
|
|
||||||
json['firstName'] = firstName;
|
|
||||||
if (lastName != null)
|
|
||||||
json['lastName'] = lastName;
|
|
||||||
if (email != null)
|
|
||||||
json['email'] = email;
|
|
||||||
if (password != null)
|
|
||||||
json['password'] = password;
|
|
||||||
if (phone != null)
|
|
||||||
json['phone'] = phone;
|
|
||||||
if (userStatus != null)
|
|
||||||
json['userStatus'] = userStatus;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<User> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<User>() : json.map((value) => User.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, User>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<User>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = User.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
name: openapi
|
|
||||||
version: 1.0.0
|
|
||||||
description: OpenAPI API client
|
|
||||||
environment:
|
|
||||||
sdk: '>=2.0.0 <3.0.0'
|
|
||||||
dependencies:
|
|
||||||
http: '>=0.12.0 <0.13.0'
|
|
||||||
dev_dependencies:
|
|
||||||
test: ^1.3.0
|
|
@ -1,27 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for ApiResponse
|
|
||||||
void main() {
|
|
||||||
var instance = ApiResponse();
|
|
||||||
|
|
||||||
group('test ApiResponse', () {
|
|
||||||
// int code (default value: null)
|
|
||||||
test('to test the property `code`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String type (default value: null)
|
|
||||||
test('to test the property `type`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String message (default value: null)
|
|
||||||
test('to test the property `message`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Category
|
|
||||||
void main() {
|
|
||||||
var instance = Category();
|
|
||||||
|
|
||||||
group('test Category', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Order
|
|
||||||
void main() {
|
|
||||||
var instance = Order();
|
|
||||||
|
|
||||||
group('test Order', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// int petId (default value: null)
|
|
||||||
test('to test the property `petId`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// int quantity (default value: null)
|
|
||||||
test('to test the property `quantity`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// DateTime shipDate (default value: null)
|
|
||||||
test('to test the property `shipDate`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Order Status
|
|
||||||
// String status (default value: null)
|
|
||||||
test('to test the property `status`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// bool complete (default value: false)
|
|
||||||
test('to test the property `complete`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for PetApi
|
|
||||||
void main() {
|
|
||||||
var instance = PetApi();
|
|
||||||
|
|
||||||
group('tests for PetApi', () {
|
|
||||||
// Add a new pet to the store
|
|
||||||
//
|
|
||||||
//Future addPet(Pet body) async
|
|
||||||
test('test addPet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Deletes a pet
|
|
||||||
//
|
|
||||||
//Future deletePet(int petId, { String apiKey }) async
|
|
||||||
test('test deletePet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finds Pets by status
|
|
||||||
//
|
|
||||||
// Multiple status values can be provided with comma separated strings
|
|
||||||
//
|
|
||||||
//Future<List<Pet>> findPetsByStatus(List<String> status) async
|
|
||||||
test('test findPetsByStatus', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finds Pets by tags
|
|
||||||
//
|
|
||||||
// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
//
|
|
||||||
//Future<List<Pet>> findPetsByTags(List<String> tags) async
|
|
||||||
test('test findPetsByTags', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find pet by ID
|
|
||||||
//
|
|
||||||
// Returns a single pet
|
|
||||||
//
|
|
||||||
//Future<Pet> getPetById(int petId) async
|
|
||||||
test('test getPetById', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update an existing pet
|
|
||||||
//
|
|
||||||
//Future updatePet(Pet body) async
|
|
||||||
test('test updatePet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Updates a pet in the store with form data
|
|
||||||
//
|
|
||||||
//Future updatePetWithForm(int petId, { String name, String status }) async
|
|
||||||
test('test updatePetWithForm', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// uploads an image
|
|
||||||
//
|
|
||||||
//Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async
|
|
||||||
test('test uploadFile', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Pet
|
|
||||||
void main() {
|
|
||||||
var instance = Pet();
|
|
||||||
|
|
||||||
group('test Pet', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Category category (default value: null)
|
|
||||||
test('to test the property `category`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// List<String> photoUrls (default value: [])
|
|
||||||
test('to test the property `photoUrls`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// List<Tag> tags (default value: [])
|
|
||||||
test('to test the property `tags`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// pet status in the store
|
|
||||||
// String status (default value: null)
|
|
||||||
test('to test the property `status`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for StoreApi
|
|
||||||
void main() {
|
|
||||||
var instance = StoreApi();
|
|
||||||
|
|
||||||
group('tests for StoreApi', () {
|
|
||||||
// Delete purchase order by ID
|
|
||||||
//
|
|
||||||
// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
//
|
|
||||||
//Future deleteOrder(String orderId) async
|
|
||||||
test('test deleteOrder', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Returns pet inventories by status
|
|
||||||
//
|
|
||||||
// Returns a map of status codes to quantities
|
|
||||||
//
|
|
||||||
//Future<Map<String, int>> getInventory() async
|
|
||||||
test('test getInventory', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find purchase order by ID
|
|
||||||
//
|
|
||||||
// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
//
|
|
||||||
//Future<Order> getOrderById(int orderId) async
|
|
||||||
test('test getOrderById', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Place an order for a pet
|
|
||||||
//
|
|
||||||
//Future<Order> placeOrder(Order body) async
|
|
||||||
test('test placeOrder', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Tag
|
|
||||||
void main() {
|
|
||||||
var instance = Tag();
|
|
||||||
|
|
||||||
group('test Tag', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for UserApi
|
|
||||||
void main() {
|
|
||||||
var instance = UserApi();
|
|
||||||
|
|
||||||
group('tests for UserApi', () {
|
|
||||||
// Create user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future createUser(User body) async
|
|
||||||
test('test createUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Creates list of users with given input array
|
|
||||||
//
|
|
||||||
//Future createUsersWithArrayInput(List<User> body) async
|
|
||||||
test('test createUsersWithArrayInput', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Creates list of users with given input array
|
|
||||||
//
|
|
||||||
//Future createUsersWithListInput(List<User> body) async
|
|
||||||
test('test createUsersWithListInput', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future deleteUser(String username) async
|
|
||||||
test('test deleteUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get user by user name
|
|
||||||
//
|
|
||||||
//Future<User> getUserByName(String username) async
|
|
||||||
test('test getUserByName', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Logs user into the system
|
|
||||||
//
|
|
||||||
//Future<String> loginUser(String username, String password) async
|
|
||||||
test('test loginUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Logs out current logged in user session
|
|
||||||
//
|
|
||||||
//Future logoutUser() async
|
|
||||||
test('test logoutUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Updated user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future updateUser(String username, User body) async
|
|
||||||
test('test updateUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for User
|
|
||||||
void main() {
|
|
||||||
var instance = User();
|
|
||||||
|
|
||||||
group('test User', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String username (default value: null)
|
|
||||||
test('to test the property `username`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String firstName (default value: null)
|
|
||||||
test('to test the property `firstName`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String lastName (default value: null)
|
|
||||||
test('to test the property `lastName`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String email (default value: null)
|
|
||||||
test('to test the property `email`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String password (default value: null)
|
|
||||||
test('to test the property `password`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String phone (default value: null)
|
|
||||||
test('to test the property `phone`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// User Status
|
|
||||||
// int userStatus (default value: null)
|
|
||||||
test('to test the property `userStatus`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
analyzer:
|
|
||||||
strong-mode: true
|
|
@ -1,27 +0,0 @@
|
|||||||
# See https://www.dartlang.org/tools/private-files.html
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.buildlog
|
|
||||||
.packages
|
|
||||||
.project
|
|
||||||
.pub/
|
|
||||||
build/
|
|
||||||
**/packages/
|
|
||||||
|
|
||||||
# Files created by dart2js
|
|
||||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
|
||||||
# rules if you intend to use dart2js directly
|
|
||||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
|
||||||
# differentiate from explicit Javascript files)
|
|
||||||
*.dart.js
|
|
||||||
*.part.js
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
*.info.json
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
# Don't commit pubspec lock file
|
|
||||||
# (Library packages only! Remove pattern if developing an application package)
|
|
||||||
pubspec.lock
|
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
4.1.2-SNAPSHOT
|
|
@ -1,11 +0,0 @@
|
|||||||
# https://docs.travis-ci.com/user/languages/dart/
|
|
||||||
#
|
|
||||||
language: dart
|
|
||||||
dart:
|
|
||||||
# Install a specific stable release
|
|
||||||
- "2.2.0"
|
|
||||||
install:
|
|
||||||
- pub get
|
|
||||||
|
|
||||||
script:
|
|
||||||
- pub run test
|
|
@ -1,121 +0,0 @@
|
|||||||
# openapi
|
|
||||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
||||||
|
|
||||||
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
||||||
|
|
||||||
- API version: 1.0.0
|
|
||||||
- Build package: org.openapitools.codegen.languages.DartClientCodegen
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
Dart 1.20.0 or later OR Flutter 0.0.20 or later
|
|
||||||
|
|
||||||
## Installation & Usage
|
|
||||||
|
|
||||||
### Github
|
|
||||||
If this Dart package is published to Github, please include the following in pubspec.yaml
|
|
||||||
```
|
|
||||||
name: openapi
|
|
||||||
version: 1.0.0
|
|
||||||
description: OpenAPI API client
|
|
||||||
dependencies:
|
|
||||||
openapi:
|
|
||||||
git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
|
||||||
version: 'any'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Local
|
|
||||||
To use the package in your local drive, please include the following in pubspec.yaml
|
|
||||||
```
|
|
||||||
dependencies:
|
|
||||||
openapi:
|
|
||||||
path: /path/to/openapi
|
|
||||||
```
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.addPet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->addPet: $e\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*PetApi* | [**addPet**](docs//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
|
||||||
*PetApi* | [**deletePet**](docs//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
||||||
*PetApi* | [**findPetsByStatus**](docs//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
||||||
*PetApi* | [**findPetsByTags**](docs//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
||||||
*PetApi* | [**getPetById**](docs//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
|
||||||
*PetApi* | [**updatePet**](docs//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
|
||||||
*PetApi* | [**updatePetWithForm**](docs//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
||||||
*PetApi* | [**uploadFile**](docs//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
||||||
*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
*StoreApi* | [**getInventory**](docs//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
*StoreApi* | [**getOrderById**](docs//StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
*StoreApi* | [**placeOrder**](docs//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
|
||||||
*UserApi* | [**createUser**](docs//UserApi.md#createuser) | **POST** /user | Create user
|
|
||||||
*UserApi* | [**createUsersWithArrayInput**](docs//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
||||||
*UserApi* | [**createUsersWithListInput**](docs//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
||||||
*UserApi* | [**deleteUser**](docs//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
|
||||||
*UserApi* | [**getUserByName**](docs//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
|
||||||
*UserApi* | [**loginUser**](docs//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
|
||||||
*UserApi* | [**logoutUser**](docs//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
|
||||||
*UserApi* | [**updateUser**](docs//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Models
|
|
||||||
|
|
||||||
- [ApiResponse](docs//ApiResponse.md)
|
|
||||||
- [Category](docs//Category.md)
|
|
||||||
- [Order](docs//Order.md)
|
|
||||||
- [Pet](docs//Pet.md)
|
|
||||||
- [Tag](docs//Tag.md)
|
|
||||||
- [User](docs//User.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation For Authorization
|
|
||||||
|
|
||||||
|
|
||||||
## api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
## petstore_auth
|
|
||||||
|
|
||||||
- **Type**: OAuth
|
|
||||||
- **Flow**: implicit
|
|
||||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
|
||||||
- **Scopes**:
|
|
||||||
- **write:pets**: modify pets in your account
|
|
||||||
- **read:pets**: read your pets
|
|
||||||
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
# openapi.model.ApiResponse
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**code** | **int** | | [optional] [default to null]
|
|
||||||
**type** | **String** | | [optional] [default to null]
|
|
||||||
**message** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# openapi.model.Category
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
# openapi.model.Order
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**petId** | **int** | | [optional] [default to null]
|
|
||||||
**quantity** | **int** | | [optional] [default to null]
|
|
||||||
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
|
|
||||||
**status** | **String** | Order Status | [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)
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
# openapi.model.Pet
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**category** | [**Category**](Category.md) | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [default to null]
|
|
||||||
**photoUrls** | **List<String>** | | [default to []]
|
|
||||||
**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []]
|
|
||||||
**status** | **String** | pet status in the store | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,379 +0,0 @@
|
|||||||
# openapi.api.PetApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
|
||||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
||||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
||||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
||||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
|
||||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
|
||||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
||||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
||||||
|
|
||||||
|
|
||||||
# **addPet**
|
|
||||||
> addPet(body)
|
|
||||||
|
|
||||||
Add a new pet to the store
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.addPet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->addPet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **deletePet**
|
|
||||||
> deletePet(petId, apiKey)
|
|
||||||
|
|
||||||
Deletes a pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | Pet id to delete
|
|
||||||
var apiKey = apiKey_example; // String |
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deletePet(petId, apiKey);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->deletePet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| Pet id to delete | [default to null]
|
|
||||||
**apiKey** | **String**| | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **findPetsByStatus**
|
|
||||||
> List<Pet> findPetsByStatus(status)
|
|
||||||
|
|
||||||
Finds Pets by status
|
|
||||||
|
|
||||||
Multiple status values can be provided with comma separated strings
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var status = []; // List<String> | Status values that need to be considered for filter
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.findPetsByStatus(status);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->findPetsByStatus: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**List<Pet>**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **findPetsByTags**
|
|
||||||
> List<Pet> findPetsByTags(tags)
|
|
||||||
|
|
||||||
Finds Pets by tags
|
|
||||||
|
|
||||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var tags = []; // List<String> | Tags to filter by
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.findPetsByTags(tags);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->findPetsByTags: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**tags** | [**List<String>**](String.md)| Tags to filter by | [default to []]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**List<Pet>**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **getPetById**
|
|
||||||
> Pet getPetById(petId)
|
|
||||||
|
|
||||||
Find pet by ID
|
|
||||||
|
|
||||||
Returns a single pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure API key authorization: api_key
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet to return
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getPetById(petId);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->getPetById: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet to return | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Pet**](Pet.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[api_key](../README.md#api_key)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **updatePet**
|
|
||||||
> updatePet(body)
|
|
||||||
|
|
||||||
Update an existing pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updatePet(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->updatePet: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **updatePetWithForm**
|
|
||||||
> updatePetWithForm(petId, name, status)
|
|
||||||
|
|
||||||
Updates a pet in the store with form data
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet that needs to be updated
|
|
||||||
var name = name_example; // String | Updated name of the pet
|
|
||||||
var status = status_example; // String | Updated status of the pet
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updatePetWithForm(petId, name, status);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->updatePetWithForm: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet that needs to be updated | [default to null]
|
|
||||||
**name** | **String**| Updated name of the pet | [optional] [default to null]
|
|
||||||
**status** | **String**| Updated status of the pet | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/x-www-form-urlencoded
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **uploadFile**
|
|
||||||
> ApiResponse uploadFile(petId, additionalMetadata, file)
|
|
||||||
|
|
||||||
uploads an image
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
|
||||||
|
|
||||||
var api_instance = PetApi();
|
|
||||||
var petId = 789; // int | ID of pet to update
|
|
||||||
var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
|
||||||
var file = BINARY_DATA_HERE; // MultipartFile | file to upload
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.uploadFile(petId, additionalMetadata, file);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling PetApi->uploadFile: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**petId** | **int**| ID of pet to update | [default to null]
|
|
||||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
|
||||||
**file** | **MultipartFile**| file to upload | [optional] [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**ApiResponse**](ApiResponse.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[petstore_auth](../README.md#petstore_auth)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: multipart/form-data
|
|
||||||
- **Accept**: 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)
|
|
||||||
|
|
@ -1,186 +0,0 @@
|
|||||||
# openapi.api.StoreApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
|
||||||
|
|
||||||
|
|
||||||
# **deleteOrder**
|
|
||||||
> deleteOrder(orderId)
|
|
||||||
|
|
||||||
Delete purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var orderId = orderId_example; // String | ID of the order that needs to be deleted
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deleteOrder(orderId);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->deleteOrder: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**orderId** | **String**| ID of the order that needs to be deleted | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **getInventory**
|
|
||||||
> Map<String, int> getInventory()
|
|
||||||
|
|
||||||
Returns pet inventories by status
|
|
||||||
|
|
||||||
Returns a map of status codes to quantities
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
// TODO Configure API key authorization: api_key
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
|
|
||||||
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
||||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getInventory();
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->getInventory: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
This endpoint does not need any parameter.
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
**Map<String, int>**
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[api_key](../README.md#api_key)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: 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)
|
|
||||||
|
|
||||||
# **getOrderById**
|
|
||||||
> Order getOrderById(orderId)
|
|
||||||
|
|
||||||
Find purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var orderId = 789; // int | ID of pet that needs to be fetched
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getOrderById(orderId);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->getOrderById: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**orderId** | **int**| ID of pet that needs to be fetched | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **placeOrder**
|
|
||||||
> Order placeOrder(body)
|
|
||||||
|
|
||||||
Place an order for a pet
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = StoreApi();
|
|
||||||
var body = Order(); // Order | order placed for purchasing the pet
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.placeOrder(body);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling StoreApi->placeOrder: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# openapi.model.Tag
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**name** | **String** | | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
# openapi.model.User
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional] [default to null]
|
|
||||||
**username** | **String** | | [optional] [default to null]
|
|
||||||
**firstName** | **String** | | [optional] [default to null]
|
|
||||||
**lastName** | **String** | | [optional] [default to null]
|
|
||||||
**email** | **String** | | [optional] [default to null]
|
|
||||||
**password** | **String** | | [optional] [default to null]
|
|
||||||
**phone** | **String** | | [optional] [default to null]
|
|
||||||
**userStatus** | **int** | User Status | [optional] [default to null]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,349 +0,0 @@
|
|||||||
# openapi.api.UserApi
|
|
||||||
|
|
||||||
## Load the API package
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
```
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
|
||||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
||||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
||||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
|
||||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
|
||||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
|
||||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
|
||||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
|
||||||
|
|
||||||
|
|
||||||
# **createUser**
|
|
||||||
> createUser(body)
|
|
||||||
|
|
||||||
Create user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = User(); // User | Created user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUser(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**User**](User.md)| Created user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **createUsersWithArrayInput**
|
|
||||||
> createUsersWithArrayInput(body)
|
|
||||||
|
|
||||||
Creates list of users with given input array
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUsersWithArrayInput(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**List<User>**](User.md)| List of user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **createUsersWithListInput**
|
|
||||||
> createUsersWithListInput(body)
|
|
||||||
|
|
||||||
Creates list of users with given input array
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var body = [List<User>()]; // List<User> | List of user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.createUsersWithListInput(body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**body** | [**List<User>**](User.md)| List of user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **deleteUser**
|
|
||||||
> deleteUser(username)
|
|
||||||
|
|
||||||
Delete user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The name that needs to be deleted
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.deleteUser(username);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->deleteUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The name that needs to be deleted | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **getUserByName**
|
|
||||||
> User getUserByName(username)
|
|
||||||
|
|
||||||
Get user by user name
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.getUserByName(username);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->getUserByName: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**User**](User.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **loginUser**
|
|
||||||
> String loginUser(username, password)
|
|
||||||
|
|
||||||
Logs user into the system
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | The user name for login
|
|
||||||
var password = password_example; // String | The password for login in clear text
|
|
||||||
|
|
||||||
try {
|
|
||||||
var result = api_instance.loginUser(username, password);
|
|
||||||
print(result);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->loginUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| The user name for login | [default to null]
|
|
||||||
**password** | **String**| The password for login in clear text | [default to null]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
**String**
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **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)
|
|
||||||
|
|
||||||
# **logoutUser**
|
|
||||||
> logoutUser()
|
|
||||||
|
|
||||||
Logs out current logged in user session
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.logoutUser();
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->logoutUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
This endpoint does not need any parameter.
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
||||||
# **updateUser**
|
|
||||||
> updateUser(username, body)
|
|
||||||
|
|
||||||
Updated user
|
|
||||||
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```dart
|
|
||||||
import 'package:openapi/api.dart';
|
|
||||||
|
|
||||||
var api_instance = UserApi();
|
|
||||||
var username = username_example; // String | name that need to be deleted
|
|
||||||
var body = User(); // User | Updated user object
|
|
||||||
|
|
||||||
try {
|
|
||||||
api_instance.updateUser(username, body);
|
|
||||||
} catch (e) {
|
|
||||||
print("Exception when calling UserApi->updateUser: $e\n");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**username** | **String**| name that need to be deleted | [default to null]
|
|
||||||
**body** | [**User**](User.md)| Updated user object |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
void (empty response body)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: 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)
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=`git remote`
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
library openapi.api;
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:http/http.dart';
|
|
||||||
|
|
||||||
part 'api_client.dart';
|
|
||||||
part 'api_helper.dart';
|
|
||||||
part 'api_exception.dart';
|
|
||||||
part 'auth/authentication.dart';
|
|
||||||
part 'auth/api_key_auth.dart';
|
|
||||||
part 'auth/oauth.dart';
|
|
||||||
part 'auth/http_basic_auth.dart';
|
|
||||||
|
|
||||||
part 'api/pet_api.dart';
|
|
||||||
part 'api/store_api.dart';
|
|
||||||
part 'api/user_api.dart';
|
|
||||||
|
|
||||||
part 'model/api_response.dart';
|
|
||||||
part 'model/category.dart';
|
|
||||||
part 'model/order.dart';
|
|
||||||
part 'model/pet.dart';
|
|
||||||
part 'model/tag.dart';
|
|
||||||
part 'model/user.dart';
|
|
||||||
|
|
||||||
|
|
||||||
ApiClient defaultApiClient = ApiClient();
|
|
@ -1,432 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PetApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Add a new pet to the store
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future addPet(Pet body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Deletes a pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future deletePet(int petId, { String apiKey }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
headerParams["api_key"] = apiKey;
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Finds Pets by status
|
|
||||||
///
|
|
||||||
/// Multiple status values can be provided with comma separated strings
|
|
||||||
Future<List<Pet>> findPetsByStatus(List<String> status) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(status == null) {
|
|
||||||
throw ApiException(400, "Missing required param: status");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByStatus".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Finds Pets by tags
|
|
||||||
///
|
|
||||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
Future<List<Pet>> findPetsByTags(List<String> tags) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(tags == null) {
|
|
||||||
throw ApiException(400, "Missing required param: tags");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/findByTags".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return (apiClient.deserialize(_decodeBodyBytes(response), 'List<Pet>') as List).map((item) => item as Pet).toList();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Find pet by ID
|
|
||||||
///
|
|
||||||
/// Returns a single pet
|
|
||||||
Future<Pet> getPetById(int petId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["api_key"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Update an existing pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future updatePet(Pet body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/json","application/xml"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'PUT',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Updates a pet in the store with form data
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future updatePetWithForm(int petId, { String name, String status }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if (name != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['name'] = parameterToString(name);
|
|
||||||
}
|
|
||||||
if (status != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['status'] = parameterToString(status);
|
|
||||||
}
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (name != null)
|
|
||||||
formParams['name'] = parameterToString(name);
|
|
||||||
if (status != null)
|
|
||||||
formParams['status'] = parameterToString(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// uploads an image
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(petId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: petId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = ["multipart/form-data"];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["petstore_auth"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if (additionalMetadata != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['additionalMetadata'] = parameterToString(additionalMetadata);
|
|
||||||
}
|
|
||||||
if (file != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.fields['file'] = file.field;
|
|
||||||
mp.files.add(file);
|
|
||||||
}
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (additionalMetadata != null)
|
|
||||||
formParams['additionalMetadata'] = parameterToString(additionalMetadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,207 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class StoreApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Delete purchase order by ID
|
|
||||||
///
|
|
||||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
Future deleteOrder(String orderId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Returns pet inventories by status
|
|
||||||
///
|
|
||||||
/// Returns a map of status codes to quantities
|
|
||||||
Future<Map<String, int>> getInventory() async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/inventory".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = ["api_key"];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return Map<String, int>.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map<String, int>'));
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Find purchase order by ID
|
|
||||||
///
|
|
||||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
Future<Order> getOrderById(int orderId) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(orderId == null) {
|
|
||||||
throw ApiException(400, "Missing required param: orderId");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Place an order for a pet
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<Order> placeOrder(Order body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/store/order".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,409 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserApi {
|
|
||||||
final ApiClient apiClient;
|
|
||||||
|
|
||||||
UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
||||||
|
|
||||||
/// Create user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future createUser(User body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Creates list of users with given input array
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future createUsersWithArrayInput(List<User> body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/createWithArray".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Creates list of users with given input array
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future createUsersWithListInput(List<User> body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/createWithList".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'POST',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Delete user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future deleteUser(String username) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'DELETE',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Get user by user name
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<User> getUserByName(String username) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Logs user into the system
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future<String> loginUser(String username, String password) async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
if(password == null) {
|
|
||||||
throw ApiException(400, "Missing required param: password");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/login".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "username", username));
|
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat("", "password", password));
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Logs out current logged in user session
|
|
||||||
///
|
|
||||||
///
|
|
||||||
Future logoutUser() async {
|
|
||||||
Object postBody;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/logout".replaceAll("{format}","json");
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'GET',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Updated user
|
|
||||||
///
|
|
||||||
/// This can only be done by the logged in user.
|
|
||||||
Future updateUser(String username, User body) async {
|
|
||||||
Object postBody = body;
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
if(username == null) {
|
|
||||||
throw ApiException(400, "Missing required param: username");
|
|
||||||
}
|
|
||||||
if(body == null) {
|
|
||||||
throw ApiException(400, "Missing required param: body");
|
|
||||||
}
|
|
||||||
|
|
||||||
// create path and map variables
|
|
||||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
|
||||||
|
|
||||||
// query params
|
|
||||||
List<QueryParam> queryParams = [];
|
|
||||||
Map<String, String> headerParams = {};
|
|
||||||
Map<String, String> formParams = {};
|
|
||||||
|
|
||||||
List<String> contentTypes = [];
|
|
||||||
|
|
||||||
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
|
|
||||||
List<String> authNames = [];
|
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
bool hasFields = false;
|
|
||||||
MultipartRequest mp = MultipartRequest(null, null);
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await apiClient.invokeAPI(path,
|
|
||||||
'PUT',
|
|
||||||
queryParams,
|
|
||||||
postBody,
|
|
||||||
headerParams,
|
|
||||||
formParams,
|
|
||||||
contentType,
|
|
||||||
authNames);
|
|
||||||
|
|
||||||
if(response.statusCode >= 400) {
|
|
||||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
|
||||||
} else if(response.body != null) {
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class QueryParam {
|
|
||||||
String name;
|
|
||||||
String value;
|
|
||||||
|
|
||||||
QueryParam(this.name, this.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ApiClient {
|
|
||||||
|
|
||||||
String basePath;
|
|
||||||
var client = Client();
|
|
||||||
|
|
||||||
Map<String, String> _defaultHeaderMap = {};
|
|
||||||
Map<String, Authentication> _authentications = {};
|
|
||||||
|
|
||||||
final _regList = RegExp(r'^List<(.*)>$');
|
|
||||||
final _regMap = RegExp(r'^Map<String,(.*)>$');
|
|
||||||
|
|
||||||
ApiClient({this.basePath = "http://petstore.swagger.io/v2"}) {
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
|
||||||
_authentications['api_key'] = ApiKeyAuth("header", "api_key");
|
|
||||||
_authentications['petstore_auth'] = OAuth();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addDefaultHeader(String key, String value) {
|
|
||||||
_defaultHeaderMap[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic _deserialize(dynamic value, String targetType) {
|
|
||||||
try {
|
|
||||||
switch (targetType) {
|
|
||||||
case 'String':
|
|
||||||
return '$value';
|
|
||||||
case 'int':
|
|
||||||
return value is int ? value : int.parse('$value');
|
|
||||||
case 'bool':
|
|
||||||
return value is bool ? value : '$value'.toLowerCase() == 'true';
|
|
||||||
case 'double':
|
|
||||||
return value is double ? value : double.parse('$value');
|
|
||||||
case 'ApiResponse':
|
|
||||||
return ApiResponse.fromJson(value);
|
|
||||||
case 'Category':
|
|
||||||
return Category.fromJson(value);
|
|
||||||
case 'Order':
|
|
||||||
return Order.fromJson(value);
|
|
||||||
case 'Pet':
|
|
||||||
return Pet.fromJson(value);
|
|
||||||
case 'Tag':
|
|
||||||
return Tag.fromJson(value);
|
|
||||||
case 'User':
|
|
||||||
return User.fromJson(value);
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Match match;
|
|
||||||
if (value is List &&
|
|
||||||
(match = _regList.firstMatch(targetType)) != null) {
|
|
||||||
var newTargetType = match[1];
|
|
||||||
return value.map((v) => _deserialize(v, newTargetType)).toList();
|
|
||||||
} else if (value is Map &&
|
|
||||||
(match = _regMap.firstMatch(targetType)) != null) {
|
|
||||||
var newTargetType = match[1];
|
|
||||||
return Map.fromIterables(value.keys,
|
|
||||||
value.values.map((v) => _deserialize(v, newTargetType)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} on Exception catch (e, stack) {
|
|
||||||
throw ApiException.withInner(500, 'Exception during deserialization.', e, stack);
|
|
||||||
}
|
|
||||||
throw ApiException(500, 'Could not find a suitable class for deserialization');
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic deserialize(String json, String targetType) {
|
|
||||||
// Remove all spaces. Necessary for reg expressions as well.
|
|
||||||
targetType = targetType.replaceAll(' ', '');
|
|
||||||
|
|
||||||
if (targetType == 'String') return json;
|
|
||||||
|
|
||||||
var decodedJson = jsonDecode(json);
|
|
||||||
return _deserialize(decodedJson, targetType);
|
|
||||||
}
|
|
||||||
|
|
||||||
String serialize(Object obj) {
|
|
||||||
String serialized = '';
|
|
||||||
if (obj == null) {
|
|
||||||
serialized = '';
|
|
||||||
} else {
|
|
||||||
serialized = json.encode(obj);
|
|
||||||
}
|
|
||||||
return serialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't use a Map<String, String> for queryParams.
|
|
||||||
// If collectionFormat is 'multi' a key might appear multiple times.
|
|
||||||
Future<Response> invokeAPI(String path,
|
|
||||||
String method,
|
|
||||||
Iterable<QueryParam> queryParams,
|
|
||||||
Object body,
|
|
||||||
Map<String, String> headerParams,
|
|
||||||
Map<String, String> formParams,
|
|
||||||
String contentType,
|
|
||||||
List<String> authNames) async {
|
|
||||||
|
|
||||||
_updateParamsForAuth(authNames, queryParams, headerParams);
|
|
||||||
|
|
||||||
var ps = queryParams
|
|
||||||
.where((p) => p.value != null)
|
|
||||||
.map((p) => '${p.name}=${Uri.encodeQueryComponent(p.value)}');
|
|
||||||
|
|
||||||
String queryString = ps.isNotEmpty ?
|
|
||||||
'?' + ps.join('&') :
|
|
||||||
'';
|
|
||||||
|
|
||||||
String url = basePath + path + queryString;
|
|
||||||
|
|
||||||
headerParams.addAll(_defaultHeaderMap);
|
|
||||||
headerParams['Content-Type'] = contentType;
|
|
||||||
|
|
||||||
if(body is MultipartRequest) {
|
|
||||||
var request = MultipartRequest(method, Uri.parse(url));
|
|
||||||
request.fields.addAll(body.fields);
|
|
||||||
request.files.addAll(body.files);
|
|
||||||
request.headers.addAll(body.headers);
|
|
||||||
request.headers.addAll(headerParams);
|
|
||||||
var response = await client.send(request);
|
|
||||||
return Response.fromStream(response);
|
|
||||||
} else {
|
|
||||||
var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body);
|
|
||||||
switch(method) {
|
|
||||||
case "POST":
|
|
||||||
return client.post(url, headers: headerParams, body: msgBody);
|
|
||||||
case "PUT":
|
|
||||||
return client.put(url, headers: headerParams, body: msgBody);
|
|
||||||
case "DELETE":
|
|
||||||
return client.delete(url, headers: headerParams);
|
|
||||||
case "PATCH":
|
|
||||||
return client.patch(url, headers: headerParams, body: msgBody);
|
|
||||||
default:
|
|
||||||
return client.get(url, headers: headerParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update query and header parameters based on authentication settings.
|
|
||||||
/// @param authNames The authentications to apply
|
|
||||||
void _updateParamsForAuth(List<String> authNames, List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
authNames.forEach((authName) {
|
|
||||||
Authentication auth = _authentications[authName];
|
|
||||||
if (auth == null) throw ArgumentError("Authentication undefined: " + authName);
|
|
||||||
auth.applyToParams(queryParams, headerParams);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
T getAuthentication<T extends Authentication>(String name) {
|
|
||||||
var authentication = _authentications[name];
|
|
||||||
|
|
||||||
return authentication is T ? authentication : null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiException implements Exception {
|
|
||||||
int code = 0;
|
|
||||||
String message;
|
|
||||||
Exception innerException;
|
|
||||||
StackTrace stackTrace;
|
|
||||||
|
|
||||||
ApiException(this.code, this.message);
|
|
||||||
|
|
||||||
ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace);
|
|
||||||
|
|
||||||
String toString() {
|
|
||||||
if (message == null) return "ApiException";
|
|
||||||
|
|
||||||
if (innerException == null) {
|
|
||||||
return "ApiException $code: $message";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "ApiException $code: $message (Inner exception: $innerException)\n\n" +
|
|
||||||
stackTrace.toString();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
|
||||||
|
|
||||||
// port from Java version
|
|
||||||
Iterable<QueryParam> _convertParametersForCollectionFormat(
|
|
||||||
String collectionFormat, String name, dynamic value) {
|
|
||||||
var params = <QueryParam>[];
|
|
||||||
|
|
||||||
// preconditions
|
|
||||||
if (name == null || name.isEmpty || value == null) return params;
|
|
||||||
|
|
||||||
if (value is! List) {
|
|
||||||
params.add(QueryParam(name, parameterToString(value)));
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
List values = value as List;
|
|
||||||
|
|
||||||
// get the collection format
|
|
||||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
|
||||||
? "csv"
|
|
||||||
: collectionFormat; // default: csv
|
|
||||||
|
|
||||||
if (collectionFormat == "multi") {
|
|
||||||
return values.map((v) => QueryParam(name, parameterToString(v)));
|
|
||||||
}
|
|
||||||
|
|
||||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
|
||||||
|
|
||||||
params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter)));
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Format the given parameter object into string.
|
|
||||||
String parameterToString(dynamic value) {
|
|
||||||
if (value == null) {
|
|
||||||
return '';
|
|
||||||
} else if (value is DateTime) {
|
|
||||||
return value.toUtc().toIso8601String();
|
|
||||||
} else {
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the decoded body by utf-8 if application/json with the given headers.
|
|
||||||
/// Else, returns the decoded body by default algorithm of dart:http.
|
|
||||||
/// Because avoid to text garbling when header only contains "application/json" without "; charset=utf-8".
|
|
||||||
String _decodeBodyBytes(Response response) {
|
|
||||||
var contentType = response.headers['content-type'];
|
|
||||||
if (contentType != null && contentType.contains("application/json")) {
|
|
||||||
return utf8.decode(response.bodyBytes);
|
|
||||||
} else {
|
|
||||||
return response.body;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiKeyAuth implements Authentication {
|
|
||||||
|
|
||||||
final String location;
|
|
||||||
final String paramName;
|
|
||||||
String _apiKey;
|
|
||||||
String apiKeyPrefix;
|
|
||||||
|
|
||||||
set apiKey(String key) => _apiKey = key;
|
|
||||||
|
|
||||||
ApiKeyAuth(this.location, this.paramName);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
String value;
|
|
||||||
if (apiKeyPrefix != null) {
|
|
||||||
value = '$apiKeyPrefix $_apiKey';
|
|
||||||
} else {
|
|
||||||
value = _apiKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location == 'query' && value != null) {
|
|
||||||
queryParams.add(QueryParam(paramName, value));
|
|
||||||
} else if (location == 'header' && value != null) {
|
|
||||||
headerParams[paramName] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
abstract class Authentication {
|
|
||||||
|
|
||||||
/// Apply authentication settings to header and query params.
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams);
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class HttpBasicAuth implements Authentication {
|
|
||||||
|
|
||||||
String _username;
|
|
||||||
String _password;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
String str = (_username == null ? "" : _username) + ":" + (_password == null ? "" : _password);
|
|
||||||
headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
set username(String username) => _username = username;
|
|
||||||
set password(String password) => _password = password;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class OAuth implements Authentication {
|
|
||||||
String _accessToken;
|
|
||||||
|
|
||||||
OAuth({String accessToken}) : _accessToken = accessToken;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) {
|
|
||||||
if (_accessToken != null) {
|
|
||||||
headerParams["Authorization"] = "Bearer $_accessToken";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set accessToken(String accessToken) => _accessToken = accessToken;
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class ApiResponse {
|
|
||||||
|
|
||||||
int code = null;
|
|
||||||
|
|
||||||
String type = null;
|
|
||||||
|
|
||||||
String message = null;
|
|
||||||
ApiResponse();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ApiResponse[code=$code, type=$type, message=$message, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
code = json['code'];
|
|
||||||
type = json['type'];
|
|
||||||
message = json['message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (code != null)
|
|
||||||
json['code'] = code;
|
|
||||||
if (type != null)
|
|
||||||
json['type'] = type;
|
|
||||||
if (message != null)
|
|
||||||
json['message'] = message;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<ApiResponse> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<ApiResponse>() : json.map((value) => ApiResponse.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, ApiResponse>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<ApiResponse>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = ApiResponse.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Category {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
Category();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Category[id=$id, name=$name, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Category.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Category> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Category>() : json.map((value) => Category.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Category>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Category>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Category.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Order {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
int petId = null;
|
|
||||||
|
|
||||||
int quantity = null;
|
|
||||||
|
|
||||||
DateTime shipDate = null;
|
|
||||||
/* Order Status */
|
|
||||||
String status = null;
|
|
||||||
//enum statusEnum { placed, approved, delivered, };{
|
|
||||||
|
|
||||||
bool complete = false;
|
|
||||||
Order();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Order.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
petId = json['petId'];
|
|
||||||
quantity = json['quantity'];
|
|
||||||
shipDate = (json['shipDate'] == null) ?
|
|
||||||
null :
|
|
||||||
DateTime.parse(json['shipDate']);
|
|
||||||
status = json['status'];
|
|
||||||
complete = json['complete'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (petId != null)
|
|
||||||
json['petId'] = petId;
|
|
||||||
if (quantity != null)
|
|
||||||
json['quantity'] = quantity;
|
|
||||||
if (shipDate != null)
|
|
||||||
json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String();
|
|
||||||
if (status != null)
|
|
||||||
json['status'] = status;
|
|
||||||
if (complete != null)
|
|
||||||
json['complete'] = complete;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Order> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Order>() : json.map((value) => Order.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Order>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Order>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Order.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Pet {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
Category category = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
|
|
||||||
List<String> photoUrls = [];
|
|
||||||
|
|
||||||
List<Tag> tags = [];
|
|
||||||
/* pet status in the store */
|
|
||||||
String status = null;
|
|
||||||
//enum statusEnum { available, pending, sold, };{
|
|
||||||
Pet();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Pet.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
category = (json['category'] == null) ?
|
|
||||||
null :
|
|
||||||
Category.fromJson(json['category']);
|
|
||||||
name = json['name'];
|
|
||||||
photoUrls = (json['photoUrls'] == null) ?
|
|
||||||
null :
|
|
||||||
(json['photoUrls'] as List).cast<String>();
|
|
||||||
tags = (json['tags'] == null) ?
|
|
||||||
null :
|
|
||||||
Tag.listFromJson(json['tags']);
|
|
||||||
status = json['status'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (category != null)
|
|
||||||
json['category'] = category;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
if (photoUrls != null)
|
|
||||||
json['photoUrls'] = photoUrls;
|
|
||||||
if (tags != null)
|
|
||||||
json['tags'] = tags;
|
|
||||||
if (status != null)
|
|
||||||
json['status'] = status;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Pet> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Pet>() : json.map((value) => Pet.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Pet>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Pet>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Pet.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class Tag {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
Tag();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Tag[id=$id, name=$name, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
Tag.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (name != null)
|
|
||||||
json['name'] = name;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<Tag> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<Tag>() : json.map((value) => Tag.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, Tag>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<Tag>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = Tag.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
|||||||
part of openapi.api;
|
|
||||||
|
|
||||||
class User {
|
|
||||||
|
|
||||||
int id = null;
|
|
||||||
|
|
||||||
String username = null;
|
|
||||||
|
|
||||||
String firstName = null;
|
|
||||||
|
|
||||||
String lastName = null;
|
|
||||||
|
|
||||||
String email = null;
|
|
||||||
|
|
||||||
String password = null;
|
|
||||||
|
|
||||||
String phone = null;
|
|
||||||
/* User Status */
|
|
||||||
int userStatus = null;
|
|
||||||
User();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
User.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json == null) return;
|
|
||||||
id = json['id'];
|
|
||||||
username = json['username'];
|
|
||||||
firstName = json['firstName'];
|
|
||||||
lastName = json['lastName'];
|
|
||||||
email = json['email'];
|
|
||||||
password = json['password'];
|
|
||||||
phone = json['phone'];
|
|
||||||
userStatus = json['userStatus'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
Map <String, dynamic> json = {};
|
|
||||||
if (id != null)
|
|
||||||
json['id'] = id;
|
|
||||||
if (username != null)
|
|
||||||
json['username'] = username;
|
|
||||||
if (firstName != null)
|
|
||||||
json['firstName'] = firstName;
|
|
||||||
if (lastName != null)
|
|
||||||
json['lastName'] = lastName;
|
|
||||||
if (email != null)
|
|
||||||
json['email'] = email;
|
|
||||||
if (password != null)
|
|
||||||
json['password'] = password;
|
|
||||||
if (phone != null)
|
|
||||||
json['phone'] = phone;
|
|
||||||
if (userStatus != null)
|
|
||||||
json['userStatus'] = userStatus;
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<User> listFromJson(List<dynamic> json) {
|
|
||||||
return json == null ? List<User>() : json.map((value) => User.fromJson(value)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Map<String, User> mapFromJson(Map<String, dynamic> json) {
|
|
||||||
var map = Map<String, User>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String 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) {
|
|
||||||
var map = Map<String, List<User>>();
|
|
||||||
if (json != null && json.isNotEmpty) {
|
|
||||||
json.forEach((String key, dynamic value) {
|
|
||||||
map[key] = User.listFromJson(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
name: openapi
|
|
||||||
version: 1.0.0
|
|
||||||
description: OpenAPI API client
|
|
||||||
environment:
|
|
||||||
sdk: '>=2.0.0 <3.0.0'
|
|
||||||
dependencies:
|
|
||||||
http: '>=0.12.0 <0.13.0'
|
|
||||||
dev_dependencies:
|
|
||||||
test: ^1.3.0
|
|
@ -1,27 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for ApiResponse
|
|
||||||
void main() {
|
|
||||||
var instance = ApiResponse();
|
|
||||||
|
|
||||||
group('test ApiResponse', () {
|
|
||||||
// int code (default value: null)
|
|
||||||
test('to test the property `code`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String type (default value: null)
|
|
||||||
test('to test the property `type`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String message (default value: null)
|
|
||||||
test('to test the property `message`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Category
|
|
||||||
void main() {
|
|
||||||
var instance = Category();
|
|
||||||
|
|
||||||
group('test Category', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Order
|
|
||||||
void main() {
|
|
||||||
var instance = Order();
|
|
||||||
|
|
||||||
group('test Order', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// int petId (default value: null)
|
|
||||||
test('to test the property `petId`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// int quantity (default value: null)
|
|
||||||
test('to test the property `quantity`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// DateTime shipDate (default value: null)
|
|
||||||
test('to test the property `shipDate`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Order Status
|
|
||||||
// String status (default value: null)
|
|
||||||
test('to test the property `status`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// bool complete (default value: false)
|
|
||||||
test('to test the property `complete`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for PetApi
|
|
||||||
void main() {
|
|
||||||
var instance = PetApi();
|
|
||||||
|
|
||||||
group('tests for PetApi', () {
|
|
||||||
// Add a new pet to the store
|
|
||||||
//
|
|
||||||
//Future addPet(Pet body) async
|
|
||||||
test('test addPet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Deletes a pet
|
|
||||||
//
|
|
||||||
//Future deletePet(int petId, { String apiKey }) async
|
|
||||||
test('test deletePet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finds Pets by status
|
|
||||||
//
|
|
||||||
// Multiple status values can be provided with comma separated strings
|
|
||||||
//
|
|
||||||
//Future<List<Pet>> findPetsByStatus(List<String> status) async
|
|
||||||
test('test findPetsByStatus', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finds Pets by tags
|
|
||||||
//
|
|
||||||
// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
//
|
|
||||||
//Future<List<Pet>> findPetsByTags(List<String> tags) async
|
|
||||||
test('test findPetsByTags', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find pet by ID
|
|
||||||
//
|
|
||||||
// Returns a single pet
|
|
||||||
//
|
|
||||||
//Future<Pet> getPetById(int petId) async
|
|
||||||
test('test getPetById', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update an existing pet
|
|
||||||
//
|
|
||||||
//Future updatePet(Pet body) async
|
|
||||||
test('test updatePet', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Updates a pet in the store with form data
|
|
||||||
//
|
|
||||||
//Future updatePetWithForm(int petId, { String name, String status }) async
|
|
||||||
test('test updatePetWithForm', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// uploads an image
|
|
||||||
//
|
|
||||||
//Future<ApiResponse> uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async
|
|
||||||
test('test uploadFile', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Pet
|
|
||||||
void main() {
|
|
||||||
var instance = Pet();
|
|
||||||
|
|
||||||
group('test Pet', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Category category (default value: null)
|
|
||||||
test('to test the property `category`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// List<String> photoUrls (default value: [])
|
|
||||||
test('to test the property `photoUrls`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// List<Tag> tags (default value: [])
|
|
||||||
test('to test the property `tags`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// pet status in the store
|
|
||||||
// String status (default value: null)
|
|
||||||
test('to test the property `status`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for StoreApi
|
|
||||||
void main() {
|
|
||||||
var instance = StoreApi();
|
|
||||||
|
|
||||||
group('tests for StoreApi', () {
|
|
||||||
// Delete purchase order by ID
|
|
||||||
//
|
|
||||||
// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
//
|
|
||||||
//Future deleteOrder(String orderId) async
|
|
||||||
test('test deleteOrder', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Returns pet inventories by status
|
|
||||||
//
|
|
||||||
// Returns a map of status codes to quantities
|
|
||||||
//
|
|
||||||
//Future<Map<String, int>> getInventory() async
|
|
||||||
test('test getInventory', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find purchase order by ID
|
|
||||||
//
|
|
||||||
// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
//
|
|
||||||
//Future<Order> getOrderById(int orderId) async
|
|
||||||
test('test getOrderById', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Place an order for a pet
|
|
||||||
//
|
|
||||||
//Future<Order> placeOrder(Order body) async
|
|
||||||
test('test placeOrder', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for Tag
|
|
||||||
void main() {
|
|
||||||
var instance = Tag();
|
|
||||||
|
|
||||||
group('test Tag', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String name (default value: null)
|
|
||||||
test('to test the property `name`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// tests for UserApi
|
|
||||||
void main() {
|
|
||||||
var instance = UserApi();
|
|
||||||
|
|
||||||
group('tests for UserApi', () {
|
|
||||||
// Create user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future createUser(User body) async
|
|
||||||
test('test createUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Creates list of users with given input array
|
|
||||||
//
|
|
||||||
//Future createUsersWithArrayInput(List<User> body) async
|
|
||||||
test('test createUsersWithArrayInput', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Creates list of users with given input array
|
|
||||||
//
|
|
||||||
//Future createUsersWithListInput(List<User> body) async
|
|
||||||
test('test createUsersWithListInput', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future deleteUser(String username) async
|
|
||||||
test('test deleteUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get user by user name
|
|
||||||
//
|
|
||||||
//Future<User> getUserByName(String username) async
|
|
||||||
test('test getUserByName', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Logs user into the system
|
|
||||||
//
|
|
||||||
//Future<String> loginUser(String username, String password) async
|
|
||||||
test('test loginUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Logs out current logged in user session
|
|
||||||
//
|
|
||||||
//Future logoutUser() async
|
|
||||||
test('test logoutUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// Updated user
|
|
||||||
//
|
|
||||||
// This can only be done by the logged in user.
|
|
||||||
//
|
|
||||||
//Future updateUser(String username, User body) async
|
|
||||||
test('test updateUser', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
import 'package:openapi/api.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// tests for User
|
|
||||||
void main() {
|
|
||||||
var instance = User();
|
|
||||||
|
|
||||||
group('test User', () {
|
|
||||||
// int id (default value: null)
|
|
||||||
test('to test the property `id`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String username (default value: null)
|
|
||||||
test('to test the property `username`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String firstName (default value: null)
|
|
||||||
test('to test the property `firstName`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String lastName (default value: null)
|
|
||||||
test('to test the property `lastName`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String email (default value: null)
|
|
||||||
test('to test the property `email`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String password (default value: null)
|
|
||||||
test('to test the property `password`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// String phone (default value: null)
|
|
||||||
test('to test the property `phone`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
// User Status
|
|
||||||
// int userStatus (default value: null)
|
|
||||||
test('to test the property `userStatus`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
analyzer:
|
|
||||||
strong-mode: true
|
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for ApiResponse
|
// tests for ApiResponse
|
||||||
void main() {
|
void main() {
|
||||||
var instance = ApiResponse();
|
var instance = new ApiResponse();
|
||||||
|
|
||||||
group('test ApiResponse', () {
|
group('test ApiResponse', () {
|
||||||
// int code (default value: null)
|
// int code (default value: null)
|
||||||
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for Category
|
// tests for Category
|
||||||
void main() {
|
void main() {
|
||||||
var instance = Category();
|
var instance = new Category();
|
||||||
|
|
||||||
group('test Category', () {
|
group('test Category', () {
|
||||||
// int id (default value: null)
|
// int id (default value: null)
|
||||||
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for Order
|
// tests for Order
|
||||||
void main() {
|
void main() {
|
||||||
var instance = Order();
|
var instance = new Order();
|
||||||
|
|
||||||
group('test Order', () {
|
group('test Order', () {
|
||||||
// int id (default value: null)
|
// int id (default value: null)
|
||||||
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for Pet
|
// tests for Pet
|
||||||
void main() {
|
void main() {
|
||||||
var instance = Pet();
|
var instance = new Pet();
|
||||||
|
|
||||||
group('test Pet', () {
|
group('test Pet', () {
|
||||||
// int id (default value: null)
|
// int id (default value: null)
|
||||||
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for Tag
|
// tests for Tag
|
||||||
void main() {
|
void main() {
|
||||||
var instance = Tag();
|
var instance = new Tag();
|
||||||
|
|
||||||
group('test Tag', () {
|
group('test Tag', () {
|
||||||
// int id (default value: null)
|
// int id (default value: null)
|
||||||
|
@ -3,7 +3,7 @@ import 'package:test/test.dart';
|
|||||||
|
|
||||||
// tests for User
|
// tests for User
|
||||||
void main() {
|
void main() {
|
||||||
var instance = User();
|
var instance = new User();
|
||||||
|
|
||||||
group('test User', () {
|
group('test User', () {
|
||||||
// int id (default value: null)
|
// int id (default value: null)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "purge test fils under 'test' folder"
|
echo "purge test fils under 'test' folder"
|
||||||
rm -Rf flutter_petstore/openapi/test/
|
|
||||||
rm -Rf openapi/test/
|
rm -Rf openapi/test/
|
||||||
rm -Rf openapi-browser-client/test
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user