All Downloads are FREE. Search and download functionalities are using the official Maven repository.

htmlDocs2.sample_php.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
<?php
require_once(__DIR__ . '/vendor/autoload.php');
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasicBasic}}
// Configure HTTP basic authorization: {{{name}}}
{{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
{{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasicBasic}}{{#isBasicBearer}}
// Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} access token for authorization: {{{name}}}
{{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setAccessToken('{{{keyParamName}}}', 'YOUR_ACCESS_TOKEN');{{/isBasicBearer}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
{{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// {{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
{{phpInvokerPackage}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\{{classname}}();
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{unescapedDescription}}}
{{/allParams}}

try {
    {{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
    print_r($result);{{/returnType}}
} catch (Exception $e) {
    echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
}
?>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy