Dart-jaguar: remove (#10534)

This commit is contained in:
agilob 2021-10-08 03:47:17 +01:00 committed by GitHub
parent 59ddcc31ab
commit 5b1b74e48d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1 additions and 1041 deletions

View File

@ -145,12 +145,6 @@
"Documentation: Cwiki"
]
},
{
"input": "dart-jaguar-petstore.sh",
"matches": [
"Client: Dart"
]
},
{
"input": "dart-dio-petstore.sh",
"matches": [
@ -1401,4 +1395,4 @@
"matches": []
}
]
}
}

3
.gitignore vendored
View File

@ -249,9 +249,6 @@ samples/server/petstore/erlang-server/rebar.lock
**/dart*/**/pubspec.lock
# Dart dio
**/dart*/**/*.g.dart
# Dart jaguar
**/dart*/**/*.jser.dart
**/dart*/**/*.jretro.dart
# JS
samples/client/petstore/javascript-es6/package-lock.json

View File

@ -24,7 +24,6 @@ The following generators are available:
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
* [dart-jaguar (deprecated)](generators/dart-jaguar.md)
* [eiffel](generators/eiffel.md)
* [elixir](generators/elixir.md)
* [elm](generators/elm.md)

View File

@ -15,7 +15,6 @@ The following generators are available:
* [csharp-netcore](csharp-netcore.md)
* [dart](dart.md)
* [dart-dio](dart-dio.md)
* [dart-jaguar](dart-jaguar.md)
* [eiffel](eiffel.md)
* [elixir](elixir.md)
* [elm](elm.md)

View File

@ -1,232 +0,0 @@
---
title: Config Options for dart-jaguar
sidebar_label: dart-jaguar
---
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|nullableFields|Is the null fields should be in the JSON payload| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|pubAuthor|Author name in generated pubspec| |null|
|pubAuthorEmail|Email address of the author in generated pubspec| |null|
|pubDescription|Description in generated pubspec| |null|
|pubHomepage|Homepage in generated pubspec| |null|
|pubLibrary|Library name in generated code| |null|
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|serialization|Choose serialization format JSON or PROTO is supported| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|Source folder for generated code| |null|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>String</li>
<li>bool</li>
<li>double</li>
<li>int</li>
<li>num</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>as</li>
<li>assert</li>
<li>async</li>
<li>await</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>covariant</li>
<li>default</li>
<li>deferred</li>
<li>do</li>
<li>dynamic</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>extension</li>
<li>external</li>
<li>factory</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>get</li>
<li>hide</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>in</li>
<li>inout</li>
<li>interface</li>
<li>is</li>
<li>late</li>
<li>library</li>
<li>mixin</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>of</li>
<li>on</li>
<li>operator</li>
<li>out</li>
<li>part</li>
<li>patch</li>
<li>required</li>
<li>rethrow</li>
<li>return</li>
<li>set</li>
<li>show</li>
<li>source</li>
<li>static</li>
<li>super</li>
<li>switch</li>
<li>sync</li>
<li>this</li>
<li>throw</li>
<li>true</li>
<li>try</li>
<li>typedef</li>
<li>var</li>
<li>void</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✗|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✓|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -26,7 +26,6 @@ org.openapitools.codegen.languages.CSharpNancyFXServerCodegen
org.openapitools.codegen.languages.DartClientCodegen
org.openapitools.codegen.languages.DartDioClientCodegen
org.openapitools.codegen.languages.DartDioNextClientCodegen
org.openapitools.codegen.languages.DartJaguarClientCodegen
org.openapitools.codegen.languages.EiffelClientCodegen
org.openapitools.codegen.languages.ElixirClientCodegen
org.openapitools.codegen.languages.ElmClientCodegen

View File

