forked from loafle/openapi-generator-original
* reimplemented basic requests with httpplug * added returning headers * added query params support * removed constant reference to model class * some extra @throws; form params * form and query params encoding * file upload / form multipart * added missing response headers in WithHttpInfo calls * removed Store test From PetApiTest class * removed configuration overriding test as its now task of client adapters * updated store tests with new client initialization code * updated composer.json template * not using json_decode if response is string * renamed some variables to camelCase * removed ApiClient and Configuration classes * added HeaderSelector template * added ObjectSerializer injection * regenerated all samples * added AuthConfig and readded support for custom api keys * readded support for oauth tokens * readded basic auth; moved auth tests to separate test class * readded header params * readded support for collections in paths * readded config option; readded exception handling * file downloading; readded some Configuration properties removed earlier * readded default headers * made responses and return types work same way as earlier * made all methods static in ObjectSerializer * updated test.php, replaced autoload.php with composer's autoloader * updated api doc template * removed classes used for testing; regenerated Fake_classname_tags123Api * replaced httplug with guzzle6 * updated required php version to 5.5 * clean up * readded missing userAgent feature; removed default headers from Configuration * updated test.php * downgraded phpunit back to 4.8 to work with php5.5; fixed client initialization in some tests
73 lines
3.6 KiB
Plaintext
73 lines
3.6 KiB
Plaintext
# {{invokerPackage}}\{{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}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
|
|
|
{{{summary}}}{{#notes}}
|
|
|
|
{{{notes}}}{{/notes}}
|
|
|
|
### Example
|
|
```php
|
|
<?php
|
|
require_once(__DIR__ . '/vendor/autoload.php');
|
|
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
|
// Configure HTTP basic authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
|
|
// Configure API key authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
|
|
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
|
|
// Configure OAuth2 access token for authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
|
|
{{/hasAuthMethods}}
|
|
|
|
$api_instance = new {{invokerPackage}}\Api\{{classname}}(new \Http\Adapter\Guzzle6\Client());
|
|
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
|
{{/allParams}}
|
|
|
|
try {
|
|
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
|
print_r($result);{{/returnType}}
|
|
} catch (Exception $e) {
|
|
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
|
|
}
|
|
?>
|
|
```
|
|
|
|
### 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}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}
|
|
{{/allParams}}
|
|
|
|
### 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}}}{{#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}}
|