update dart jaguar samples

This commit is contained in:
William Cheng 2019-08-13 19:00:10 +08:00
parent d04e16a255
commit 93aedcf3d5
23 changed files with 74 additions and 73 deletions

View File

@ -57,6 +57,7 @@ declare -a scripts=(
"./bin/groovy-petstore.sh"
"./bin/apex-petstore.sh"
"./bin/perl-petstore-all.sh"
"./bin/dart-jaguar-petstore.sh"
#"./bin/elm-petstore-all.sh"
"./bin/meta-codegen.sh"
# OTHERS

View File

@ -54,7 +54,7 @@ import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
final jaguarApiGen = JaguarApiGen();
final jaguarApiGen = Openapi();
var api_instance = jaguarApiGen.getPetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store

View File

@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](List.md)| List of user object |
**body** | [**List<User>**](User.md)| List of user object |
### Return type
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](List.md)| List of user object |
**body** | [**List<User>**](User.md)| List of user object |
### Return type

View File

@ -29,7 +29,7 @@ final _jsonJaguarRepo = JsonRepo()
..add(TagSerializer())
..add(UserSerializer())
;
final Map<String, CodecRepo> _converters = {
final Map<String, CodecRepo> defaultConverters = {
MimeTypes.json: _jsonJaguarRepo,
};
@ -37,7 +37,7 @@ final Map<String, CodecRepo> _converters = {
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
class JaguarApiGen {
class Openapi {
List<Interceptor> interceptors;
String basePath = "http://petstore.swagger.io/v2";
Route _baseRoute;
@ -46,7 +46,7 @@ class JaguarApiGen {
/**
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
JaguarApiGen({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
@ -86,7 +86,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return PetApi(base: base, converters: converters, timeout: timeout);
}
@ -101,7 +101,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return StoreApi(base: base, converters: converters, timeout: timeout);
}
@ -116,7 +116,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return UserApi(base: base, converters: converters, timeout: timeout);
}

View File

@ -5,13 +5,13 @@ part 'api_response.jser.dart';
class ApiResponse {
@Alias('code')
@Alias('code', isNullable: false)
final int code;
@Alias('type')
@Alias('type', isNullable: false)
final String type;
@Alias('message')
@Alias('message', isNullable: false)
final String message;

View File

@ -5,10 +5,10 @@ part 'category.jser.dart';
class Category {
@Alias('id')
@Alias('id', isNullable: false)
final int id;
@Alias('name')
@Alias('name', isNullable: false)
final String name;

View File

@ -5,22 +5,22 @@ part 'order.jser.dart';
class Order {
@Alias('id')
@Alias('id', isNullable: false)
final int id;
@Alias('petId')
@Alias('petId', isNullable: false)
final int petId;
@Alias('quantity')
@Alias('quantity', isNullable: false)
final int quantity;
@Alias('shipDate')
@Alias('shipDate', isNullable: false)
final DateTime shipDate;
/* Order Status */
@Alias('status')
@Alias('status', isNullable: false)
final String status;
//enum statusEnum { placed, approved, delivered, };
@Alias('complete')
@Alias('complete', isNullable: false)
final bool complete;

View File

@ -9,22 +9,22 @@ part 'pet.jser.dart';
class Pet {
@Alias('id')
@Alias('id', isNullable: false)
final int id;
@Alias('category')
@Alias('category', isNullable: false)
final Category category;
@Alias('name')
@Alias('name', isNullable: false)
final String name;
@Alias('photoUrls')
@Alias('photoUrls', isNullable: false)
final List<String> photoUrls;
@Alias('tags')
@Alias('tags', isNullable: false)
final List<Tag> tags;
/* pet status in the store */
@Alias('status')
@Alias('status', isNullable: false)
final String status;
//enum statusEnum { available, pending, sold, };

View File

@ -5,10 +5,10 @@ part 'tag.jser.dart';
class Tag {
@Alias('id')
@Alias('id', isNullable: false)
final int id;
@Alias('name')
@Alias('name', isNullable: false)
final String name;

View File

@ -5,28 +5,28 @@ part 'user.jser.dart';
class User {
@Alias('id')
@Alias('id', isNullable: false)
final int id;
@Alias('username')
@Alias('username', isNullable: false)
final String username;
@Alias('firstName')
@Alias('firstName', isNullable: false)
final String firstName;
@Alias('lastName')
@Alias('lastName', isNullable: false)
final String lastName;
@Alias('email')
@Alias('email', isNullable: false)
final String email;
@Alias('password')
@Alias('password', isNullable: false)
final String password;
@Alias('phone')
@Alias('phone', isNullable: false)
final String phone;
/* User Status */
@Alias('userStatus')
@Alias('userStatus', isNullable: false)
final int userStatus;

View File

@ -4,9 +4,9 @@ description: OpenAPI API client
environment:
sdk: ">=2.0.0 <3.0.0"
dependencies:
jaguar_retrofit: '^2.8.2'
jaguar_serializer: '^2.2.6'
jaguar_retrofit: ^2.8.8
jaguar_serializer: ^2.2.12
dev_dependencies:
jaguar_retrofit_gen: '^2.8.5'
jaguar_serializer_cli: '^2.2.5'
build_runner: '^1.1.1'
jaguar_retrofit_gen: ^2.8.10
jaguar_serializer_cli: ^2.2.8
build_runner: ^1.6.5

View File

@ -54,7 +54,7 @@ import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
final jaguarApiGen = JaguarApiGen();
final jaguarApiGen = Openapi();
var api_instance = jaguarApiGen.getPetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store

View File

@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type

View File

@ -39,7 +39,7 @@ final _jsonJaguarRepo = ProtoCodecRepo(isJsonFormatEnabled: true)
..add((data) => Tag.fromBuffer(List<int>.from(data)))
..add((data) => User.fromBuffer(List<int>.from(data)))
;
final Map<String, CodecRepo> _converters = {
final Map<String, CodecRepo> defaultConverters = {
MimeTypes.json: _jsonJaguarRepo,
MimeTypes.binary: _protoJaguarRepo,
};
@ -47,7 +47,7 @@ final Map<String, CodecRepo> _converters = {
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
class JaguarApiGen {
class Openapi {
List<Interceptor> interceptors;
String basePath = "http://petstore.swagger.io/v2";
Route _baseRoute;
@ -56,7 +56,7 @@ class JaguarApiGen {
/**
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
JaguarApiGen({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
@ -96,7 +96,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return PetApi(base: base, converters: converters, timeout: timeout);
}
@ -111,7 +111,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return StoreApi(base: base, converters: converters, timeout: timeout);
}
@ -126,7 +126,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return UserApi(base: base, converters: converters, timeout: timeout);
}

View File

@ -4,9 +4,9 @@ description: OpenAPI API client
environment:
sdk: ">=2.0.0 <3.0.0"
dependencies:
jaguar_retrofit: '^2.8.2'
jaguar_serializer_protobuf: '^2.2.2'
jaguar_mimetype: '^1.0.1'
jaguar_retrofit: ^2.8.8
jaguar_serializer_protobuf: ^2.2.2
jaguar_mimetype: ^1.0.1
dev_dependencies:
jaguar_retrofit_gen: '^2.8.5'
build_runner: '^1.1.1'
jaguar_retrofit_gen: ^2.8.10
build_runner: ^1.6.5

View File

@ -1 +1 @@
unset
4.1.1-SNAPSHOT

View File

@ -1 +1 @@
4.0.1-SNAPSHOT
4.1.1-SNAPSHOT

View File

@ -54,7 +54,7 @@ import 'package:openapi/api.dart';
// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
final jaguarApiGen = JaguarApiGen();
final jaguarApiGen = Openapi();
var api_instance = jaguarApiGen.getPetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store

View File

@ -84,7 +84,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
@ -124,7 +124,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](List.md)| List of user object |
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type

View File

@ -39,7 +39,7 @@ final _jsonJaguarRepo = ProtoCodecRepo(isJsonFormatEnabled: true)
..add((data) => Tag.fromBuffer(List<int>.from(data)))
..add((data) => User.fromBuffer(List<int>.from(data)))
;
final Map<String, CodecRepo> _converters = {
final Map<String, CodecRepo> defaultConverters = {
MimeTypes.json: _jsonJaguarRepo,
MimeTypes.binary: _protoJaguarRepo,
};
@ -47,7 +47,7 @@ final Map<String, CodecRepo> _converters = {
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
class JaguarApiGen {
class Openapi {
List<Interceptor> interceptors;
String basePath = "http://petstore.swagger.io/v2";
Route _baseRoute;
@ -56,7 +56,7 @@ class JaguarApiGen {
/**
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
JaguarApiGen({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
@ -96,7 +96,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return PetApi(base: base, converters: converters, timeout: timeout);
}
@ -111,7 +111,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return StoreApi(base: base, converters: converters, timeout: timeout);
}
@ -126,7 +126,7 @@ class JaguarApiGen {
base = _baseRoute;
}
if(converters == null) {
converters = _converters;
converters = defaultConverters;
}
return UserApi(base: base, converters: converters, timeout: timeout);
}

View File

@ -4,9 +4,9 @@ description: OpenAPI API client
environment:
sdk: ">=2.0.0 <3.0.0"
dependencies:
jaguar_retrofit: '^2.8.2'
jaguar_serializer_protobuf: '^2.2.2'
jaguar_mimetype: '^1.0.1'
jaguar_retrofit: ^2.8.8
jaguar_serializer_protobuf: ^2.2.2
jaguar_mimetype: ^1.0.1
dev_dependencies:
jaguar_retrofit_gen: '^2.8.5'
build_runner: '^1.1.1'
jaguar_retrofit_gen: ^2.8.10
build_runner: ^1.6.5