-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathapi_doc.mustache
129 lines (109 loc) · 6.06 KB
/
api_doc.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# {{invokerPackage}}\{{classname}}{{#description}}
{{.}}{{/description}}
{{^useCustomTemplateCode}}
All URIs are relative to {{basePath}}, except if the operation defines another base path.
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
All URIs are relative to {{basePath}}.
{{/useCustomTemplateCode}}
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
{{#operations}}{{#operation}}| [**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} |
{{/operation}}{{/operations}}{{#operations}}{{#operation}}
## `{{{operationId}}}()`
```php
{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{.}}}{{/returnType}}
```
{{^useCustomTemplateCode}}
{{#servers}}
{{#-first}}
### URI(s):
{{/-first}}
- {{{url}}} {{#description}}{{.}}{{/description}}{{#variables}}
{{#-first}}
- Variables:
{{/-first}}
- {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
- Allowed values:
{{/-first}}
- {{{.}}}{{/enumValues}}{{#defaultValue}}
- Default value: {{{.}}}
{{/defaultValue}}{{/variables}}{{/servers}}
{{/useCustomTemplateCode}}
{{{summary}}}{{#notes}}
{{{.}}}{{/notes}}
### Example
```php
{{^useCustomTemplateCode}}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
{{> php_doc_auth_partial}}
$apiInstance = new {{invokerPackage}}\Api\{{classname}}(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(){{#hasAuthMethods}},
$config{{/hasAuthMethods}}
);
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}}
{{/allParams}}{{#servers}}{{#-first}}
$hostIndex = 0;
$variables = [{{#variables}}
'{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}}
];
{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}
$associative_array = [
{{#allParams}} '{{paramName}}' => {{{example}}}, // {{{dataType}}}{{#description}} | {{{.}}}{{/description}}
{{/allParams}}
{{#servers}}{{#-first}}
'hostIndex' => 0,
$variables = [{{#variables}}
'{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}}
],
{{/-first}}{{/servers}}];
{{/vendorExtensions.x-group-parameters}}
try {
{{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
print_r($result);{{/returnType}}
} catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_PHP_CODE
{{/useCustomTemplateCode}}
```
### Parameters
{{#vendorExtensions.x-group-parameters}}
{{^useCustomTemplateCode}}
Note: the input parameter is an associative array with the keys listed as the parameter names below.
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
Note: the input parameter is an associative array with the keys listed as the parameter name below.
{{/useCustomTemplateCode}}
{{/vendorExtensions.x-group-parameters}}
{{^useCustomTemplateCode}}
{{^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}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} |
{{/allParams}}{{#servers}}{{#-first}}| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |{{/-first}}
{{/servers}}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
|{{^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}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} |
{{/allParams}}
{{/useCustomTemplateCode}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{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#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md){{/operation}}{{/operations}}