@ -1,141 +0,0 @@
# {{pubName}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project:
- API version: {{appVersion}}
{{#artifactVersion}}
- Package version: {{.}}
{{/artifactVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## 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:
```sh
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: {{pubName}}
version: {{pubVersion}}
description: {{pubDescription}}
dependencies:
{{pubName}}:
git: https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git
version: 'any'
```
### Local
To use the package in your local drive, please include the following in pubspec.yaml
```
dependencies:
{{pubName}}:
path: /path/to/{{pubName}}
```
## Tests
TODO
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```dart
import 'package:{{pubName}}/api.dart';
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
// TODO Configure HTTP basic authorization: {{{name}}}
//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME';
//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD';
{{/isBasic}}
{{#isApiKey}}
// TODO Configure API key authorization: {{{name}}}
//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer";
{{/isApiKey}}
{{#isOAuth}}
// TODO Configure OAuth2 access token for authorization: {{{name}}}
//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
final jaguarApiGen = {{clientName}}();
var api_instance = jaguarApiGen.get{{classname}}();
{{#allParams}}
var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
{{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
{{#returnType}}
print(result);
{{/returnType}}
} catch (e) {
print("Exception when calling {{classname}}->{{operationId}}: $e\n");
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
## Documentation for API Endpoints
All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation For Models
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md)
{{/model}}{{/models}}
## Documentation For Authorization
{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Author
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}

View File

@ -1,78 +0,0 @@
import 'package:jaguar_retrofit/annotations/annotations.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_mimetype/jaguar_mimetype.dart';
import 'dart:async';
{{#operations}}
{{#modelImports}}import 'package:{{pubName}}/model/{{.}}{{#protoFormat}}.pb{{/protoFormat}}.dart';
{{/modelImports}}
{{#fullImports}}import '{{.}}';
{{/fullImports}}
part '{{classFilename}}.jretro.dart';
@GenApiClient()
class {{classname}} extends ApiClient with _${{classname}}Client {
final Route base;
final Map<String, CodecRepo> converters;
final Duration timeout;
{{classname}}({this.base, this.converters, this.timeout = const Duration(minutes: 2)});
{{#operation}}
/// {{summary}}
///
/// {{notes}}
@{{httpMethod}}Req(path: "{{path}}"{{#hasAuthMethods}}, metadata: {"auth": [{{#authMethods}} {"type": "{{type}}", "name": "{{name}}"{{#isApiKey}}, "keyName": "{{keyParamName}}", "where": "{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}"{{/isApiKey}} }{{^-last}}, {{/-last}}{{/authMethods}}]}{{/hasAuthMethods}})
Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{nickname}}(
{{#pathParams}}
@PathParam("{{baseName}}") {{dataType}} {{paramName}}{{^-last}}, {{/-last}}
{{/pathParams}}
{{#headerParams}}
{{#-first}}{{#hasPathParams}},{{/hasPathParams}}{{/-first}}
@Header("{{baseName}}") {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
{{/headerParams}}
{{#queryParams}}
{{#-first}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/-first}}
@QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
{{/queryParams}}
{{#vendorExtensions}}
{{#formParams}}
{{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}}
{{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsFormField() {{/x-is-form}}{{#x-is-multipart}}@AsMultipartField() {{/x-is-multipart}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
{{/formParams}}
{{#bodyParam}}
{{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}
{{^x-is-proto}}{{^x-is-json}}{{^x-is-form}}{{^x-is-multipart}}@AsBody(){{/x-is-multipart}}{{/x-is-form}}{{/x-is-json}}{{/x-is-proto}} {{#x-is-proto}}@Serialized(MimeTypes.binary) {{/x-is-proto}}{{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsForm() {{/x-is-form}}{{#x-is-multipart}}@AsMultipart() {{/x-is-multipart}}{{{dataType}}} {{paramName}}
{{/bodyParam}}
{{/vendorExtensions}}
) {
return super.{{nickname}}(
{{#pathParams}}
{{paramName}}{{^-last}}, {{/-last}}
{{/pathParams}}
{{#headerParams}}
{{#-first}}{{#hasPathParams}},{{/hasPathParams}}{{/-first}}
{{paramName}}{{^-last}}, {{/-last}}
{{/headerParams}}
{{#queryParams}}
{{#-first}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/-first}}
{{paramName}}{{^-last}}, {{/-last}}
{{/queryParams}}
{{#formParams}}
{{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}}
{{paramName}}{{^-last}}, {{/-last}}
{{/formParams}}
{{#bodyParam}}
{{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}
{{paramName}}
{{/bodyParam}}
).timeout(timeout);
}
{{/operation}}
}
{{/operations}}

View File

@ -1,86 +0,0 @@
# {{pubName}}.api.{{classname}}{{#description}}
{{.}}{{/description}}
## Load the API package
```dart
import 'package:{{pubName}}/api.dart';
```
All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
# **{{{operationId}}}**
> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}})
{{{summary}}}{{#notes}}
{{{.}}}{{/notes}}
### Example
```dart
import 'package:{{pubName}}/api.dart';
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
// TODO Configure HTTP basic authorization: {{{name}}}
//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME';
//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD';
{{/isBasic}}
{{#isApiKey}}
// TODO Configure API key authorization: {{{name}}}
//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer";
{{/isApiKey}}
{{#isOAuth}}
// TODO Configure OAuth2 access token for authorization: {{{name}}}
//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
var api_instance = new {{classname}}();
{{#allParams}}
var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
{{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
{{#returnType}}
print(result);
{{/returnType}}
} catch (e) {
print("Exception when calling {{classname}}->{{operationId}}: $e\n");
}
```
### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}
{{/allParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP request headers
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
[[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)
{{/operation}}
{{/operations}}

View File

@ -1,28 +0,0 @@
import 'package:{{pubName}}/api.dart';
import 'package:test/test.dart';
{{#operations}}
/// tests for {{classname}}
void main() {
var instance = new {{classname}}();
group('tests for {{classname}}', () {
{{#operation}}
{{#summary}}
// {{{.}}}
//
{{/summary}}
{{#notes}}
// {{{.}}}
//
{{/notes}}
//{{#returnType}}Future<{{{.}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async
test('test {{operationId}}', () async {
// TODO
});
{{/operation}}
});
}
{{/operations}}

View File

@ -1,100 +0,0 @@
library {{pubName}}.api;
import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart';
{{#protoFormat}}
import 'package:jaguar_serializer_protobuf/proto_repo.dart';
{{/protoFormat}}
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:{{pubName}}/auth/api_key_auth.dart';
import 'package:{{pubName}}/auth/basic_auth.dart';
import 'package:{{pubName}}/auth/oauth.dart';
import 'package:jaguar_mimetype/jaguar_mimetype.dart';
{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart';
{{/apis}}{{/apiInfo}}
{{#models}}{{#model}}import 'package:{{pubName}}/model/{{classFilename}}{{#protoFormat}}.pb{{/protoFormat}}.dart';
{{/model}}{{/models}}
{{#jsonFormat}}
final _jsonJaguarRepo = JsonRepo()
{{#models}}{{#model}}{{^isEnum}}..add({{classname}}Serializer()){{/isEnum}}
{{/model}}{{/models}};
final Map<String, CodecRepo> defaultConverters = {
MimeTypes.json: _jsonJaguarRepo,
};
{{/jsonFormat}}
{{#protoFormat}}
final _protoJaguarRepo = ProtoCodecRepo()
{{#models}}{{#model}}..add((data) => {{classname}}.fromBuffer(List<int>.from(data)))
{{/model}}{{/models}};
final _jsonJaguarRepo = ProtoCodecRepo(isJsonFormatEnabled: true)
{{#models}}{{#model}}..add((data) => {{classname}}.fromBuffer(List<int>.from(data)))
{{/model}}{{/models}};
final Map<String, CodecRepo> defaultConverters = {
MimeTypes.json: _jsonJaguarRepo,
MimeTypes.binary: _protoJaguarRepo,
};
{{/protoFormat}}
final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
class {{clientName}} {
List<Interceptor> interceptors;
String basePath = "{{basePath}}";
Route _baseRoute;
final Duration timeout;
/**
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/
{{clientName}}({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) {
this.interceptors = _defaultInterceptors;
}
else if(overrideInterceptors){
this.interceptors = interceptors;
}
else {
this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
}
this.interceptors.forEach((interceptor) {
_baseRoute.before(interceptor.before);
_baseRoute.after(interceptor.after);
});
}
void setOAuthToken(String name, String token) {
(_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
}
void setBasicAuth(String name, String username, String password) {
(_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
}
void setApiKey(String name, String apiKey) {
(_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
}
{{#apiInfo}}{{#apis}}
/**
* Get {{classname}} instance, base route and serializer can be overridden by a given but be careful,
* by doing that all interceptors will not be executed
*/
{{classname}} get{{classname}}({Route base, Map<String, CodecRepo> converters}) {
if(base == null) {
base = _baseRoute;
}
if(converters == null) {
converters = defaultConverters;
}
return {{classname}}(base: base, converters: converters, timeout: timeout);
}
{{/apis}}{{/apiInfo}}
}

View File

@ -1,33 +0,0 @@
import 'dart:async';
import 'package:{{pubName}}/auth/auth.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
class ApiKeyAuthInterceptor extends AuthInterceptor {
Map<String, String> apiKeys = {};
@override
FutureOr<void> before(RouteBase route) {
final authInfo = getAuthInfo(route, "apiKey");
for (var info in authInfo) {
final authName = info["name"];
final authKeyName = info["keyName"];
final authWhere = info["where"];
final apiKey = apiKeys[authName];
if(apiKey != null) {
if(authWhere == 'query'){
route.query(authKeyName, apiKey);
}
else {
route.header(authKeyName, apiKey);
}
break;
}
}
return super.before(route);
}
@override
FutureOr after(StringResponse response) {
return Future.value(response);
}
}

View File

@ -1,23 +0,0 @@
import 'dart:async';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
abstract class AuthInterceptor extends Interceptor {
/*
* Get auth information on given route for the given type
* Can return null if type is not present on auth data or if route doesn't need authentication
*/
List<Map<String, dynamic>> getAuthInfo(RouteBase route, String type) {
if (route.metadataMap.containsKey("auth")) {
final auth = route.metadataMap["auth"];
List<Map<String, dynamic>> results = [];
for (var info in auth) {
if(info["type"] == type) {
results.add(info);
}
}
return results;
}
return [];
}
}

View File

@ -1,34 +0,0 @@
import 'dart:async';
import 'package:{{pubName}}/auth/auth.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
class BasicAuthInfo {
final String username;
final String password;
const BasicAuthInfo(this.username, this.password);
}
class BasicAuthInterceptor extends AuthInterceptor {
Map<String, BasicAuthInfo> authInfo = {};
@override
FutureOr<void> before(RouteBase route) {
final metadataAuthInfo = getAuthInfo(route, "basic");
for (var info in metadataAuthInfo) {
final authName = info["name"];
final basicAuthInfo = authInfo[authName];
if(basicAuthInfo != null) {
route.basicAuth(basicAuthInfo.username, basicAuthInfo.password);
break;
}
}
return super.before(route);
}
@override
FutureOr after(StringResponse response) {
return Future.value(response);
}
}

View File

@ -1,25 +0,0 @@
import 'dart:async';
import 'package:{{pubName}}/auth/auth.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart';
class OAuthInterceptor extends AuthInterceptor {
Map<String, String> tokens = {};
@override
FutureOr<void> before(RouteBase route) {
final authInfo = getAuthInfo(route, "oauth");
for (var info in authInfo) {
final token = tokens[info["name"]];
if(token != null) {
route.header("Authorization", "Bearer ${token}");
break;
}
}
return super.before(route);
}
@override
FutureOr after(StringResponse response) {
return Future.value(response);
}
}

View File

@ -1,41 +0,0 @@
{{#protoFormat}}
message {{classname}} {
{{#vars}}
{{#vendorExtensions}}{{{x-proto-type}}} {{name}} = {{x-index}}{{/vendorExtensions}};
{{/vars}}
}
{{/protoFormat}}
{{#jsonFormat}}
part '{{classFilename}}.jser.dart';
class {{classname}} {
{{#vars}}{{#description}} /* {{{.}}} */{{/description}}
@Alias('{{{baseName}}}', isNullable:{{#isNullable}} true{{/isNullable}}{{^isNullable}} false{{/isNullable}},{{#allowableValues}}
{{^enumVars.empty}}{{^isString}}{{! isString because inline enums are not handled for now }}
processor: const {{{datatype}}}FieldProcessor(),
{{/isString}}{{/enumVars.empty}}
{{/allowableValues}}
)
final {{{datatype}}} {{name}};
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}}{{/vars}}
{{classname}}(
{{#vars}}{{^defaultValue}}{{#required}} this.{{name}}, {{/required}}{{/defaultValue}}{{/vars}}
{{#vendorExtensions}}{{#x-has-vars}}{
{{#vars}}{{^required}} this.{{name}}{{#defaultValue}} = {{{defaultValue}}}{{^-last}}, {{/-last}} {{/defaultValue}}{{/required}}
{{#required}} {{#defaultValue}}this.{{name}} = {{{defaultValue}}}{{^-last}}, {{/-last}} {{/defaultValue}}{{/required}}{{/vars}}
}{{/x-has-vars}}{{/vendorExtensions}}
);
@override
String toString() {
return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]';
}
}
@GenSerializer(nullableFields: {{nullableFields}})
class {{classname}}Serializer extends Serializer<{{classname}}> with _${{classname}}Serializer {
}
{{/jsonFormat}}

View File

@ -1,37 +0,0 @@
{{#jsonFormat}}
class {{classname}} {
/// The underlying value of this enum member.
final {{dataType}} value;
const {{classname}}._internal(this.value);
{{#allowableValues}}
{{#enumVars}}
{{#description}}
/// {{.}}
{{/description}}
static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}});
{{/enumVars}}
{{/allowableValues}}
}
class {{classname}}FieldProcessor implements FieldProcessor<{{classname}}, {{dataType}}> {
const {{classname}}FieldProcessor();
{{classname}} deserialize({{dataType}} data) {
switch (data) {
{{#allowableValues}}
{{#enumVars}}
case {{{value}}}: return {{classname}}.{{{name}}};
{{/enumVars}}
{{/allowableValues}}
default: throw('Unknown enum value to decode: $data');
}
}
{{dataType}} serialize({{classname}} item) {
return item.value;
}
}
{{/jsonFormat}}

View File

@ -1,57 +0,0 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="{{{gitHost}}}"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="{{{gitUserId}}}"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="{{{gitRepoId}}}"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="{{{releaseNote}}}"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -1,27 +0,0 @@
# See https://www.dartlang.org/tools/private-files.html
# Files and directories created by pub
.buildlog
.packages
.project
.pub/
build/
**/packages/
# Files created by dart2js
# (Most Dart developers will use pub build to compile Dart, use/modify these
# rules if you intend to use dart2js directly
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
# differentiate from explicit Javascript files)
*.dart.js
*.part.js
*.js.deps
*.js.map
*.info.json
# Directory created by dartdoc
doc/api/
# Don't commit pubspec lock file
# (Library packages only! Remove pattern if developing an application package)
pubspec.lock

View File

@ -1,12 +0,0 @@
{{#jsonFormat}}import 'package:jaguar_serializer/jaguar_serializer.dart';{{/jsonFormat}}
{{#protoFormat}}syntax = "proto3";{{/protoFormat}}
{{#models}}
{{#model}}
{{#imports}}
{{#jsonFormat}}import 'package:{{pubName}}/model/{{.}}.dart';{{/jsonFormat}}
{{#protoFormat}}import "{{.}}.proto";{{/protoFormat}}
{{/imports}}
{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}}
{{/model}}
{{/models}}

View File

@ -1,26 +0,0 @@
{{#models}}
{{#model}}
import 'package:{{pubName}}/api.dart';
import 'package:test/test.dart';
// tests for {{classname}}
void main() {
var instance = new {{classname}}();
group('test {{classname}}', () {
{{#vars}}
{{#description}}
// {{{.}}}
{{/description}}
// {{{dataType}}} {{name}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
test('to test the property `{{name}}`', () async {
// TODO
});
{{/vars}}
});
}
{{/model}}
{{/models}}

View File

@ -1,16 +0,0 @@
{{#models}}{{#model}}# {{pubName}}.model.{{classname}}
## Load the model package
```dart
import 'package:{{pubName}}/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{{/model}}{{/models}}

View File

@ -1,20 +0,0 @@
name: {{pubName}}
version: {{pubVersion}}
description: {{pubDescription}}
environment:
sdk: ">=2.0.0 <3.0.0"
dependencies:
jaguar_retrofit: ^2.8.8
{{#jsonFormat}}
jaguar_serializer: ^2.2.12
{{/jsonFormat}}
{{#protoFormat}}
jaguar_serializer_protobuf: ^2.2.2
jaguar_mimetype: ^1.0.1
{{/protoFormat}}
dev_dependencies:
jaguar_retrofit_gen: ^2.8.10
{{#jsonFormat}}
jaguar_serializer_cli: ^2.2.8
{{/jsonFormat}}
build_runner: ^1.6.5

View File

@ -1,11 +0,0 @@
# https://docs.travis-ci.com/user/languages/dart/
#
language: dart
dart:
# Install a specific stable release
- "1.24.3"
install:
- pub get
script:
- pub run test