-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapi_doc_example.mustache
More file actions
22 lines (20 loc) · 1017 Bytes
/
api_doc_example.mustache
File metadata and controls
22 lines (20 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
```python
from pprint import pprint
import {{{packageName}}}
from {{{packageName}}}.rest import ApiException
configuration = stencila.hub.Configuration(
host="https://hub.stenci.la/api",
api_key={'Token': 'YOUR_API_TOKEN'},
api_key_prefix={'Token': 'Token'}
)
with {{{packageName}}}.ApiClient(configuration) as api_client:
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
{{#allParams}}
{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
try:
{{#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)
```