forked from loafle/openapi-generator-original
The linting results for the generated samples are as follows where the first number is the BEFORE and the second is AFTER. pyclient 7714 vs. 120 pyclient3 7717 vs. 120 pyclient3-asyncio 7584 vs. 120 pyclient-tornado 7633 vs. 120 pyclient3-tornado 7633 vs. 120 For the complete details please see the following gist. https://gist.github.com/kenjones-cisco/2eb69a7e8db75e9fd53789f01570d9f2 Enforces linting for python clients by running flake8 for the generated python client.
86 lines
4.2 KiB
Plaintext
86 lines
4.2 KiB
Plaintext
# {{packageName}}.{{classname}}{{#description}}
|
|
{{description}}{{/description}}
|
|
|
|
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}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
|
|
|
{{{summary}}}{{#notes}}
|
|
|
|
{{{notes}}}{{/notes}}
|
|
|
|
### Example
|
|
```python
|
|
from __future__ import print_function
|
|
import time
|
|
import {{{packageName}}}
|
|
from {{{packageName}}}.rest import ApiException
|
|
from pprint import pprint
|
|
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
|
# Configure HTTP basic authorization: {{{name}}}
|
|
configuration = {{{packageName}}}.Configuration()
|
|
configuration.username = 'YOUR_USERNAME'
|
|
configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
|
|
# Configure API key authorization: {{{name}}}
|
|
configuration = {{{packageName}}}.Configuration()
|
|
configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
|
|
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
|
|
# Configure OAuth2 access token for authorization: {{{name}}}
|
|
configuration = {{{packageName}}}.Configuration()
|
|
configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
|
|
|
|
# create an instance of the API class
|
|
api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration))
|
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
|
{{/allParams}}
|
|
{{/hasAuthMethods}}
|
|
{{^hasAuthMethods}}
|
|
|
|
# create an instance of the API class
|
|
api_instance = {{{packageName}}}.{{{classname}}}()
|
|
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
|
{{/allParams}}
|
|
{{/hasAuthMethods}}
|
|
|
|
try:
|
|
{{#summary}} # {{{.}}}
|
|
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
|
pprint(api_response){{/returnType}}
|
|
except ApiException as e:
|
|
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
|
|
```
|
|
|
|
### Parameters
|
|
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
|
Name | Type | Description | Notes
|
|
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
|
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{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}}
|