forked from loafle/openapi-generator-original
Compare commits
2 Commits
master
...
dart-oneof
Author | SHA1 | Date | |
---|---|---|---|
|
526f1b48f8 | ||
|
eaa01e15f1 |
@ -1,6 +1,6 @@
|
||||
generatorName: dart
|
||||
outputDir: samples/client/petstore/dart2/petstore_client_lib
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart2
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
|
@ -107,6 +107,12 @@ class {{classname}} {
|
||||
{{/complexType}}
|
||||
{{/isDate}}
|
||||
{{/isDateTime}}
|
||||
{{#required}}
|
||||
{{^isNullable}}
|
||||
if ({{name}} == null)
|
||||
throw ArgumentError("$json has no {{name}} field which is required for {{classname}}");
|
||||
{{/isNullable}}
|
||||
{{/required}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
|
36
modules/openapi-generator/src/main/resources/dart2/class_oneof.mustache
vendored
Normal file
36
modules/openapi-generator/src/main/resources/dart2/class_oneof.mustache
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
class {{classname}} {
|
||||
/// Can be {{#oneOf}}[{{{.}}}], {{/oneOf}}
|
||||
dynamic _instance;
|
||||
|
||||
// default constructor
|
||||
{{classname}}();
|
||||
|
||||
set instance(dynamic instance) {
|
||||
if (!(instance == null{{#oneOf}} || instance is {{{.}}}{{/oneOf}}))
|
||||
throw ArgumentError("${instance.runtimeType} is not a valid type for {{classname}}");
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
dynamic get instance => _instance;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _instance.toString();
|
||||
}
|
||||
|
||||
{{classname}}.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
// TODO primitives, lists, maps
|
||||
{{#oneOf}}
|
||||
try {
|
||||
_instance = {{{.}}}.fromJson(json);
|
||||
} on ArgumentError {
|
||||
}
|
||||
{{/oneOf}}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
// TODO primitives, lists, maps
|
||||
return _instance.toJson();
|
||||
}
|
||||
}
|
@ -2,11 +2,18 @@ part of {{pubName}}.api;
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#oneOf}}
|
||||
{{#-first}}
|
||||
{{>class_oneof}}
|
||||
{{/-first}}
|
||||
{{/oneOf}}
|
||||
{{^oneOf}}
|
||||
{{#isEnum}}
|
||||
{{>enum}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{>class}}
|
||||
{{/isEnum}}
|
||||
{{/oneOf}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -0,0 +1,740 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: 'http://petstore.swagger.io/v2'
|
||||
info:
|
||||
description: >-
|
||||
This is a sample server Petstore server. For this sample, you can use the api key
|
||||
`special-key` to test the authorization filters.
|
||||
version: 1.0.0
|
||||
title: OpenAPI Petstore
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: ''
|
||||
operationId: updatePet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
'405':
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
/pet/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by tags
|
||||
description: >-
|
||||
Multiple tags can be provided with comma separated strings. Use tag1,
|
||||
tag2, tag3 for testing.
|
||||
operationId: findPetsByTags
|
||||
parameters:
|
||||
- name: tags
|
||||
in: query
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
deprecated: true
|
||||
'/pet/{petId}':
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Updates a pet in the store with form data
|
||||
description: ''
|
||||
operationId: updatePetWithForm
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet that needs to be updated
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
'/pet/{petId}/uploadImage':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFile
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
type: string
|
||||
format: binary
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Returns pet inventories by status
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int32
|
||||
security:
|
||||
- api_key: []
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- store
|
||||
summary: Place an order for a pet
|
||||
description: ''
|
||||
operationId: placeOrder
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
'/store/order/{orderId}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values
|
||||
will generated exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
maximum: 5
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
delete:
|
||||
tags:
|
||||
- store
|
||||
summary: Delete purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value < 1000. Anything above
|
||||
1000 or nonintegers will generate API errors
|
||||
operationId: deleteOrder
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Create user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Created user object
|
||||
required: true
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithArrayInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithListInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs user into the system
|
||||
description: ''
|
||||
operationId: loginUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
description: The user name for login
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
headers:
|
||||
Set-Cookie:
|
||||
description: >-
|
||||
Cookie authentication key for use with the `api_key`
|
||||
apiKey authentication.
|
||||
schema:
|
||||
type: string
|
||||
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
|
||||
X-Rate-Limit:
|
||||
description: calls per hour allowed by the user
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
X-Expires-After:
|
||||
description: date in UTC when toekn expires
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: string
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'400':
|
||||
description: Invalid username/password supplied
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs out current logged in user session
|
||||
description: ''
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
'/user/{username}':
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Get user by user name
|
||||
description: ''
|
||||
operationId: getUserByName
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be fetched. Use user1 for testing.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
tags:
|
||||
- user
|
||||
summary: Updated user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: name that need to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid user supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Updated user object
|
||||
required: true
|
||||
delete:
|
||||
tags:
|
||||
- user
|
||||
summary: Delete user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
components:
|
||||
requestBodies:
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: List of user object
|
||||
required: true
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
|
||||
scopes:
|
||||
'write:pets': modify pets in your account
|
||||
'read:pets': read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
||||
schemas:
|
||||
Order:
|
||||
title: Pet Order
|
||||
description: An order for a pets from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
title: Pet category
|
||||
description: A category for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
title: a User
|
||||
description: A User who is purchasing from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
title: Pet Tag
|
||||
description: A tag for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
title: a Pet
|
||||
description: A pet for sale in the pet store
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
title: An uploaded response
|
||||
description: Describes the result of uploading an image resource
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
OneOfTest:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Pet'
|
||||
- $ref: '#/components/schemas/User'
|
@ -3,6 +3,9 @@
|
||||
README.md
|
||||
doc/ApiResponse.md
|
||||
doc/Category.md
|
||||
doc/InlineObject.md
|
||||
doc/InlineObject1.md
|
||||
doc/OneOfTest.md
|
||||
doc/Order.md
|
||||
doc/Pet.md
|
||||
doc/PetApi.md
|
||||
@ -25,6 +28,9 @@ lib/auth/http_bearer_auth.dart
|
||||
lib/auth/oauth.dart
|
||||
lib/model/api_response.dart
|
||||
lib/model/category.dart
|
||||
lib/model/inline_object.dart
|
||||
lib/model/inline_object1.dart
|
||||
lib/model/one_of_test.dart
|
||||
lib/model/order.dart
|
||||
lib/model/pet.dart
|
||||
lib/model/tag.dart
|
||||
|
@ -43,10 +43,11 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = PetApi();
|
||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
var pet = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.addPet(body);
|
||||
var result = api_instance.addPet(pet);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->addPet: $e\n");
|
||||
}
|
||||
@ -85,6 +86,9 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- [ApiResponse](doc//ApiResponse.md)
|
||||
- [Category](doc//Category.md)
|
||||
- [InlineObject](doc//InlineObject.md)
|
||||
- [InlineObject1](doc//InlineObject1.md)
|
||||
- [OneOfTest](doc//OneOfTest.md)
|
||||
- [Order](doc//Order.md)
|
||||
- [Pet](doc//Pet.md)
|
||||
- [Tag](doc//Tag.md)
|
||||
|
@ -0,0 +1,16 @@
|
||||
# openapi.model.InlineObject
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **String** | Updated name of the pet | [optional]
|
||||
**status** | **String** | Updated status of the pet | [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.InlineObject1
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**file** | [**MultipartFile**](File.md) | file to upload | [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,27 @@
|
||||
# openapi.model.OneOfTest
|
||||
|
||||
## 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** | **List<String>** | | [default to const []]
|
||||
**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []]
|
||||
**status** | **String** | pet status in the store | [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)
|
||||
|
||||
|
@ -20,7 +20,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
> Pet addPet(pet)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
@ -31,10 +31,11 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = PetApi();
|
||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
var pet = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.addPet(body);
|
||||
var result = api_instance.addPet(pet);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->addPet: $e\n");
|
||||
}
|
||||
@ -44,11 +45,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@ -57,7 +58,7 @@ void (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: 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)
|
||||
|
||||
@ -243,7 +244,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
> Pet updatePet(pet)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
@ -254,10 +255,11 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
var api_instance = PetApi();
|
||||
var body = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
var pet = Pet(); // Pet | Pet object that needs to be added to the store
|
||||
|
||||
try {
|
||||
api_instance.updatePet(body);
|
||||
var result = api_instance.updatePet(pet);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling PetApi->updatePet: $e\n");
|
||||
}
|
||||
@ -267,11 +269,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@ -280,7 +282,7 @@ void (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: 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)
|
||||
|
||||
|
@ -144,7 +144,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(body)
|
||||
> Order placeOrder(order)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
@ -153,10 +153,10 @@ Place an order for a pet
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
var api_instance = StoreApi();
|
||||
var body = Order(); // Order | order placed for purchasing the pet
|
||||
var order = Order(); // Order | order placed for purchasing the pet
|
||||
|
||||
try {
|
||||
var result = api_instance.placeOrder(body);
|
||||
var result = api_instance.placeOrder(order);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling StoreApi->placeOrder: $e\n");
|
||||
@ -167,7 +167,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -179,7 +179,7 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **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)
|
||||
|
@ -20,7 +20,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(body)
|
||||
> createUser(user)
|
||||
|
||||
Create user
|
||||
|
||||
@ -29,12 +29,16 @@ 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
var body = User(); // User | Created user object
|
||||
var user = User(); // User | Created user object
|
||||
|
||||
try {
|
||||
api_instance.createUser(body);
|
||||
api_instance.createUser(user);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUser: $e\n");
|
||||
}
|
||||
@ -44,7 +48,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -52,29 +56,33 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **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(body)
|
||||
> 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
var body = [List<User>()]; // List<User> | List of user object
|
||||
var user = [List<User>()]; // List<User> | List of user object
|
||||
|
||||
try {
|
||||
api_instance.createUsersWithArrayInput(body);
|
||||
api_instance.createUsersWithArrayInput(user);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
|
||||
}
|
||||
@ -84,7 +92,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
**user** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -92,29 +100,33 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **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(body)
|
||||
> 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
var body = [List<User>()]; // List<User> | List of user object
|
||||
var user = [List<User>()]; // List<User> | List of user object
|
||||
|
||||
try {
|
||||
api_instance.createUsersWithListInput(body);
|
||||
api_instance.createUsersWithListInput(user);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->createUsersWithListInput: $e\n");
|
||||
}
|
||||
@ -124,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
**user** | [**List<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -132,11 +144,11 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **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)
|
||||
@ -151,6 +163,10 @@ 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
var username = username_example; // String | The name that needs to be deleted
|
||||
@ -174,7 +190,7 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@ -275,6 +291,10 @@ 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
|
||||
@ -294,7 +314,7 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@ -304,7 +324,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(username, body)
|
||||
> updateUser(username, user)
|
||||
|
||||
Updated user
|
||||
|
||||
@ -313,13 +333,17 @@ 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';
|
||||
|
||||
var api_instance = UserApi();
|
||||
var username = username_example; // String | name that need to be deleted
|
||||
var body = User(); // User | Updated user object
|
||||
var user = User(); // User | Updated user object
|
||||
|
||||
try {
|
||||
api_instance.updateUser(username, body);
|
||||
api_instance.updateUser(username, user);
|
||||
} catch (e) {
|
||||
print("Exception when calling UserApi->updateUser: $e\n");
|
||||
}
|
||||
@ -330,7 +354,7 @@ try {
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -338,11 +362,11 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **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)
|
||||
|
@ -21,6 +21,9 @@ part 'api/user_api.dart';
|
||||
|
||||
part 'model/api_response.dart';
|
||||
part 'model/category.dart';
|
||||
part 'model/inline_object.dart';
|
||||
part 'model/inline_object1.dart';
|
||||
part 'model/one_of_test.dart';
|
||||
part 'model/order.dart';
|
||||
part 'model/pet.dart';
|
||||
part 'model/tag.dart';
|
||||
|
@ -10,12 +10,12 @@ class PetApi {
|
||||
/// Add a new pet to the store with HTTP info returned
|
||||
///
|
||||
///
|
||||
Future addPetWithHttpInfo(Pet body) async {
|
||||
Object postBody = body;
|
||||
Future<Response> addPetWithHttpInfo(Pet pet) async {
|
||||
Object postBody = pet;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(pet == null) {
|
||||
throw ApiException(400, "Missing required param: pet");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -53,16 +53,17 @@ class PetApi {
|
||||
|
||||
/// Add a new pet to the store
|
||||
///
|
||||
///Pet body (required):
|
||||
///Pet pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
///
|
||||
Future addPet(Pet body) async {
|
||||
Response response = await addPetWithHttpInfo(body);
|
||||
Future<Pet> addPet(Pet pet) async {
|
||||
Response response = await addPetWithHttpInfo(pet);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
||||
} else {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,12 +314,12 @@ class PetApi {
|
||||
/// Update an existing pet with HTTP info returned
|
||||
///
|
||||
///
|
||||
Future updatePetWithHttpInfo(Pet body) async {
|
||||
Object postBody = body;
|
||||
Future<Response> updatePetWithHttpInfo(Pet pet) async {
|
||||
Object postBody = pet;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(pet == null) {
|
||||
throw ApiException(400, "Missing required param: pet");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -356,16 +357,17 @@ class PetApi {
|
||||
|
||||
/// Update an existing pet
|
||||
///
|
||||
///Pet body (required):
|
||||
///Pet pet (required):
|
||||
/// Pet object that needs to be added to the store
|
||||
///
|
||||
Future updatePet(Pet body) async {
|
||||
Response response = await updatePetWithHttpInfo(body);
|
||||
Future<Pet> updatePet(Pet pet) async {
|
||||
Response response = await updatePetWithHttpInfo(pet);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet;
|
||||
} else {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,12 +185,12 @@ class StoreApi {
|
||||
/// Place an order for a pet with HTTP info returned
|
||||
///
|
||||
///
|
||||
Future<Response> placeOrderWithHttpInfo(Order body) async {
|
||||
Object postBody = body;
|
||||
Future<Response> placeOrderWithHttpInfo(Order order) async {
|
||||
Object postBody = order;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(order == null) {
|
||||
throw ApiException(400, "Missing required param: order");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -201,7 +201,7 @@ class StoreApi {
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
List<String> contentTypes = ["application/json"];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
@ -228,11 +228,11 @@ class StoreApi {
|
||||
|
||||
/// Place an order for a pet
|
||||
///
|
||||
///Order body (required):
|
||||
///Order order (required):
|
||||
/// order placed for purchasing the pet
|
||||
///
|
||||
Future<Order> placeOrder(Order body) async {
|
||||
Response response = await placeOrderWithHttpInfo(body);
|
||||
Future<Order> placeOrder(Order order) async {
|
||||
Response response = await placeOrderWithHttpInfo(order);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
|
@ -10,12 +10,12 @@ class UserApi {
|
||||
/// Create user with HTTP info returned
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future createUserWithHttpInfo(User body) async {
|
||||
Object postBody = body;
|
||||
Future createUserWithHttpInfo(User user) async {
|
||||
Object postBody = user;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(user == null) {
|
||||
throw ApiException(400, "Missing required param: user");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -26,10 +26,10 @@ class UserApi {
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
List<String> contentTypes = ["application/json"];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -53,11 +53,11 @@ class UserApi {
|
||||
|
||||
/// Create user
|
||||
///
|
||||
///User body (required):
|
||||
///User user (required):
|
||||
/// Created user object
|
||||
/// This can only be done by the logged in user.
|
||||
Future createUser(User body) async {
|
||||
Response response = await createUserWithHttpInfo(body);
|
||||
Future createUser(User user) async {
|
||||
Response response = await createUserWithHttpInfo(user);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
@ -69,12 +69,12 @@ class UserApi {
|
||||
/// Creates list of users with given input array with HTTP info returned
|
||||
///
|
||||
///
|
||||
Future createUsersWithArrayInputWithHttpInfo(List<User> body) async {
|
||||
Object postBody = body;
|
||||
Future createUsersWithArrayInputWithHttpInfo(List<User> user) async {
|
||||
Object postBody = user;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(user == null) {
|
||||
throw ApiException(400, "Missing required param: user");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -85,10 +85,10 @@ class UserApi {
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
List<String> contentTypes = ["application/json"];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -112,11 +112,11 @@ class UserApi {
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///List<User> body (required):
|
||||
///List<User> user (required):
|
||||
/// List of user object
|
||||
///
|
||||
Future createUsersWithArrayInput(List<User> body) async {
|
||||
Response response = await createUsersWithArrayInputWithHttpInfo(body);
|
||||
Future createUsersWithArrayInput(List<User> user) async {
|
||||
Response response = await createUsersWithArrayInputWithHttpInfo(user);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
@ -128,12 +128,12 @@ class UserApi {
|
||||
/// Creates list of users with given input array with HTTP info returned
|
||||
///
|
||||
///
|
||||
Future createUsersWithListInputWithHttpInfo(List<User> body) async {
|
||||
Object postBody = body;
|
||||
Future createUsersWithListInputWithHttpInfo(List<User> user) async {
|
||||
Object postBody = user;
|
||||
|
||||
// verify required params are set
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(user == null) {
|
||||
throw ApiException(400, "Missing required param: user");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -144,10 +144,10 @@ class UserApi {
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
List<String> contentTypes = ["application/json"];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -171,11 +171,11 @@ class UserApi {
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///List<User> body (required):
|
||||
///List<User> user (required):
|
||||
/// List of user object
|
||||
///
|
||||
Future createUsersWithListInput(List<User> body) async {
|
||||
Response response = await createUsersWithListInputWithHttpInfo(body);
|
||||
Future createUsersWithListInput(List<User> user) async {
|
||||
Response response = await createUsersWithListInputWithHttpInfo(user);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
@ -206,7 +206,7 @@ class UserApi {
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -389,7 +389,7 @@ class UserApi {
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -427,15 +427,15 @@ class UserApi {
|
||||
/// Updated user with HTTP info returned
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future updateUserWithHttpInfo(String username, User body) async {
|
||||
Object postBody = body;
|
||||
Future updateUserWithHttpInfo(String username, User user) async {
|
||||
Object postBody = user;
|
||||
|
||||
// verify required params are set
|
||||
if(username == null) {
|
||||
throw ApiException(400, "Missing required param: username");
|
||||
}
|
||||
if(body == null) {
|
||||
throw ApiException(400, "Missing required param: body");
|
||||
if(user == null) {
|
||||
throw ApiException(400, "Missing required param: user");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@ -446,10 +446,10 @@ class UserApi {
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
List<String> contentTypes = ["application/json"];
|
||||
|
||||
String nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
List<String> authNames = [];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(nullableContentType != null && nullableContentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@ -475,11 +475,11 @@ class UserApi {
|
||||
///
|
||||
///String username (required):
|
||||
/// name that need to be deleted
|
||||
///User body (required):
|
||||
///User user (required):
|
||||
/// Updated user object
|
||||
/// This can only be done by the logged in user.
|
||||
Future updateUser(String username, User body) async {
|
||||
Response response = await updateUserWithHttpInfo(username, body);
|
||||
Future updateUser(String username, User user) async {
|
||||
Response response = await updateUserWithHttpInfo(username, user);
|
||||
if(response.statusCode >= 400) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
} else if(response.body != null) {
|
||||
|
@ -43,6 +43,12 @@ class ApiClient {
|
||||
return ApiResponse.fromJson(value);
|
||||
case 'Category':
|
||||
return Category.fromJson(value);
|
||||
case 'InlineObject':
|
||||
return InlineObject.fromJson(value);
|
||||
case 'InlineObject1':
|
||||
return InlineObject1.fromJson(value);
|
||||
case 'OneOfTest':
|
||||
return OneOfTest.fromJson(value);
|
||||
case 'Order':
|
||||
return Order.fromJson(value);
|
||||
case 'Pet':
|
||||
|
@ -0,0 +1,57 @@
|
||||
part of openapi.api;
|
||||
|
||||
class InlineObject {
|
||||
/// Updated name of the pet
|
||||
String name;
|
||||
/// Updated status of the pet
|
||||
String status;
|
||||
|
||||
InlineObject({
|
||||
this.name,
|
||||
this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InlineObject[name=$name, status=$status, ]';
|
||||
}
|
||||
|
||||
InlineObject.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
name = json['name'];
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> json = {};
|
||||
if (name != null)
|
||||
json['name'] = name;
|
||||
if (status != null)
|
||||
json['status'] = status;
|
||||
return json;
|
||||
}
|
||||
|
||||
static List<InlineObject> listFromJson(List<dynamic> json) {
|
||||
return json == null ? List<InlineObject>() : json.map((value) => InlineObject.fromJson(value)).toList();
|
||||
}
|
||||
|
||||
static Map<String, InlineObject> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = Map<String, InlineObject>();
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic value) => map[key] = InlineObject.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of InlineObject-objects as value to a dart map
|
||||
static Map<String, List<InlineObject>> mapListFromJson(Map<String, dynamic> json) {
|
||||
final map = Map<String, List<InlineObject>>();
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic value) {
|
||||
map[key] = InlineObject.listFromJson(value);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
part of openapi.api;
|
||||
|
||||
class InlineObject1 {
|
||||
/// Additional data to pass to server
|
||||
String additionalMetadata;
|
||||
/// file to upload
|
||||
MultipartFile file;
|
||||
|
||||
InlineObject1({
|
||||
this.additionalMetadata,
|
||||
this.file,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InlineObject1[additionalMetadata=$additionalMetadata, file=$file, ]';
|
||||
}
|
||||
|
||||
InlineObject1.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
additionalMetadata = json['additionalMetadata'];
|
||||
file = (json['file'] == null) ?
|
||||
null :
|
||||
File.fromJson(json['file']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> json = {};
|
||||
if (additionalMetadata != null)
|
||||
json['additionalMetadata'] = additionalMetadata;
|
||||
if (file != null)
|
||||
json['file'] = file;
|
||||
return json;
|
||||
}
|
||||
|
||||
static List<InlineObject1> listFromJson(List<dynamic> json) {
|
||||
return json == null ? List<InlineObject1>() : json.map((value) => InlineObject1.fromJson(value)).toList();
|
||||
}
|
||||
|
||||
static Map<String, InlineObject1> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = Map<String, InlineObject1>();
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic value) => map[key] = InlineObject1.fromJson(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of InlineObject1-objects as value to a dart map
|
||||
static Map<String, List<InlineObject1>> mapListFromJson(Map<String, dynamic> json) {
|
||||
final map = Map<String, List<InlineObject1>>();
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic value) {
|
||||
map[key] = InlineObject1.listFromJson(value);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
part of openapi.api;
|
||||
|
||||
class OneOfTest {
|
||||
/// Can be [Pet], [User],
|
||||
dynamic _instance;
|
||||
|
||||
// default constructor
|
||||
OneOfTest();
|
||||
|
||||
set instance(dynamic instance) {
|
||||
if (!(instance == null || instance is Pet || instance is User))
|
||||
throw ArgumentError("${instance.runtimeType} is not a valid type for OneOfTest");
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
dynamic get instance => _instance;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _instance.toString();
|
||||
}
|
||||
|
||||
OneOfTest.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
// TODO primitives, lists, maps
|
||||
try {
|
||||
_instance = Pet.fromJson(json);
|
||||
} on ArgumentError {
|
||||
}
|
||||
try {
|
||||
_instance = User.fromJson(json);
|
||||
} on ArgumentError {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
// TODO primitives, lists, maps
|
||||
return _instance.toJson();
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,13 @@ class Pet {
|
||||
null :
|
||||
Category.fromJson(json['category']);
|
||||
name = json['name'];
|
||||
if (name == null)
|
||||
throw ArgumentError("$json has no name field which is required for Pet");
|
||||
photoUrls = (json['photoUrls'] == null) ?
|
||||
null :
|
||||
(json['photoUrls'] as List).cast<String>();
|
||||
if (photoUrls == null)
|
||||
throw ArgumentError("$json has no photoUrls field which is required for Pet");
|
||||
tags = (json['tags'] == null) ?
|
||||
null :
|
||||
Tag.listFromJson(json['tags']);
|
||||
|
@ -0,0 +1,24 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for InlineObject1
|
||||
void main() {
|
||||
var instance = new InlineObject1();
|
||||
|
||||
group('test InlineObject1', () {
|
||||
// Additional data to pass to server
|
||||
// String additionalMetadata
|
||||
test('to test the property `additionalMetadata`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// file to upload
|
||||
// MultipartFile file
|
||||
test('to test the property `file`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for InlineObject
|
||||
void main() {
|
||||
var instance = new InlineObject();
|
||||
|
||||
group('test InlineObject', () {
|
||||
// Updated name of the pet
|
||||
// String name
|
||||
test('to test the property `name`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// Updated status of the pet
|
||||
// String status
|
||||
test('to test the property `status`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for OneOfTest
|
||||
void main() {
|
||||
var instance = new OneOfTest();
|
||||
|
||||
group('test OneOfTest', () {
|
||||
// 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
|
||||
});
|
||||
|
||||
// List<String> photoUrls (default value: const [])
|
||||
test('to test the property `photoUrls`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<Tag> tags (default value: const [])
|
||||
test('to test the property `tags`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// pet status in the store
|
||||
// String status
|
||||
test('to test the property `status`', () 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