forked from loafle/openapi-generator-original
87 lines
3.6 KiB
Plaintext
87 lines
3.6 KiB
Plaintext
# {{pubName}}.api.{{classname}}{{#description}}
|
|
{{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}}{{summary}}{{/summary}}
|
|
{{/operation}}{{/operations}}
|
|
|
|
{{#operations}}
|
|
{{#operation}}
|
|
# **{{{operationId}}}**
|
|
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
|
|
|
{{{summary}}}{{#notes}}
|
|
|
|
{{{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}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}}
|
|
{{/allParams}}
|
|
|
|
try {
|
|
{{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/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}}]{{/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}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
|
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/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}}
|