mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
[dart-dio][timemachine] Bugfix: saving offset_date_serializer instead of local_date_serialize (#21974)
* Bugfix: saving offset_date_serializer instead of local_date_serializer.dart * New config for dart-dio (timemachine) * test samples in github workflow * update workflow, samples * rename --------- Co-authored-by: Enric Pou <enricpou@gmail.com>
This commit is contained in:
parent
7dcef20355
commit
8b01ebb5c2
@ -10,6 +10,7 @@ on:
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/**
|
||||
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/**
|
||||
pull_request:
|
||||
paths:
|
||||
#- samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/**
|
||||
@ -18,6 +19,7 @@ on:
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/**
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/**
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/**
|
||||
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/**
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@ -33,6 +35,7 @@ jobs:
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof/
|
||||
- samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/
|
||||
- samples/openapi3/client/petstore/dart-dio/binary_response/
|
||||
- samples/openapi3/client/petstore/dart-dio/petstore-timemachine/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
|
14
bin/configs/dart-dio-petstore-timemachine.yaml
Normal file
14
bin/configs/dart-dio-petstore-timemachine.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
generatorName: dart-dio
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore-timemachine
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||
typeMappings:
|
||||
Client: "ModelClient"
|
||||
File: "ModelFile"
|
||||
EnumClass: "ModelEnumClass"
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
enumUnknownDefaultCase: "true"
|
||||
dateLibrary: "timemachine"
|
||||
reservedWordsMappings:
|
||||
class: "classField"
|
@ -317,7 +317,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
imports.put("OffsetDate", "package:time_machine/time_machine.dart");
|
||||
imports.put("OffsetDateTime", "package:time_machine/time_machine.dart");
|
||||
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {
|
||||
supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "local_date_serializer.dart"));
|
||||
supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", srcFolder, "offset_date_serializer.dart"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
41
samples/openapi3/client/petstore/dart-dio/petstore-timemachine/.gitignore
vendored
Normal file
41
samples/openapi3/client/petstore/dart-dio/petstore-timemachine/.gitignore
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# See https://dart.dev/guides/libraries/private-files
|
||||
|
||||
# Files and directories created by pub
|
||||
.dart_tool/
|
||||
.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
|
||||
|
||||
# Don’t commit files and directories created by other development environments.
|
||||
# For example, if your development environment creates any of the following files,
|
||||
# consider putting them in a global ignore file:
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Mac
|
||||
.DS_Store
|
@ -0,0 +1,23 @@
|
||||
# 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
|
@ -0,0 +1,32 @@
|
||||
.gitignore
|
||||
README.md
|
||||
analysis_options.yaml
|
||||
doc/ApiResponse.md
|
||||
doc/Category.md
|
||||
doc/Order.md
|
||||
doc/Pet.md
|
||||
doc/PetApi.md
|
||||
doc/StoreApi.md
|
||||
doc/Tag.md
|
||||
doc/User.md
|
||||
doc/UserApi.md
|
||||
lib/openapi.dart
|
||||
lib/src/api.dart
|
||||
lib/src/api/pet_api.dart
|
||||
lib/src/api/store_api.dart
|
||||
lib/src/api/user_api.dart
|
||||
lib/src/api_util.dart
|
||||
lib/src/auth/api_key_auth.dart
|
||||
lib/src/auth/auth.dart
|
||||
lib/src/auth/basic_auth.dart
|
||||
lib/src/auth/bearer_auth.dart
|
||||
lib/src/auth/oauth.dart
|
||||
lib/src/model/api_response.dart
|
||||
lib/src/model/category.dart
|
||||
lib/src/model/order.dart
|
||||
lib/src/model/pet.dart
|
||||
lib/src/model/tag.dart
|
||||
lib/src/model/user.dart
|
||||
lib/src/offset_date_serializer.dart
|
||||
lib/src/serializers.dart
|
||||
pubspec.yaml
|
@ -0,0 +1 @@
|
||||
7.16.0-SNAPSHOT
|
@ -0,0 +1,124 @@
|
||||
# openapi (EXPERIMENTAL)
|
||||
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
|
||||
- Generator version: 7.16.0-SNAPSHOT
|
||||
- Build package: org.openapitools.codegen.languages.DartDioClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
||||
* Dart 2.15.0+ or Flutter 2.8.0+
|
||||
* Dio 5.0.0+ (https://pub.dev/packages/dio)
|
||||
* timemachine option currently **DOES NOT** support sound null-safety and may not work
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
### pub.dev
|
||||
To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml
|
||||
```yaml
|
||||
dependencies:
|
||||
openapi: 1.0.0
|
||||
```
|
||||
|
||||
### Github
|
||||
If this Dart package is published to Github, please include the following in pubspec.yaml
|
||||
```yaml
|
||||
dependencies:
|
||||
openapi:
|
||||
git:
|
||||
url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
||||
#ref: main
|
||||
```
|
||||
|
||||
### Local development
|
||||
To use the package from your local drive, please include the following in pubspec.yaml
|
||||
```yaml
|
||||
dependencies:
|
||||
openapi:
|
||||
path: /path/to/openapi
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
```dart
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final Pet pet = ; // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
final response = await api.addPet(pet);
|
||||
print(response);
|
||||
} catch on DioException (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*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
[*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
[*PetApi*](doc/PetApi.md) | [**updatePet**](doc/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
[*PetApi*](doc/PetApi.md) | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[*PetApi*](doc/PetApi.md) | [**uploadFile**](doc/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[*StoreApi*](doc/StoreApi.md) | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[*StoreApi*](doc/StoreApi.md) | [**getInventory**](doc/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[*StoreApi*](doc/StoreApi.md) | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[*StoreApi*](doc/StoreApi.md) | [**placeOrder**](doc/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
[*UserApi*](doc/UserApi.md) | [**createUser**](doc/UserApi.md#createuser) | **POST** /user | Create user
|
||||
[*UserApi*](doc/UserApi.md) | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[*UserApi*](doc/UserApi.md) | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[*UserApi*](doc/UserApi.md) | [**deleteUser**](doc/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
[*UserApi*](doc/UserApi.md) | [**getUserByName**](doc/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
[*UserApi*](doc/UserApi.md) | [**loginUser**](doc/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
[*UserApi*](doc/UserApi.md) | [**logoutUser**](doc/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[*UserApi*](doc/UserApi.md) | [**updateUser**](doc/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [ApiResponse](doc/ApiResponse.md)
|
||||
- [Category](doc/Category.md)
|
||||
- [Order](doc/Order.md)
|
||||
- [Pet](doc/Pet.md)
|
||||
- [Tag](doc/Tag.md)
|
||||
- [User](doc/User.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### 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
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
analyzer:
|
||||
language:
|
||||
strict-inference: true
|
||||
strict-raw-types: true
|
||||
strict-casts: false
|
||||
exclude:
|
||||
- test/*.dart
|
||||
errors:
|
||||
deprecated_member_use_from_same_package: ignore
|
@ -0,0 +1,17 @@
|
||||
# openapi.model.ApiResponse
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **int** | | [optional]
|
||||
**type** | **String** | | [optional]
|
||||
**message** | **String** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
# openapi.model.Category
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# openapi.model.Order
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**petId** | **int** | | [optional]
|
||||
**quantity** | **int** | | [optional]
|
||||
**shipDate** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
|
||||
**status** | **String** | Order Status | [optional]
|
||||
**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)
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# openapi.model.Pet
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **String** | |
|
||||
**photoUrls** | **BuiltList<String>** | |
|
||||
**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,391 @@
|
||||
# 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**
|
||||
> Pet addPet(pet)
|
||||
|
||||
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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final Pet pet = ; // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
final response = api.addPet(pet);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->addPet: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **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)
|
||||
|
||||
# **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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final int petId = 789; // int | Pet id to delete
|
||||
final String apiKey = apiKey_example; // String |
|
||||
|
||||
try {
|
||||
api.deletePet(petId, apiKey);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->deletePet: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| Pet id to delete |
|
||||
**apiKey** | **String**| | [optional]
|
||||
|
||||
### 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**
|
||||
> BuiltList<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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final BuiltList<String> status = ; // BuiltList<String> | Status values that need to be considered for filter
|
||||
|
||||
try {
|
||||
final response = api.findPetsByStatus(status);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->findPetsByStatus: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
|
||||
[**BuiltList<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**
|
||||
> BuiltList<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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final BuiltList<String> tags = ; // BuiltList<String> | Tags to filter by
|
||||
|
||||
try {
|
||||
final response = api.findPetsByTags(tags);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->findPetsByTags: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**BuiltList<String>**](String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
[**BuiltList<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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final int petId = 789; // int | ID of pet to return
|
||||
|
||||
try {
|
||||
final response = api.getPetById(petId);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->getPetById: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to return |
|
||||
|
||||
### 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**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final Pet pet = ; // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
final response = api.updatePet(pet);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->updatePet: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **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)
|
||||
|
||||
# **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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final int petId = 789; // int | ID of pet that needs to be updated
|
||||
final String name = name_example; // String | Updated name of the pet
|
||||
final String status = status_example; // String | Updated status of the pet
|
||||
|
||||
try {
|
||||
api.updatePetWithForm(petId, name, status);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->updatePetWithForm: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet that needs to be updated |
|
||||
**name** | **String**| Updated name of the pet | [optional]
|
||||
**status** | **String**| Updated status of the pet | [optional]
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getPetApi();
|
||||
final int petId = 789; // int | ID of pet to update
|
||||
final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
|
||||
final MultipartFile file = BINARY_DATA_HERE; // MultipartFile | file to upload
|
||||
|
||||
try {
|
||||
final response = api.uploadFile(petId, additionalMetadata, file);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling PetApi->uploadFile: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **int**| ID of pet to update |
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
||||
**file** | **MultipartFile**| file to upload | [optional]
|
||||
|
||||
### 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)
|
||||
|
@ -0,0 +1,188 @@
|
||||
# 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';
|
||||
|
||||
final api = Openapi().getStoreApi();
|
||||
final String orderId = orderId_example; // String | ID of the order that needs to be deleted
|
||||
|
||||
try {
|
||||
api.deleteOrder(orderId);
|
||||
} catch on DioException (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 |
|
||||
|
||||
### 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**
|
||||
> BuiltMap<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';
|
||||
|
||||
final api = Openapi().getStoreApi();
|
||||
|
||||
try {
|
||||
final response = api.getInventory();
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling StoreApi->getInventory: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**BuiltMap<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 generate exceptions
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final api = Openapi().getStoreApi();
|
||||
final int orderId = 789; // int | ID of pet that needs to be fetched
|
||||
|
||||
try {
|
||||
final response = api.getOrderById(orderId);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling StoreApi->getOrderById: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### 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(order)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final api = Openapi().getStoreApi();
|
||||
final Order order = ; // Order | order placed for purchasing the pet
|
||||
|
||||
try {
|
||||
final response = api.placeOrder(order);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling StoreApi->placeOrder: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,16 @@
|
||||
# openapi.model.Tag
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
# openapi.model.User
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**username** | **String** | | [optional]
|
||||
**firstName** | **String** | | [optional]
|
||||
**lastName** | **String** | | [optional]
|
||||
**email** | **String** | | [optional]
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**userStatus** | **int** | User Status | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,383 @@
|
||||
# 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(user)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final User user = ; // User | Created user object
|
||||
|
||||
try {
|
||||
api.createUser(user);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->createUser: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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(user)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final BuiltList<User> user = ; // BuiltList<User> | List of user object
|
||||
|
||||
try {
|
||||
api.createUsersWithArrayInput(user);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->createUsersWithArrayInput: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**BuiltList<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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(user)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final BuiltList<User> user = ; // BuiltList<User> | List of user object
|
||||
|
||||
try {
|
||||
api.createUsersWithListInput(user);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->createUsersWithListInput: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**BuiltList<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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';
|
||||
// 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final String username = username_example; // String | The name that needs to be deleted
|
||||
|
||||
try {
|
||||
api.deleteUser(username);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->deleteUser: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final String username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try {
|
||||
final response = api.getUserByName(username);
|
||||
print(response);
|
||||
} catch on DioException (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. |
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final String username = username_example; // String | The user name for login
|
||||
final String password = password_example; // String | The password for login in clear text
|
||||
|
||||
try {
|
||||
final response = api.loginUser(username, password);
|
||||
print(response);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->loginUser: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login |
|
||||
**password** | **String**| The password for login in clear text |
|
||||
|
||||
### 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';
|
||||
// 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
|
||||
try {
|
||||
api.logoutUser();
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->logoutUser: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### 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, user)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### 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';
|
||||
|
||||
final api = Openapi().getUserApi();
|
||||
final String username = username_example; // String | name that need to be deleted
|
||||
final User user = ; // User | Updated user object
|
||||
|
||||
try {
|
||||
api.updateUser(username, user);
|
||||
} catch on DioException (e) {
|
||||
print('Exception when calling UserApi->updateUser: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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)
|
||||
|
@ -0,0 +1,23 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
export 'package:openapi/src/api.dart';
|
||||
export 'package:openapi/src/auth/api_key_auth.dart';
|
||||
export 'package:openapi/src/auth/basic_auth.dart';
|
||||
export 'package:openapi/src/auth/bearer_auth.dart';
|
||||
export 'package:openapi/src/auth/oauth.dart';
|
||||
export 'package:openapi/src/serializers.dart';
|
||||
|
||||
|
||||
export 'package:openapi/src/api/pet_api.dart';
|
||||
export 'package:openapi/src/api/store_api.dart';
|
||||
export 'package:openapi/src/api/user_api.dart';
|
||||
|
||||
export 'package:openapi/src/model/api_response.dart';
|
||||
export 'package:openapi/src/model/category.dart';
|
||||
export 'package:openapi/src/model/order.dart';
|
||||
export 'package:openapi/src/model/pet.dart';
|
||||
export 'package:openapi/src/model/tag.dart';
|
||||
export 'package:openapi/src/model/user.dart';
|
||||
|
@ -0,0 +1,87 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:openapi/src/serializers.dart';
|
||||
import 'package:openapi/src/auth/api_key_auth.dart';
|
||||
import 'package:openapi/src/auth/basic_auth.dart';
|
||||
import 'package:openapi/src/auth/bearer_auth.dart';
|
||||
import 'package:openapi/src/auth/oauth.dart';
|
||||
import 'package:openapi/src/api/pet_api.dart';
|
||||
import 'package:openapi/src/api/store_api.dart';
|
||||
import 'package:openapi/src/api/user_api.dart';
|
||||
|
||||
class Openapi {
|
||||
static const String basePath = r'http://petstore.swagger.io/v2';
|
||||
|
||||
final Dio dio;
|
||||
final Serializers serializers;
|
||||
|
||||
Openapi({
|
||||
Dio? dio,
|
||||
Serializers? serializers,
|
||||
String? basePathOverride,
|
||||
List<Interceptor>? interceptors,
|
||||
}) : this.serializers = serializers ?? standardSerializers,
|
||||
this.dio = dio ??
|
||||
Dio(BaseOptions(
|
||||
baseUrl: basePathOverride ?? basePath,
|
||||
connectTimeout: const Duration(milliseconds: 5000),
|
||||
receiveTimeout: const Duration(milliseconds: 3000),
|
||||
)) {
|
||||
if (interceptors == null) {
|
||||
this.dio.interceptors.addAll([
|
||||
OAuthInterceptor(),
|
||||
BasicAuthInterceptor(),
|
||||
BearerAuthInterceptor(),
|
||||
ApiKeyAuthInterceptor(),
|
||||
]);
|
||||
} else {
|
||||
this.dio.interceptors.addAll(interceptors);
|
||||
}
|
||||
}
|
||||
|
||||
void setOAuthToken(String name, String token) {
|
||||
if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) {
|
||||
(this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
}
|
||||
|
||||
void setBearerAuth(String name, String token) {
|
||||
if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) {
|
||||
(this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token;
|
||||
}
|
||||
}
|
||||
|
||||
void setBasicAuth(String name, String username, String password) {
|
||||
if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) {
|
||||
(this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
|
||||
}
|
||||
}
|
||||
|
||||
void setApiKey(String name, String apiKey) {
|
||||
if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) {
|
||||
(this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get PetApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
/// by doing that all interceptors will not be executed
|
||||
PetApi getPetApi() {
|
||||
return PetApi(dio, serializers);
|
||||
}
|
||||
|
||||
/// Get StoreApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
/// by doing that all interceptors will not be executed
|
||||
StoreApi getStoreApi() {
|
||||
return StoreApi(dio, serializers);
|
||||
}
|
||||
|
||||
/// Get UserApi instance, base route and serializer can be overridden by a given but be careful,
|
||||
/// by doing that all interceptors will not be executed
|
||||
UserApi getUserApi() {
|
||||
return UserApi(dio, serializers);
|
||||
}
|
||||
}
|
@ -0,0 +1,718 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:built_value/json_object.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/src/api_util.dart';
|
||||
import 'package:openapi/src/model/api_response.dart';
|
||||
import 'package:openapi/src/model/pet.dart';
|
||||
|
||||
class PetApi {
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const PetApi(this._dio, this._serializers);
|
||||
|
||||
/// Add a new pet to the store
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [pet] - Pet object that needs to be added to the store
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [Pet] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<Pet>> addPet({
|
||||
required Pet pet,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet';
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(Pet);
|
||||
_bodyData = _serializers.serialize(pet, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
Pet? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(Pet),
|
||||
) as Pet;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<Pet>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Deletes a pet
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [petId] - Pet id to delete
|
||||
/// * [apiKey]
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> deletePet({
|
||||
required int petId,
|
||||
String? apiKey,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||
final _options = Options(
|
||||
method: r'DELETE',
|
||||
headers: <String, dynamic>{
|
||||
if (apiKey != null) r'api_key': apiKey,
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Finds Pets by status
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [status] - Status values that need to be considered for filter
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [BuiltList<Pet>] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<BuiltList<Pet>>> findPetsByStatus({
|
||||
@Deprecated('status is deprecated') required BuiltList<String> status,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/findByStatus';
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _queryParameters = <String, dynamic>{
|
||||
r'status': encodeCollectionQueryParameter<String>(_serializers, status, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,),
|
||||
};
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
queryParameters: _queryParameters,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
BuiltList<Pet>? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(BuiltList, [FullType(Pet)]),
|
||||
) as BuiltList<Pet>;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<BuiltList<Pet>>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Finds Pets by tags
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [tags] - Tags to filter by
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [BuiltList<Pet>] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
@Deprecated('This operation has been deprecated')
|
||||
Future<Response<BuiltList<Pet>>> findPetsByTags({
|
||||
required BuiltList<String> tags,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/findByTags';
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _queryParameters = <String, dynamic>{
|
||||
r'tags': encodeCollectionQueryParameter<String>(_serializers, tags, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,),
|
||||
};
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
queryParameters: _queryParameters,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
BuiltList<Pet>? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(BuiltList, [FullType(Pet)]),
|
||||
) as BuiltList<Pet>;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<BuiltList<Pet>>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Find pet by ID
|
||||
/// Returns a single pet
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [petId] - ID of pet to return
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [Pet] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<Pet>> getPetById({
|
||||
required int petId,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
Pet? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(Pet),
|
||||
) as Pet;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<Pet>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Update an existing pet
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [pet] - Pet object that needs to be added to the store
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [Pet] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
/// API documentation for the updatePet operation
|
||||
/// Also see [Update an existing pet Documentation](http://petstore.swagger.io/v2/doc/updatePet)
|
||||
Future<Response<Pet>> updatePet({
|
||||
required Pet pet,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet';
|
||||
final _options = Options(
|
||||
method: r'PUT',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(Pet);
|
||||
_bodyData = _serializers.serialize(pet, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
Pet? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(Pet),
|
||||
) as Pet;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<Pet>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates a pet in the store with form data
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [petId] - ID of pet that needs to be updated
|
||||
/// * [name] - Updated name of the pet
|
||||
/// * [status] - Updated status of the pet
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> updatePetWithForm({
|
||||
required int petId,
|
||||
String? name,
|
||||
String? status,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
_bodyData = <String, dynamic>{
|
||||
if (name != null) r'name': encodeQueryParameter(_serializers, name, const FullType(String)),
|
||||
if (status != null) r'status': encodeQueryParameter(_serializers, status, const FullType(String)),
|
||||
};
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// uploads an image
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [petId] - ID of pet to update
|
||||
/// * [additionalMetadata] - Additional data to pass to server
|
||||
/// * [file] - file to upload
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [ApiResponse] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<ApiResponse>> uploadFile({
|
||||
required int petId,
|
||||
String? additionalMetadata,
|
||||
MultipartFile? file,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', encodeQueryParameter(_serializers, petId, const FullType(int)).toString());
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'name': 'petstore_auth',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'multipart/form-data',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
_bodyData = FormData.fromMap(<String, dynamic>{
|
||||
if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_serializers, additionalMetadata, const FullType(String)),
|
||||
if (file != null) r'file': file,
|
||||
});
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
ApiResponse? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(ApiResponse),
|
||||
) as ApiResponse;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<ApiResponse>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,320 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:built_value/json_object.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/src/api_util.dart';
|
||||
import 'package:openapi/src/model/order.dart';
|
||||
|
||||
class StoreApi {
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const StoreApi(this._dio, this._serializers);
|
||||
|
||||
/// Delete purchase order by ID
|
||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [orderId] - ID of the order that needs to be deleted
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> deleteOrder({
|
||||
required String orderId,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/store/order/{orderId}'.replaceAll('{' r'orderId' '}', encodeQueryParameter(_serializers, orderId, const FullType(String)).toString());
|
||||
final _options = Options(
|
||||
method: r'DELETE',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Returns pet inventories by status
|
||||
/// Returns a map of status codes to quantities
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [BuiltMap<String, int>] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<BuiltMap<String, int>>> getInventory({
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/store/inventory';
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
BuiltMap<String, int>? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(BuiltMap, [FullType(String), FullType(int)]),
|
||||
) as BuiltMap<String, int>;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<BuiltMap<String, int>>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Find purchase order by ID
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [orderId] - ID of pet that needs to be fetched
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [Order] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<Order>> getOrderById({
|
||||
required int orderId,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/store/order/{orderId}'.replaceAll('{' r'orderId' '}', encodeQueryParameter(_serializers, orderId, const FullType(int)).toString());
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
Order? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(Order),
|
||||
) as Order;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<Order>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Place an order for a pet
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [order] - order placed for purchasing the pet
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [Order] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<Order>> placeOrder({
|
||||
required Order order,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/store/order';
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(Order);
|
||||
_bodyData = _serializers.serialize(order, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
Order? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(Order),
|
||||
) as Order;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<Order>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,583 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:built_value/json_object.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/src/api_util.dart';
|
||||
import 'package:openapi/src/model/user.dart';
|
||||
import 'package:time_machine/time_machine.dart';
|
||||
|
||||
class UserApi {
|
||||
|
||||
final Dio _dio;
|
||||
|
||||
final Serializers _serializers;
|
||||
|
||||
const UserApi(this._dio, this._serializers);
|
||||
|
||||
/// Create user
|
||||
/// This can only be done by the logged in user.
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [user] - Created user object
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> createUser({
|
||||
required User user,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user';
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(User);
|
||||
_bodyData = _serializers.serialize(user, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [user] - List of user object
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> createUsersWithArrayInput({
|
||||
required BuiltList<User> user,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/createWithArray';
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(BuiltList, [FullType(User)]);
|
||||
_bodyData = _serializers.serialize(user, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [user] - List of user object
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> createUsersWithListInput({
|
||||
required BuiltList<User> user,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/createWithList';
|
||||
final _options = Options(
|
||||
method: r'POST',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(BuiltList, [FullType(User)]);
|
||||
_bodyData = _serializers.serialize(user, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Delete user
|
||||
/// This can only be done by the logged in user.
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [username] - The name that needs to be deleted
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> deleteUser({
|
||||
required String username,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||
final _options = Options(
|
||||
method: r'DELETE',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Get user by user name
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [username] - The name that needs to be fetched. Use user1 for testing.
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [User] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<User>> getUserByName({
|
||||
required String username,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
User? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
||||
rawResponse,
|
||||
specifiedType: const FullType(User),
|
||||
) as User;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<User>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Logs user into the system
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [username] - The user name for login
|
||||
/// * [password] - The password for login in clear text
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future] containing a [Response] with a [String] as data
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<String>> loginUser({
|
||||
required String username,
|
||||
required String password,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/login';
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _queryParameters = <String, dynamic>{
|
||||
r'username': encodeQueryParameter(_serializers, username, const FullType(String)),
|
||||
r'password': encodeQueryParameter(_serializers, password, const FullType(String)),
|
||||
};
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
queryParameters: _queryParameters,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
String? _responseData;
|
||||
|
||||
try {
|
||||
final rawResponse = _response.data;
|
||||
_responseData = rawResponse == null ? null : rawResponse as String;
|
||||
|
||||
} catch (error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _response.requestOptions,
|
||||
response: _response,
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
return Response<String>(
|
||||
data: _responseData,
|
||||
headers: _response.headers,
|
||||
isRedirect: _response.isRedirect,
|
||||
requestOptions: _response.requestOptions,
|
||||
redirects: _response.redirects,
|
||||
statusCode: _response.statusCode,
|
||||
statusMessage: _response.statusMessage,
|
||||
extra: _response.extra,
|
||||
);
|
||||
}
|
||||
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> logoutUser({
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/logout';
|
||||
final _options = Options(
|
||||
method: r'GET',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
/// Updated user
|
||||
/// This can only be done by the logged in user.
|
||||
///
|
||||
/// Parameters:
|
||||
/// * [username] - name that need to be deleted
|
||||
/// * [user] - Updated user object
|
||||
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
|
||||
/// * [headers] - Can be used to add additional headers to the request
|
||||
/// * [extras] - Can be used to add flags to the request
|
||||
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
|
||||
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
|
||||
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
|
||||
///
|
||||
/// Returns a [Future]
|
||||
/// Throws [DioException] if API call or serialization fails
|
||||
Future<Response<void>> updateUser({
|
||||
required String username,
|
||||
required User user,
|
||||
CancelToken? cancelToken,
|
||||
Map<String, dynamic>? headers,
|
||||
Map<String, dynamic>? extra,
|
||||
ValidateStatus? validateStatus,
|
||||
ProgressCallback? onSendProgress,
|
||||
ProgressCallback? onReceiveProgress,
|
||||
}) async {
|
||||
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', encodeQueryParameter(_serializers, username, const FullType(String)).toString());
|
||||
final _options = Options(
|
||||
method: r'PUT',
|
||||
headers: <String, dynamic>{
|
||||
...?headers,
|
||||
},
|
||||
extra: <String, dynamic>{
|
||||
'secure': <Map<String, String>>[
|
||||
{
|
||||
'type': 'apiKey',
|
||||
'name': 'api_key',
|
||||
'keyName': 'api_key',
|
||||
'where': 'header',
|
||||
},
|
||||
],
|
||||
...?extra,
|
||||
},
|
||||
contentType: 'application/json',
|
||||
validateStatus: validateStatus,
|
||||
);
|
||||
|
||||
dynamic _bodyData;
|
||||
|
||||
try {
|
||||
const _type = FullType(User);
|
||||
_bodyData = _serializers.serialize(user, specifiedType: _type);
|
||||
|
||||
} catch(error, stackTrace) {
|
||||
throw DioException(
|
||||
requestOptions: _options.compose(
|
||||
_dio.options,
|
||||
_path,
|
||||
),
|
||||
type: DioExceptionType.unknown,
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
||||
final _response = await _dio.request<Object>(
|
||||
_path,
|
||||
data: _bodyData,
|
||||
options: _options,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
);
|
||||
|
||||
return _response;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
/// Format the given form parameter object into something that Dio can handle.
|
||||
/// Returns primitive or String.
|
||||
/// Returns List/Map if the value is BuildList/BuiltMap.
|
||||
dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) {
|
||||
if (value == null) {
|
||||
return '';
|
||||
}
|
||||
if (value is String || value is num || value is bool) {
|
||||
return value;
|
||||
}
|
||||
final serialized = serializers.serialize(
|
||||
value as Object,
|
||||
specifiedType: type,
|
||||
);
|
||||
if (serialized is String) {
|
||||
return serialized;
|
||||
}
|
||||
if (value is BuiltList || value is BuiltSet || value is BuiltMap) {
|
||||
return serialized;
|
||||
}
|
||||
return json.encode(serialized);
|
||||
}
|
||||
|
||||
dynamic encodeQueryParameter(
|
||||
Serializers serializers,
|
||||
dynamic value,
|
||||
FullType type,
|
||||
) {
|
||||
if (value == null) {
|
||||
return '';
|
||||
}
|
||||
if (value is String || value is num || value is bool) {
|
||||
return value;
|
||||
}
|
||||
if (value is Uint8List) {
|
||||
// Currently not sure how to serialize this
|
||||
return value;
|
||||
}
|
||||
final serialized = serializers.serialize(
|
||||
value as Object,
|
||||
specifiedType: type,
|
||||
);
|
||||
if (serialized == null) {
|
||||
return '';
|
||||
}
|
||||
if (serialized is String) {
|
||||
return serialized;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
ListParam<Object?> encodeCollectionQueryParameter<T>(
|
||||
Serializers serializers,
|
||||
dynamic value,
|
||||
FullType type, {
|
||||
ListFormat format = ListFormat.multi,
|
||||
}) {
|
||||
final serialized = serializers.serialize(
|
||||
value as Object,
|
||||
specifiedType: type,
|
||||
);
|
||||
if (value is BuiltList<T> || value is BuiltSet<T>) {
|
||||
return ListParam(List.of((serialized as Iterable<Object?>).cast()), format);
|
||||
}
|
||||
throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter');
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:openapi/src/auth/auth.dart';
|
||||
|
||||
class ApiKeyAuthInterceptor extends AuthInterceptor {
|
||||
final Map<String, String> apiKeys = {};
|
||||
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey');
|
||||
for (final info in authInfo) {
|
||||
final authName = info['name'] as String;
|
||||
final authKeyName = info['keyName'] as String;
|
||||
final authWhere = info['where'] as String;
|
||||
final apiKey = apiKeys[authName];
|
||||
if (apiKey != null) {
|
||||
if (authWhere == 'query') {
|
||||
options.queryParameters[authKeyName] = apiKey;
|
||||
} else {
|
||||
options.headers[authKeyName] = apiKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
abstract class AuthInterceptor extends Interceptor {
|
||||
/// Get auth information on given route for the given type.
|
||||
/// Can return an empty list if type is not present on auth data or
|
||||
/// if route doesn't need authentication.
|
||||
List<Map<String, String>> getAuthInfo(RequestOptions route, bool Function(Map<String, String> secure) handles) {
|
||||
if (route.extra.containsKey('secure')) {
|
||||
final auth = route.extra['secure'] as List<Map<String, String>>;
|
||||
return auth.where((secure) => handles(secure)).toList();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:openapi/src/auth/auth.dart';
|
||||
|
||||
class BasicAuthInfo {
|
||||
final String username;
|
||||
final String password;
|
||||
|
||||
const BasicAuthInfo(this.username, this.password);
|
||||
}
|
||||
|
||||
class BasicAuthInterceptor extends AuthInterceptor {
|
||||
final Map<String, BasicAuthInfo> authInfo = {};
|
||||
|
||||
@override
|
||||
void onRequest(
|
||||
RequestOptions options,
|
||||
RequestInterceptorHandler handler,
|
||||
) {
|
||||
final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'basic') || secure['type'] == 'basic');
|
||||
for (final info in metadataAuthInfo) {
|
||||
final authName = info['name'] as String;
|
||||
final basicAuthInfo = authInfo[authName];
|
||||
if (basicAuthInfo != null) {
|
||||
final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}';
|
||||
options.headers['Authorization'] = basicAuth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:openapi/src/auth/auth.dart';
|
||||
|
||||
class BearerAuthInterceptor extends AuthInterceptor {
|
||||
final Map<String, String> tokens = {};
|
||||
|
||||
@override
|
||||
void onRequest(
|
||||
RequestOptions options,
|
||||
RequestInterceptorHandler handler,
|
||||
) {
|
||||
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'bearer');
|
||||
for (final info in authInfo) {
|
||||
final token = tokens[info['name']];
|
||||
if (token != null) {
|
||||
options.headers['Authorization'] = 'Bearer ${token}';
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:openapi/src/auth/auth.dart';
|
||||
|
||||
class OAuthInterceptor extends AuthInterceptor {
|
||||
final Map<String, String> tokens = {};
|
||||
|
||||
@override
|
||||
void onRequest(
|
||||
RequestOptions options,
|
||||
RequestInterceptorHandler handler,
|
||||
) {
|
||||
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2');
|
||||
for (final info in authInfo) {
|
||||
final token = tokens[info['name']];
|
||||
if (token != null) {
|
||||
options.headers['Authorization'] = 'Bearer ${token}';
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'api_response.g.dart';
|
||||
|
||||
/// Describes the result of uploading an image resource
|
||||
///
|
||||
/// Properties:
|
||||
/// * [code]
|
||||
/// * [type]
|
||||
/// * [message]
|
||||
@BuiltValue()
|
||||
abstract class ApiResponse implements Built<ApiResponse, ApiResponseBuilder> {
|
||||
@BuiltValueField(wireName: r'code')
|
||||
int? get code;
|
||||
|
||||
@BuiltValueField(wireName: r'type')
|
||||
String? get type;
|
||||
|
||||
@BuiltValueField(wireName: r'message')
|
||||
String? get message;
|
||||
|
||||
ApiResponse._();
|
||||
|
||||
factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(ApiResponseBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<ApiResponse> get serializer => _$ApiResponseSerializer();
|
||||
}
|
||||
|
||||
class _$ApiResponseSerializer implements PrimitiveSerializer<ApiResponse> {
|
||||
@override
|
||||
final Iterable<Type> types = const [ApiResponse, _$ApiResponse];
|
||||
|
||||
@override
|
||||
final String wireName = r'ApiResponse';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
ApiResponse object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.code != null) {
|
||||
yield r'code';
|
||||
yield serializers.serialize(
|
||||
object.code,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.type != null) {
|
||||
yield r'type';
|
||||
yield serializers.serialize(
|
||||
object.type,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.message != null) {
|
||||
yield r'message';
|
||||
yield serializers.serialize(
|
||||
object.message,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
ApiResponse object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required ApiResponseBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'code':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.code = valueDes;
|
||||
break;
|
||||
case r'type':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.type = valueDes;
|
||||
break;
|
||||
case r'message':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.message = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
ApiResponse deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = ApiResponseBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,126 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'category.g.dart';
|
||||
|
||||
/// A category for a pet
|
||||
///
|
||||
/// Properties:
|
||||
/// * [id]
|
||||
/// * [name]
|
||||
@BuiltValue()
|
||||
abstract class Category implements Built<Category, CategoryBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
|
||||
@BuiltValueField(wireName: r'name')
|
||||
String? get name;
|
||||
|
||||
Category._();
|
||||
|
||||
factory Category([void updates(CategoryBuilder b)]) = _$Category;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(CategoryBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Category> get serializer => _$CategorySerializer();
|
||||
}
|
||||
|
||||
class _$CategorySerializer implements PrimitiveSerializer<Category> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Category, _$Category];
|
||||
|
||||
@override
|
||||
final String wireName = r'Category';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Category object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.id != null) {
|
||||
yield r'id';
|
||||
yield serializers.serialize(
|
||||
object.id,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.name != null) {
|
||||
yield r'name';
|
||||
yield serializers.serialize(
|
||||
object.name,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Category object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required CategoryBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'id':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.id = valueDes;
|
||||
break;
|
||||
case r'name':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.name = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Category deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = CategoryBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,226 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:time_machine/time_machine.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'order.g.dart';
|
||||
|
||||
/// An order for a pets from the pet store
|
||||
///
|
||||
/// Properties:
|
||||
/// * [id]
|
||||
/// * [petId]
|
||||
/// * [quantity]
|
||||
/// * [shipDate]
|
||||
/// * [status] - Order Status
|
||||
/// * [complete]
|
||||
@BuiltValue()
|
||||
abstract class Order implements Built<Order, OrderBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
|
||||
@BuiltValueField(wireName: r'petId')
|
||||
int? get petId;
|
||||
|
||||
@BuiltValueField(wireName: r'quantity')
|
||||
int? get quantity;
|
||||
|
||||
@BuiltValueField(wireName: r'shipDate')
|
||||
OffsetDateTime? get shipDate;
|
||||
|
||||
/// Order Status
|
||||
@BuiltValueField(wireName: r'status')
|
||||
OrderStatusEnum? get status;
|
||||
// enum statusEnum { placed, approved, delivered, };
|
||||
|
||||
@BuiltValueField(wireName: r'complete')
|
||||
bool? get complete;
|
||||
|
||||
Order._();
|
||||
|
||||
factory Order([void updates(OrderBuilder b)]) = _$Order;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(OrderBuilder b) => b
|
||||
..complete = false;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Order> get serializer => _$OrderSerializer();
|
||||
}
|
||||
|
||||
class _$OrderSerializer implements PrimitiveSerializer<Order> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Order, _$Order];
|
||||
|
||||
@override
|
||||
final String wireName = r'Order';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Order object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.id != null) {
|
||||
yield r'id';
|
||||
yield serializers.serialize(
|
||||
object.id,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.petId != null) {
|
||||
yield r'petId';
|
||||
yield serializers.serialize(
|
||||
object.petId,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.quantity != null) {
|
||||
yield r'quantity';
|
||||
yield serializers.serialize(
|
||||
object.quantity,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.shipDate != null) {
|
||||
yield r'shipDate';
|
||||
yield serializers.serialize(
|
||||
object.shipDate,
|
||||
specifiedType: const FullType(OffsetDateTime),
|
||||
);
|
||||
}
|
||||
if (object.status != null) {
|
||||
yield r'status';
|
||||
yield serializers.serialize(
|
||||
object.status,
|
||||
specifiedType: const FullType(OrderStatusEnum),
|
||||
);
|
||||
}
|
||||
if (object.complete != null) {
|
||||
yield r'complete';
|
||||
yield serializers.serialize(
|
||||
object.complete,
|
||||
specifiedType: const FullType(bool),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Order object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required OrderBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'id':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.id = valueDes;
|
||||
break;
|
||||
case r'petId':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.petId = valueDes;
|
||||
break;
|
||||
case r'quantity':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.quantity = valueDes;
|
||||
break;
|
||||
case r'shipDate':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(OffsetDateTime),
|
||||
) as OffsetDateTime;
|
||||
result.shipDate = valueDes;
|
||||
break;
|
||||
case r'status':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(OrderStatusEnum),
|
||||
) as OrderStatusEnum;
|
||||
result.status = valueDes;
|
||||
break;
|
||||
case r'complete':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(bool),
|
||||
) as bool;
|
||||
result.complete = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Order deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = OrderBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class OrderStatusEnum extends EnumClass {
|
||||
|
||||
/// Order Status
|
||||
@BuiltValueEnumConst(wireName: r'placed')
|
||||
static const OrderStatusEnum placed = _$orderStatusEnum_placed;
|
||||
/// Order Status
|
||||
@BuiltValueEnumConst(wireName: r'approved')
|
||||
static const OrderStatusEnum approved = _$orderStatusEnum_approved;
|
||||
/// Order Status
|
||||
@BuiltValueEnumConst(wireName: r'delivered')
|
||||
static const OrderStatusEnum delivered = _$orderStatusEnum_delivered;
|
||||
/// Order Status
|
||||
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
|
||||
static const OrderStatusEnum unknownDefaultOpenApi = _$orderStatusEnum_unknownDefaultOpenApi;
|
||||
|
||||
static Serializer<OrderStatusEnum> get serializer => _$orderStatusEnumSerializer;
|
||||
|
||||
const OrderStatusEnum._(String name): super(name);
|
||||
|
||||
static BuiltSet<OrderStatusEnum> get values => _$orderStatusEnumValues;
|
||||
static OrderStatusEnum valueOf(String name) => _$orderStatusEnumValueOf(name);
|
||||
}
|
||||
|
@ -0,0 +1,223 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/src/model/category.dart';
|
||||
import 'package:openapi/src/model/tag.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'pet.g.dart';
|
||||
|
||||
/// A pet for sale in the pet store
|
||||
///
|
||||
/// Properties:
|
||||
/// * [id]
|
||||
/// * [category]
|
||||
/// * [name]
|
||||
/// * [photoUrls]
|
||||
/// * [tags]
|
||||
/// * [status] - pet status in the store
|
||||
@BuiltValue()
|
||||
abstract class Pet implements Built<Pet, PetBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
|
||||
@BuiltValueField(wireName: r'category')
|
||||
Category? get category;
|
||||
|
||||
@BuiltValueField(wireName: r'name')
|
||||
String get name;
|
||||
|
||||
@BuiltValueField(wireName: r'photoUrls')
|
||||
BuiltList<String> get photoUrls;
|
||||
|
||||
@BuiltValueField(wireName: r'tags')
|
||||
BuiltList<Tag>? get tags;
|
||||
|
||||
/// pet status in the store
|
||||
@Deprecated('status has been deprecated')
|
||||
@BuiltValueField(wireName: r'status')
|
||||
PetStatusEnum? get status;
|
||||
// enum statusEnum { available, pending, sold, };
|
||||
|
||||
Pet._();
|
||||
|
||||
factory Pet([void updates(PetBuilder b)]) = _$Pet;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(PetBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Pet> get serializer => _$PetSerializer();
|
||||
}
|
||||
|
||||
class _$PetSerializer implements PrimitiveSerializer<Pet> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Pet, _$Pet];
|
||||
|
||||
@override
|
||||
final String wireName = r'Pet';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Pet object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.id != null) {
|
||||
yield r'id';
|
||||
yield serializers.serialize(
|
||||
object.id,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.category != null) {
|
||||
yield r'category';
|
||||
yield serializers.serialize(
|
||||
object.category,
|
||||
specifiedType: const FullType(Category),
|
||||
);
|
||||
}
|
||||
yield r'name';
|
||||
yield serializers.serialize(
|
||||
object.name,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
yield r'photoUrls';
|
||||
yield serializers.serialize(
|
||||
object.photoUrls,
|
||||
specifiedType: const FullType(BuiltList, [FullType(String)]),
|
||||
);
|
||||
if (object.tags != null) {
|
||||
yield r'tags';
|
||||
yield serializers.serialize(
|
||||
object.tags,
|
||||
specifiedType: const FullType(BuiltList, [FullType(Tag)]),
|
||||
);
|
||||
}
|
||||
if (object.status != null) {
|
||||
yield r'status';
|
||||
yield serializers.serialize(
|
||||
object.status,
|
||||
specifiedType: const FullType(PetStatusEnum),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Pet object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required PetBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'id':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.id = valueDes;
|
||||
break;
|
||||
case r'category':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(Category),
|
||||
) as Category;
|
||||
result.category.replace(valueDes);
|
||||
break;
|
||||
case r'name':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.name = valueDes;
|
||||
break;
|
||||
case r'photoUrls':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(BuiltList, [FullType(String)]),
|
||||
) as BuiltList<String>;
|
||||
result.photoUrls.replace(valueDes);
|
||||
break;
|
||||
case r'tags':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(BuiltList, [FullType(Tag)]),
|
||||
) as BuiltList<Tag>;
|
||||
result.tags.replace(valueDes);
|
||||
break;
|
||||
case r'status':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(PetStatusEnum),
|
||||
) as PetStatusEnum;
|
||||
result.status = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Pet deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = PetBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class PetStatusEnum extends EnumClass {
|
||||
|
||||
/// pet status in the store
|
||||
@BuiltValueEnumConst(wireName: r'available')
|
||||
static const PetStatusEnum available = _$petStatusEnum_available;
|
||||
/// pet status in the store
|
||||
@BuiltValueEnumConst(wireName: r'pending')
|
||||
static const PetStatusEnum pending = _$petStatusEnum_pending;
|
||||
/// pet status in the store
|
||||
@BuiltValueEnumConst(wireName: r'sold')
|
||||
static const PetStatusEnum sold = _$petStatusEnum_sold;
|
||||
/// pet status in the store
|
||||
@BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true)
|
||||
static const PetStatusEnum unknownDefaultOpenApi = _$petStatusEnum_unknownDefaultOpenApi;
|
||||
|
||||
static Serializer<PetStatusEnum> get serializer => _$petStatusEnumSerializer;
|
||||
|
||||
const PetStatusEnum._(String name): super(name);
|
||||
|
||||
static BuiltSet<PetStatusEnum> get values => _$petStatusEnumValues;
|
||||
static PetStatusEnum valueOf(String name) => _$petStatusEnumValueOf(name);
|
||||
}
|
||||
|
@ -0,0 +1,126 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'tag.g.dart';
|
||||
|
||||
/// A tag for a pet
|
||||
///
|
||||
/// Properties:
|
||||
/// * [id]
|
||||
/// * [name]
|
||||
@BuiltValue()
|
||||
abstract class Tag implements Built<Tag, TagBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
|
||||
@BuiltValueField(wireName: r'name')
|
||||
String? get name;
|
||||
|
||||
Tag._();
|
||||
|
||||
factory Tag([void updates(TagBuilder b)]) = _$Tag;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(TagBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<Tag> get serializer => _$TagSerializer();
|
||||
}
|
||||
|
||||
class _$TagSerializer implements PrimitiveSerializer<Tag> {
|
||||
@override
|
||||
final Iterable<Type> types = const [Tag, _$Tag];
|
||||
|
||||
@override
|
||||
final String wireName = r'Tag';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
Tag object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.id != null) {
|
||||
yield r'id';
|
||||
yield serializers.serialize(
|
||||
object.id,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.name != null) {
|
||||
yield r'name';
|
||||
yield serializers.serialize(
|
||||
object.name,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
Tag object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required TagBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'id':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.id = valueDes;
|
||||
break;
|
||||
case r'name':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.name = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Tag deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = TagBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,235 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_element
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'user.g.dart';
|
||||
|
||||
/// A User who is purchasing from the pet store
|
||||
///
|
||||
/// Properties:
|
||||
/// * [id]
|
||||
/// * [username]
|
||||
/// * [firstName]
|
||||
/// * [lastName]
|
||||
/// * [email]
|
||||
/// * [password]
|
||||
/// * [phone]
|
||||
/// * [userStatus] - User Status
|
||||
@BuiltValue()
|
||||
abstract class User implements Built<User, UserBuilder> {
|
||||
@BuiltValueField(wireName: r'id')
|
||||
int? get id;
|
||||
|
||||
@BuiltValueField(wireName: r'username')
|
||||
String? get username;
|
||||
|
||||
@BuiltValueField(wireName: r'firstName')
|
||||
String? get firstName;
|
||||
|
||||
@BuiltValueField(wireName: r'lastName')
|
||||
String? get lastName;
|
||||
|
||||
@BuiltValueField(wireName: r'email')
|
||||
String? get email;
|
||||
|
||||
@BuiltValueField(wireName: r'password')
|
||||
String? get password;
|
||||
|
||||
@BuiltValueField(wireName: r'phone')
|
||||
String? get phone;
|
||||
|
||||
/// User Status
|
||||
@BuiltValueField(wireName: r'userStatus')
|
||||
int? get userStatus;
|
||||
|
||||
User._();
|
||||
|
||||
factory User([void updates(UserBuilder b)]) = _$User;
|
||||
|
||||
@BuiltValueHook(initializeBuilder: true)
|
||||
static void _defaults(UserBuilder b) => b;
|
||||
|
||||
@BuiltValueSerializer(custom: true)
|
||||
static Serializer<User> get serializer => _$UserSerializer();
|
||||
}
|
||||
|
||||
class _$UserSerializer implements PrimitiveSerializer<User> {
|
||||
@override
|
||||
final Iterable<Type> types = const [User, _$User];
|
||||
|
||||
@override
|
||||
final String wireName = r'User';
|
||||
|
||||
Iterable<Object?> _serializeProperties(
|
||||
Serializers serializers,
|
||||
User object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) sync* {
|
||||
if (object.id != null) {
|
||||
yield r'id';
|
||||
yield serializers.serialize(
|
||||
object.id,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
if (object.username != null) {
|
||||
yield r'username';
|
||||
yield serializers.serialize(
|
||||
object.username,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.firstName != null) {
|
||||
yield r'firstName';
|
||||
yield serializers.serialize(
|
||||
object.firstName,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.lastName != null) {
|
||||
yield r'lastName';
|
||||
yield serializers.serialize(
|
||||
object.lastName,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.email != null) {
|
||||
yield r'email';
|
||||
yield serializers.serialize(
|
||||
object.email,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.password != null) {
|
||||
yield r'password';
|
||||
yield serializers.serialize(
|
||||
object.password,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.phone != null) {
|
||||
yield r'phone';
|
||||
yield serializers.serialize(
|
||||
object.phone,
|
||||
specifiedType: const FullType(String),
|
||||
);
|
||||
}
|
||||
if (object.userStatus != null) {
|
||||
yield r'userStatus';
|
||||
yield serializers.serialize(
|
||||
object.userStatus,
|
||||
specifiedType: const FullType(int),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(
|
||||
Serializers serializers,
|
||||
User object, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
return _serializeProperties(serializers, object, specifiedType: specifiedType).toList();
|
||||
}
|
||||
|
||||
void _deserializeProperties(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
required List<Object?> serializedList,
|
||||
required UserBuilder result,
|
||||
required List<Object?> unhandled,
|
||||
}) {
|
||||
for (var i = 0; i < serializedList.length; i += 2) {
|
||||
final key = serializedList[i] as String;
|
||||
final value = serializedList[i + 1];
|
||||
switch (key) {
|
||||
case r'id':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.id = valueDes;
|
||||
break;
|
||||
case r'username':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.username = valueDes;
|
||||
break;
|
||||
case r'firstName':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.firstName = valueDes;
|
||||
break;
|
||||
case r'lastName':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.lastName = valueDes;
|
||||
break;
|
||||
case r'email':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.email = valueDes;
|
||||
break;
|
||||
case r'password':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.password = valueDes;
|
||||
break;
|
||||
case r'phone':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(String),
|
||||
) as String;
|
||||
result.phone = valueDes;
|
||||
break;
|
||||
case r'userStatus':
|
||||
final valueDes = serializers.deserialize(
|
||||
value,
|
||||
specifiedType: const FullType(int),
|
||||
) as int;
|
||||
result.userStatus = valueDes;
|
||||
break;
|
||||
default:
|
||||
unhandled.add(key);
|
||||
unhandled.add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
User deserialize(
|
||||
Serializers serializers,
|
||||
Object serialized, {
|
||||
FullType specifiedType = FullType.unspecified,
|
||||
}) {
|
||||
final result = UserBuilder();
|
||||
final serializedList = (serialized as Iterable<Object?>).toList();
|
||||
final unhandled = <Object?>[];
|
||||
_deserializeProperties(
|
||||
serializers,
|
||||
serialized,
|
||||
specifiedType: specifiedType,
|
||||
serializedList: serializedList,
|
||||
unhandled: unhandled,
|
||||
result: result,
|
||||
);
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:time_machine/time_machine.dart';
|
||||
|
||||
class OffsetDateSerializer implements PrimitiveSerializer<OffsetDate> {
|
||||
|
||||
const OffsetDateSerializer();
|
||||
|
||||
@override
|
||||
Iterable<Type> get types => BuiltList.of([OffsetDate]);
|
||||
|
||||
@override
|
||||
String get wireName => 'OffsetDate';
|
||||
|
||||
@override
|
||||
OffsetDate deserialize(Serializers serializers, Object serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final local = LocalDate.dateTime(DateTime.parse(serialized as String));
|
||||
return OffsetDate(local, Offset(0));
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(Serializers serializers, OffsetDate offsetDate,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
return offsetDate.toString('yyyy-MM-dd');
|
||||
}
|
||||
}
|
||||
|
||||
class OffsetDateTimeSerializer implements PrimitiveSerializer<OffsetDateTime> {
|
||||
|
||||
const OffsetDateTimeSerializer();
|
||||
|
||||
@override
|
||||
Iterable<Type> get types => BuiltList<Type>([OffsetDateTime]);
|
||||
|
||||
@override
|
||||
String get wireName => 'OffsetDateTime';
|
||||
|
||||
@override
|
||||
OffsetDateTime deserialize(Serializers serializers, Object serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final local = LocalDateTime.dateTime(DateTime.parse(serialized as String));
|
||||
return OffsetDateTime(local, Offset(0));
|
||||
}
|
||||
|
||||
@override
|
||||
Object serialize(Serializers serializers, OffsetDateTime offsetDateTime,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
return offsetDateTime.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
import 'package:one_of_serializer/any_of_serializer.dart';
|
||||
import 'package:one_of_serializer/one_of_serializer.dart';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/json_object.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:built_value/standard_json_plugin.dart';
|
||||
|
||||
import 'package:time_machine/time_machine.dart';
|
||||
import 'package:openapi/src/offset_date_serializer.dart';
|
||||
import 'package:openapi/src/model/api_response.dart';
|
||||
import 'package:openapi/src/model/category.dart';
|
||||
import 'package:openapi/src/model/order.dart';
|
||||
import 'package:openapi/src/model/pet.dart';
|
||||
import 'package:openapi/src/model/tag.dart';
|
||||
import 'package:openapi/src/model/user.dart';
|
||||
|
||||
part 'serializers.g.dart';
|
||||
|
||||
@SerializersFor([
|
||||
ApiResponse,
|
||||
Category,
|
||||
Order,
|
||||
Pet,
|
||||
Tag,
|
||||
User,
|
||||
])
|
||||
Serializers serializers = (_$serializers.toBuilder()
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, [FullType(User)]),
|
||||
() => ListBuilder<User>(),
|
||||
)
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, [FullType(Pet)]),
|
||||
() => ListBuilder<Pet>(),
|
||||
)
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap, [FullType(String), FullType(int)]),
|
||||
() => MapBuilder<String, int>(),
|
||||
)
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, [FullType(String)]),
|
||||
() => ListBuilder<String>(),
|
||||
)
|
||||
..add(const OneOfSerializer())
|
||||
..add(const AnyOfSerializer())
|
||||
..add(const OffsetDateSerializer())
|
||||
..add(const OffsetDateTimeSerializer())
|
||||
).build();
|
||||
|
||||
Serializers standardSerializers =
|
||||
(serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();
|
@ -0,0 +1,21 @@
|
||||
name: openapi
|
||||
version: 1.0.0
|
||||
description: OpenAPI API client
|
||||
homepage: homepage
|
||||
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.0 <4.0.0'
|
||||
|
||||
dependencies:
|
||||
dio: '^5.7.0'
|
||||
one_of: '>=1.5.0 <2.0.0'
|
||||
one_of_serializer: '>=1.5.0 <2.0.0'
|
||||
built_value: '>=8.4.0 <9.0.0'
|
||||
built_collection: '>=5.1.1 <6.0.0'
|
||||
time_machine: ^0.9.17
|
||||
|
||||
dev_dependencies:
|
||||
built_value_generator: '>=8.4.0 <9.0.0'
|
||||
build_runner: any
|
||||
test: '^1.16.0'
|
@ -0,0 +1,26 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for ApiResponse
|
||||
void main() {
|
||||
final instance = ApiResponseBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(ApiResponse, () {
|
||||
// int code
|
||||
test('to test the property `code`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String type
|
||||
test('to test the property `type`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String message
|
||||
test('to test the property `message`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Category
|
||||
void main() {
|
||||
final instance = CategoryBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Category, () {
|
||||
// int id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String name
|
||||
test('to test the property `name`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Order
|
||||
void main() {
|
||||
final instance = OrderBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Order, () {
|
||||
// int id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// int petId
|
||||
test('to test the property `petId`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// int quantity
|
||||
test('to test the property `quantity`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// OffsetDateTime shipDate
|
||||
test('to test the property `shipDate`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Order Status
|
||||
// String status
|
||||
test('to test the property `status`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// bool complete (default value: false)
|
||||
test('to test the property `complete`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
|
||||
/// tests for PetApi
|
||||
void main() {
|
||||
final instance = Openapi().getPetApi();
|
||||
|
||||
group(PetApi, () {
|
||||
// Add a new pet to the store
|
||||
//
|
||||
//
|
||||
//
|
||||
//Future<Pet> addPet(Pet pet) 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<BuiltList<Pet>> findPetsByStatus(BuiltList<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<BuiltList<Pet>> findPetsByTags(BuiltList<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<Pet> updatePet(Pet pet) 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
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Pet
|
||||
void main() {
|
||||
final instance = PetBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Pet, () {
|
||||
// int id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Category category
|
||||
test('to test the property `category`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String name
|
||||
test('to test the property `name`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// BuiltList<String> photoUrls
|
||||
test('to test the property `photoUrls`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// BuiltList<Tag> tags
|
||||
test('to test the property `tags`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// pet status in the store
|
||||
// String status
|
||||
test('to test the property `status`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
|
||||
/// tests for StoreApi
|
||||
void main() {
|
||||
final instance = Openapi().getStoreApi();
|
||||
|
||||
group(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<BuiltMap<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 generate exceptions
|
||||
//
|
||||
//Future<Order> getOrderById(int orderId) async
|
||||
test('test getOrderById', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Place an order for a pet
|
||||
//
|
||||
//
|
||||
//
|
||||
//Future<Order> placeOrder(Order order) async
|
||||
test('test placeOrder', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for Tag
|
||||
void main() {
|
||||
final instance = TagBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(Tag, () {
|
||||
// int id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String name
|
||||
test('to test the property `name`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
|
||||
/// tests for UserApi
|
||||
void main() {
|
||||
final instance = Openapi().getUserApi();
|
||||
|
||||
group(UserApi, () {
|
||||
// Create user
|
||||
//
|
||||
// This can only be done by the logged in user.
|
||||
//
|
||||
//Future createUser(User user) async
|
||||
test('test createUser', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Creates list of users with given input array
|
||||
//
|
||||
//
|
||||
//
|
||||
//Future createUsersWithArrayInput(BuiltList<User> user) async
|
||||
test('test createUsersWithArrayInput', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Creates list of users with given input array
|
||||
//
|
||||
//
|
||||
//
|
||||
//Future createUsersWithListInput(BuiltList<User> user) 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 user) async
|
||||
test('test updateUser', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
// tests for User
|
||||
void main() {
|
||||
final instance = UserBuilder();
|
||||
// TODO add properties to the builder and call build()
|
||||
|
||||
group(User, () {
|
||||
// int id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String username
|
||||
test('to test the property `username`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String firstName
|
||||
test('to test the property `firstName`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String lastName
|
||||
test('to test the property `lastName`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String email
|
||||
test('to test the property `email`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String password
|
||||
test('to test the property `password`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String phone
|
||||
test('to test the property `phone`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// User Status
|
||||
// int userStatus
|
||||
test('to test the property `userStatus`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user