forked from loafle/openapi-generator-original
* [dart] Cleanup and regnerate old/wrong tests and docs * docs path seems to be doc now in all dart generators * generated tests are very old and use wrong classes * [dart-dio] Improve formatting * [dart][dart-dio] Restructure tests to same layout * remove duplicate/old openapi sample for which there is no generation config * generate to `petstore_client_lib` for both generators * run generated tests as integration tests for dart2 even if empty - this makes it easier to find compile errors * [dart] Improve gitignore handling for Dart generators * globally ignore all dart related files that should not be commited * remove old ignores that are no longer valid * [dart][dart-dio] Add OAS3 generation and integration tests Dart2 doesn't compile, needs fixes. * [dart] Do not attempt to deserialize binary content from JSON fields Not sure if that case is ever relevant but for now there doesn't seem to be a better option. * [dart] Fix integration tests for OAS3 petstore Some POST operations now return 200 with content. * [dart] Generate Petstore Fake API but don't add to integration tests yet Explicitly not adding the new integration tests to the master POM. They do not work but having them allows for quickly iterating on open issues without breaking existing basic OAS2/OAS3 petstore examples. Instead they should be run manually until everything is fixed.
openapi
This is a sample server Petstore server. For this sample, you can use the api key special-key
to test the authorization filters.
This Dart package is automatically generated by the Open API Codegen project:
- API version: 1.0.0
- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen
Requirements
Dart 2 or later OR Flutter 0.7.0 or later.
Once your code is generated, you need to run the build_runner command to let Jaguar implement your API:
flutter packages pub run build_runner build
or
pub run build_runner build
Installation & Usage
Github
If this Dart package is published to Github, please include the following in pubspec.yaml
name: openapi
version: 1.0.0
description: OpenAPI API client
dependencies:
openapi:
git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
version: 'any'
Local
To use the package in your local drive, please include the following in pubspec.yaml
dependencies:
openapi:
path: /path/to/openapi
Tests
TODO
Getting Started
Please follow the installation procedure and then run the following:
import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
final jaguarApiGen = Openapi();
var api_instance = jaguarApiGen.getPetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
api_instance.addPet(body);
} catch (e) {
print("Exception when calling PetApi->addPet: $e\n");
}
Documentation for API Endpoints
All URIs are relative to http://petstore.swagger.io/v2
Class | Method | HTTP request | Description |
---|---|---|---|
PetApi | addPet | Post /pet | Add a new pet to the store |
PetApi | deletePet | Delete /pet/:petId | Deletes a pet |
PetApi | findPetsByStatus | Get /pet/findByStatus | Finds Pets by status |
PetApi | findPetsByTags | Get /pet/findByTags | Finds Pets by tags |
PetApi | getPetById | Get /pet/:petId | Find pet by ID |
PetApi | updatePet | Put /pet | Update an existing pet |
PetApi | updatePetWithForm | Post /pet/:petId | Updates a pet in the store with form data |
PetApi | uploadFile | Post /pet/:petId/uploadImage | uploads an image |
StoreApi | deleteOrder | Delete /store/order/:orderId | Delete purchase order by ID |
StoreApi | getInventory | Get /store/inventory | Returns pet inventories by status |
StoreApi | getOrderById | Get /store/order/:orderId | Find purchase order by ID |
StoreApi | placeOrder | Post /store/order | Place an order for a pet |
UserApi | createUser | Post /user | Create user |
UserApi | createUsersWithArrayInput | Post /user/createWithArray | Creates list of users with given input array |
UserApi | createUsersWithListInput | Post /user/createWithList | Creates list of users with given input array |
UserApi | deleteUser | Delete /user/:username | Delete user |
UserApi | getUserByName | Get /user/:username | Get user by user name |
UserApi | loginUser | Get /user/login | Logs user into the system |
UserApi | logoutUser | Get /user/logout | Logs out current logged in user session |
UserApi | updateUser | Put /user/:username | Updated user |
Documentation For Models
Documentation For Authorization
api_key
- Type: API key
- API key parameter name: api_key
- Location: HTTP header
petstore_auth
- Type: OAuth
- Flow: implicit
- Authorization URL: http://petstore.swagger.io/api/oauth/dialog
- Scopes:
- write:pets: modify pets in your account
- read:pets: read your pets