[php-nextgen] add php-nextgen client generator (#16480)

* php-nextgen first commit

* [php] Set minimal PHP version to ^8.0 (#14500)

* Set minimal PHP version to ^8.0

* Fix php-nextgen config

* Change stability to BETA

* Add phplint package (#15054)

* [php-nextgen] Rename folders to follow PDS skeleton (#15102)

* Change lib -> src, test -> tests folder

This will make build compliant to PHP-PDS skeleton.
Ref: https://github.com/php-pds/skeleton

* Refresh samples

* Exclude composer.lock from codebase (#15105)

Since client generator is library and not a project it makes sense
to exclude composer.lock from codebase by default.

Ref: http://getcomposer.org/doc/02-libraries.md#lock-file

* Add @generated tag to DocBlocks (#15106)

This tag in draft status right now(PSR-19), but I think we can leverage
from it already.

Ref: https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#55-generated

* update samples, doc

* update samples

---------

Co-authored-by: Yuriy Belenko <yura-bely@mail.ru>
This commit is contained in:
William Cheng 2023-09-03 16:16:58 +08:00 committed by GitHub
parent ebc9bcda44
commit 6434c86afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
303 changed files with 87026 additions and 0 deletions

1
.gitignore vendored
View File

@ -183,6 +183,7 @@ samples/client/petstore/python-asyncio/.pytest_cache/
# PHP
samples/client/petstore/php/OpenAPIClient-php/composer.lock
samples/client/petstore/php-nextgen/OpenAPIClient-php/composer.lock
samples/client/petstore/php-dt/composer.lock
samples/client/petstore/php-dt-modern/composer.lock
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock

View File

@ -0,0 +1,4 @@
generatorName: php-nextgen
outputDir: samples/client/petstore/php-nextgen/OpenAPIClient-php
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/php-nextgen

View File

@ -50,6 +50,7 @@ The following generators are available:
* [perl](generators/perl.md)
* [php](generators/php.md)
* [php-dt (beta)](generators/php-dt.md)
* [php-nextgen (beta)](generators/php-nextgen.md)
* [powershell (beta)](generators/powershell.md)
* [python](generators/python.md)
* [r](generators/r.md)

View File

@ -0,0 +1,269 @@
---
title: Documentation for the php-nextgen Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | php-nextgen | pass this to the generate command after -g |
| generator stability | BETA | |
| generator type | CLIENT | |
| generator language | PHP | |
| generator default templating engine | mustache | |
| helpTxt | Generates a PHP client library (beta). | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|artifactUrl|artifact URL in generated pom.xml| |null|
|artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null|
|composerPackageName|The name to use in the composer package name field. e.g. `vendor/project` (must be lowercase and consist of words separated by `-`, `.` or `_`).| |null|
|developerOrganization|developer organization in generated pom.xml| |null|
|developerOrganizationUrl|developer organization URL in generated pom.xml| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true|
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|licenseName|The name of the license| |null|
|modelPackage|package for generated models| |null|
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|array|
|map|array|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>\DateTime</li>
<li>\SplFileObject</li>
<li>array</li>
<li>bool</li>
<li>boolean</li>
<li>byte</li>
<li>float</li>
<li>int</li>
<li>integer</li>
<li>mixed</li>
<li>number</li>
<li>object</li>
<li>string</li>
<li>void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>__halt_compiler</li>
<li>_header_accept</li>
<li>_tempbody</li>
<li>abstract</li>
<li>and</li>
<li>array</li>
<li>as</li>
<li>break</li>
<li>callable</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>clone</li>
<li>const</li>
<li>continue</li>
<li>declare</li>
<li>default</li>
<li>die</li>
<li>do</li>
<li>echo</li>
<li>else</li>
<li>elseif</li>
<li>empty</li>
<li>enddeclare</li>
<li>endfor</li>
<li>endforeach</li>
<li>endif</li>
<li>endswitch</li>
<li>endwhile</li>
<li>eval</li>
<li>exit</li>
<li>extends</li>
<li>final</li>
<li>for</li>
<li>foreach</li>
<li>formparams</li>
<li>function</li>
<li>global</li>
<li>goto</li>
<li>headerparams</li>
<li>httpbody</li>
<li>if</li>
<li>implements</li>
<li>include</li>
<li>include_once</li>
<li>instanceof</li>
<li>insteadof</li>
<li>interface</li>
<li>isset</li>
<li>list</li>
<li>namespace</li>
<li>new</li>
<li>or</li>
<li>print</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>queryparams</li>
<li>require</li>
<li>require_once</li>
<li>resourcepath</li>
<li>return</li>
<li>static</li>
<li>switch</li>
<li>throw</li>
<li>trait</li>
<li>try</li>
<li>unset</li>
<li>use</li>
<li>var</li>
<li>while</li>
<li>xor</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|SignatureAuth|✗|OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@ -454,6 +454,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
this.srcBasePath = srcBasePath;
}
public void setTestBasePath(String testBasePath) {
this.testBasePath = testBasePath;
}
public void setParameterNamingConvention(String variableNamingConvention) {
this.variableNamingConvention = variableNamingConvention;
}

View File

@ -0,0 +1,125 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
@SuppressWarnings("hiding")
private final Logger LOGGER = LoggerFactory.getLogger(PhpNextgenClientCodegen.class);
public PhpNextgenClientCodegen() {
super();
// override default src and test folders to comply PSD skeleton
setSrcBasePath("src");
setTestBasePath("tests");
// mark as beta so far
this.generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA).build();
modifyFeatureSet(features -> features
.includeDocumentationFeatures(DocumentationFeature.Readme)
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML))
.securityFeatures(EnumSet.noneOf(SecurityFeature.class))
.excludeGlobalFeatures(
GlobalFeature.XMLStructureDefinitions,
GlobalFeature.Callbacks,
GlobalFeature.LinkObjects,
GlobalFeature.ParameterStyling
)
.excludeSchemaSupportFeatures(
SchemaSupportFeature.Polymorphism
)
);
// clear import mapping (from default generator) as php does not use it
// at the moment
importMapping.clear();
setInvokerPackage("OpenAPI\\Client");
setApiPackage(getInvokerPackage() + "\\" + apiDirName);
setModelPackage(getInvokerPackage() + "\\" + modelDirName);
setPackageName("OpenAPIClient-php");
supportsInheritance = true;
setOutputDir("generated-code" + File.separator + "php");
modelTestTemplateFiles.put("model_test.mustache", ".php");
embeddedTemplateDir = templateDir = "php-nextgen";
// default HIDE_GENERATION_TIMESTAMP to true
hideGenerationTimestamp = Boolean.TRUE;
// provide primitives to mustache template
List sortedLanguageSpecificPrimitives = new ArrayList(languageSpecificPrimitives);
Collections.sort(sortedLanguageSpecificPrimitives);
String primitives = "'" + StringUtils.join(sortedLanguageSpecificPrimitives, "', '") + "'";
additionalProperties.put("primitives", primitives);
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.ALLOW_UNICODE_IDENTIFIERS_DESC)
.defaultValue(Boolean.TRUE.toString()));
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String getName() {
return "php-nextgen";
}
@Override
public String getHelp() {
return "Generates a PHP client library (beta).";
}
@Override
public void processOpts() {
super.processOpts();
supportingFiles.add(new SupportingFile("ApiException.mustache", toSrcPath(invokerPackage, srcBasePath), "ApiException.php"));
supportingFiles.add(new SupportingFile("Configuration.mustache", toSrcPath(invokerPackage, srcBasePath), "Configuration.php"));
supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toSrcPath(invokerPackage, srcBasePath), "ObjectSerializer.php"));
supportingFiles.add(new SupportingFile("ModelInterface.mustache", toSrcPath(modelPackage, srcBasePath), "ModelInterface.php"));
supportingFiles.add(new SupportingFile("HeaderSelector.mustache", toSrcPath(invokerPackage, srcBasePath), "HeaderSelector.php"));
supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("phpunit.xml.mustache", "", "phpunit.xml.dist"));
supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
supportingFiles.add(new SupportingFile(".php-cs-fixer.dist.php", "", ".php-cs-fixer.dist.php"));
supportingFiles.add(new SupportingFile(".phplint.mustache", "", ".phplint.yml"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
}
}

View File

@ -90,6 +90,7 @@ org.openapitools.codegen.languages.OpenAPIYamlGenerator
org.openapitools.codegen.languages.PlantumlDocumentationCodegen
org.openapitools.codegen.languages.PerlClientCodegen
org.openapitools.codegen.languages.PhpClientCodegen
org.openapitools.codegen.languages.PhpNextgenClientCodegen
org.openapitools.codegen.languages.PhpLaravelServerCodegen
org.openapitools.codegen.languages.PhpLumenServerCodegen
org.openapitools.codegen.languages.PhpSlim4ServerCodegen

View File

@ -0,0 +1,29 @@
<?php
/**
* @generated
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
*/
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->exclude('test')
->exclude('tests')
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
'no_leading_import_slash' => false,
])
->setFinder($finder)
;

View File

@ -0,0 +1,11 @@
path:
- ./{{srcBasePath}}
- ./{{testBasePath}}
jobs: 10
extensions:
- php
exclude:
- vendor
warning: true
memory-limit: -1
no-cache: true

View File

@ -0,0 +1,12 @@
language: php
# Jammy Jellyfish environment has preinstalled PHP 8.1
# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only
# https://docs.travis-ci.com/user/reference/jammy/#php-support
dist: jammy
os:
- linux
php:
- 8.0
- 8.1
before_install: "composer install"
script: "vendor/bin/phpunit"

View File

@ -0,0 +1,110 @@
<?php
/**
* ApiException
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
use \Exception;
/**
* ApiException Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ApiException extends Exception
{
/**
* The HTTP body of the server response either as Json or string.
*
* @var \stdClass|string|null
*/
protected $responseBody;
/**
* The HTTP header of the server response.
*
* @var string[]|null
*/
protected $responseHeaders;
/**
* The deserialized response object
*
* @var \stdClass|string|null
*/
protected $responseObject;
/**
* Constructor
*
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
{
parent::__construct($message, $code);
$this->responseHeaders = $responseHeaders;
$this->responseBody = $responseBody;
}
/**
* Gets the HTTP response header
*
* @return string[]|null HTTP response header
*/
public function getResponseHeaders()
{
return $this->responseHeaders;
}
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{
return $this->responseBody;
}
/**
* Sets the deserialized response object (during deserialization)
*
* @param mixed $obj Deserialized response object
*
* @return void
*/
public function setResponseObject($obj)
{
$this->responseObject = $obj;
}
/**
* Gets the deserialized response object (during deserialization)
*
* @return mixed the deserialized response object
*/
public function getResponseObject()
{
return $this->responseObject;
}
}

View File

@ -0,0 +1,547 @@
<?php
/**
* Configuration
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
/**
* Configuration Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class Configuration
{
public const BOOLEAN_FORMAT_INT = 'int';
public const BOOLEAN_FORMAT_STRING = 'string';
/**
* @var Configuration
*/
private static $defaultConfiguration;
/**
* Associate array to store API key(s)
*
* @var string[]
*/
protected $apiKeys = [];
/**
* Associate array to store API prefix (e.g. Bearer)
*
* @var string[]
*/
protected $apiKeyPrefixes = [];
/**
* Access token for OAuth/Bearer authentication
*
* @var string
*/
protected $accessToken = '';
/**
* Boolean format for query string
*
* @var string
*/
protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
/**
* Username for HTTP basic authentication
*
* @var string
*/
protected $username = '';
/**
* Password for HTTP basic authentication
*
* @var string
*/
protected $password = '';
/**
* The host
*
* @var string
*/
protected $host = '{{basePath}}';
/**
* User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
*
* @var string
*/
protected $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}';
/**
* Debug switch (default set to false)
*
* @var bool
*/
protected $debug = false;
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $debugFile = 'php://output';
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $tempFolderPath;
/**
* Constructor
*/
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
}
/**
* Sets API key
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $key API key or token
*
* @return $this
*/
public function setApiKey($apiKeyIdentifier, $key)
{
$this->apiKeys[$apiKeyIdentifier] = $key;
return $this;
}
/**
* Gets API key
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier)
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}
/**
* Sets the prefix for API key (e.g. Bearer)
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $prefix API key prefix, e.g. Bearer
*
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
{
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this;
}
/**
* Gets API key prefix
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return null|string
*/
public function getApiKeyPrefix($apiKeyIdentifier)
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
}
/**
* Sets the access token for OAuth
*
* @param string $accessToken Token for OAuth
*
* @return $this
*/
public function setAccessToken($accessToken)
{
$this->accessToken = $accessToken;
return $this;
}
/**
* Gets the access token for OAuth
*
* @return string Access token for OAuth
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* Sets boolean format for query string.
*
* @param string $booleanFormatForQueryString Boolean format for query string
*
* @return $this
*/
public function setBooleanFormatForQueryString(string $booleanFormat)
{
$this->booleanFormatForQueryString = $booleanFormat;
return $this;
}
/**
* Gets boolean format for query string.
*
* @return string Boolean format for query string
*/
public function getBooleanFormatForQueryString(): string
{
return $this->booleanFormatForQueryString;
}
/**
* Sets the username for HTTP basic authentication
*
* @param string $username Username for HTTP basic authentication
*
* @return $this
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Gets the username for HTTP basic authentication
*
* @return string Username for HTTP basic authentication
*/
public function getUsername()
{
return $this->username;
}
/**
* Sets the password for HTTP basic authentication
*
* @param string $password Password for HTTP basic authentication
*
* @return $this
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Gets the password for HTTP basic authentication
*
* @return string Password for HTTP basic authentication
*/
public function getPassword()
{
return $this->password;
}
/**
* Sets the host
*
* @param string $host Host
*
* @return $this
*/
public function setHost($host)
{
$this->host = $host;
return $this;
}
/**
* Gets the host
*
* @return string Host
*/
public function getHost()
{
return $this->host;
}
/**
* Sets the user agent of the api client
*
* @param string $userAgent the user agent of the api client
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setUserAgent($userAgent)
{
if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.');
}
$this->userAgent = $userAgent;
return $this;
}
/**
* Gets the user agent of the api client
*
* @return string user agent
*/
public function getUserAgent()
{
return $this->userAgent;
}
/**
* Sets debug flag
*
* @param bool $debug Debug flag
*
* @return $this
*/
public function setDebug($debug)
{
$this->debug = $debug;
return $this;
}
/**
* Gets the debug flag
*
* @return bool
*/
public function getDebug()
{
return $this->debug;
}
/**
* Sets the debug file
*
* @param string $debugFile Debug file
*
* @return $this
*/
public function setDebugFile($debugFile)
{
$this->debugFile = $debugFile;
return $this;
}
/**
* Gets the debug file
*
* @return string
*/
public function getDebugFile()
{
return $this->debugFile;
}
/**
* Sets the temp folder path
*
* @param string $tempFolderPath Temp folder path
*
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
{
$this->tempFolderPath = $tempFolderPath;
return $this;
}
/**
* Gets the temp folder path
*
* @return string Temp folder path
*/
public function getTempFolderPath()
{
return $this->tempFolderPath;
}
/**
* Gets the default configuration instance
*
* @return Configuration
*/
public static function getDefaultConfiguration()
{
if (self::$defaultConfiguration === null) {
self::$defaultConfiguration = new Configuration();
}
return self::$defaultConfiguration;
}
/**
* Sets the default configuration instance
*
* @param Configuration $config An instance of the Configuration Object
*
* @return void
*/
public static function setDefaultConfiguration(Configuration $config)
{
self::$defaultConfiguration = $config;
}
/**
* Gets the essential information for debugging
*
* @return string The report for debugging
*/
public static function toDebugReport()
{
$report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' The version of the OpenAPI document: {{version}}' . PHP_EOL;
{{#artifactVersion}}
$report .= ' SDK Package Version: {{.}}' . PHP_EOL;
{{/artifactVersion}}
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
return $report;
}
/**
* Get API key (with prefix if set)
*
* @param string $apiKeyIdentifier name of apikey
*
* @return null|string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
if ($apiKey === null) {
return null;
}
if ($prefix === null) {
$keyWithPrefix = $apiKey;
} else {
$keyWithPrefix = $prefix . ' ' . $apiKey;
}
return $keyWithPrefix;
}
/**
* Returns an array of host settings
*
* @return array an array of host settings
*/
public function getHostSettings()
{
return [
{{#servers}}
[
"url" => "{{{url}}}",
"description" => "{{{description}}}{{^description}}No description provided{{/description}}",
{{#variables}}
{{#-first}}
"variables" => [
{{/-first}}
"{{{name}}}" => [
"description" => "{{{description}}}{{^description}}No description provided{{/description}}",
"default_value" => "{{{defaultValue}}}",
{{#enumValues}}
{{#-first}}
"enum_values" => [
{{/-first}}
"{{{.}}}"{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/enumValues}}
]{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/variables}}
]{{^-last}},{{/-last}}
{{/servers}}
];
}
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
{
if (null === $variables) {
$variables = [];
}
// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
}
$host = $hostsSettings[$hostIndex];
$url = $host["url"];
// go through variable and assign a value
foreach ($host["variables"] ?? [] as $name => $variable) {
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
$url = str_replace("{".$name."}", $variables[$name], $url);
} else {
throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
}
} else {
// use default value
$url = str_replace("{".$name."}", $variable["default_value"], $url);
}
}
return $url;
}
/**
* Returns URL based on the index and variables
*
* @param int $index index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public function getHostFromSettings($index, $variables = null)
{
return self::getHostString($this->getHostSettings(), $index, $variables);
}
}

View File

@ -0,0 +1,236 @@
<?php
/**
* HeaderSelector
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
/**
* HeaderSelector Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class HeaderSelector
{
/**
* @param string[] $accept
* @param string $contentType
* @param bool $isMultipart
* @return string[]
*/
public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array
{
$headers = [];
$accept = $this->selectAcceptHeader($accept);
if ($accept !== null) {
$headers['Accept'] = $accept;
}
if (!$isMultipart) {
if($contentType === '') {
$contentType = 'application/json';
}
$headers['Content-Type'] = $contentType;
}
return $headers;
}
/**
* Return the header 'Accept' based on an array of Accept provided.
*
* @param string[] $accept Array of header
*
* @return null|string Accept (e.g. application/json)
*/
private function selectAcceptHeader(array $accept): ?string
{
# filter out empty entries
$accept = array_filter($accept);
if (count($accept) === 0) {
return null;
}
# If there's only one Accept header, just use it
if (count($accept) === 1) {
return reset($accept);
}
# If none of the available Accept headers is of type "json", then just use all them
$headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
if (count($headersWithJson) === 0) {
return implode(',', $accept);
}
# If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1,
# to give the highest priority to json-like headers - recalculating the existing ones, if needed
return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
}
/**
* Create an Accept header string from the given "Accept" headers array, recalculating all weights
*
* @param string[] $accept Array of Accept Headers
* @param string[] $headersWithJson Array of Accept Headers of type "json"
*
* @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
*/
private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
{
$processedHeaders = [
'withApplicationJson' => [],
'withJson' => [],
'withoutJson' => [],
];
foreach ($accept as $header) {
$headerData = $this->getHeaderAndWeight($header);
if (stripos($headerData['header'], 'application/json') === 0) {
$processedHeaders['withApplicationJson'][] = $headerData;
} elseif (in_array($header, $headersWithJson, true)) {
$processedHeaders['withJson'][] = $headerData;
} else {
$processedHeaders['withoutJson'][] = $headerData;
}
}
$acceptHeaders = [];
$currentWeight = 1000;
$hasMoreThan28Headers = count($accept) > 28;
foreach($processedHeaders as $headers) {
if (count($headers) > 0) {
$acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers);
}
}
$acceptHeaders = array_merge(...$acceptHeaders);
return implode(',', $acceptHeaders);
}
/**
* Given an Accept header, returns an associative array splitting the header and its weight
*
* @param string $header "Accept" Header
*
* @return array with the header and its weight
*/
private function getHeaderAndWeight(string $header): array
{
# matches headers with weight, splitting the header and the weight in $outputArray
if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) {
$headerData = [
'header' => $outputArray[1],
'weight' => (int)($outputArray[2] * 1000),
];
} else {
$headerData = [
'header' => trim($header),
'weight' => 1000,
];
}
return $headerData;
}
/**
* @param array[] $headers
* @param float $currentWeight
* @param bool $hasMoreThan28Headers
* @return string[] array of adjusted "Accept" headers
*/
private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
{
usort($headers, function (array $a, array $b) {
return $b['weight'] - $a['weight'];
});
$acceptHeaders = [];
foreach ($headers as $index => $header) {
if($index > 0 && $headers[$index - 1]['weight'] > $header['weight'])
{
$currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
}
$weight = $currentWeight;
$acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight);
}
$currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
return $acceptHeaders;
}
/**
* @param string $header
* @param int $weight
* @return string
*/
private function buildAcceptHeader(string $header, int $weight): string
{
if($weight === 1000) {
return $header;
}
return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0');
}
/**
* Calculate the next weight, based on the current one.
*
* If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the
* following formula:
*
* next weight = current weight - 10 ^ (floor(log(current weight - 1)))
*
* ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) )
*
* Starting from 1000, this generates the following series:
*
* 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
*
* The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works
* if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
* decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
*
* @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
* @param bool $hasMoreThan28Headers
* @return int
*/
public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
{
if ($currentWeight <= 1) {
return 1;
}
if ($hasMoreThan28Headers) {
return $currentWeight - 1;
}
return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
}
}

View File

@ -0,0 +1,102 @@
<?php
/**
* ModelInterface
*
* PHP version 8.0
*
* @category Class
* @package {{modelPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{modelPackage}};
/**
* Interface abstracting model access.
*
* @package {{modelPackage}}
* @author OpenAPI Generator team
*/
interface ModelInterface
{
/**
* The original name of the model.
*
* @return string
*/
public function getModelName();
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes();
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats();
/**
* Array of attributes where the key is the local name, and the value is the original name
*
* @return array
*/
public static function attributeMap();
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters();
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters();
/**
* Show all the invalid properties with reasons.
*
* @return array
*/
public function listInvalidProperties();
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool
*/
public function valid();
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool;
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool;
}

View File

@ -0,0 +1,558 @@
<?php
/**
* ObjectSerializer
*
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{invokerPackage}};
use GuzzleHttp\Psr7\Utils;
use {{modelPackage}}\ModelInterface;
/**
* ObjectSerializer Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ObjectSerializer
{
/** @var string */
private static $dateTimeFormat = \DateTime::ATOM;
/**
* Change the date format
*
* @param string $format the new date format to use
*/
public static function setDateTimeFormat($format)
{
self::$dateTimeFormat = $format;
}
/**
* Serialize data
*
* @param mixed $data the data to serialize
* @param string $type the OpenAPIToolsType of the data
* @param string $format the format of the OpenAPITools type of the data
*
* @return scalar|object|array|null serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
}
if ($data instanceof \DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
}
if (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
}
return $data;
}
if (is_object($data)) {
$values = [];
if ($data instanceof ModelInterface) {
$formats = $data::openAPIFormats();
foreach ($data::openAPITypes() as $property => $openAPIType) {
$getter = $data::getters()[$property];
$value = $data->$getter();
if ($value !== null && !in_array($openAPIType, [{{&primitives}}], true)) {
$callable = [$openAPIType, 'getAllowableEnumValues'];
if (is_callable($callable)) {
/** array $callable */
$allowedEnumTypes = $callable();
if (!in_array($value, $allowedEnumTypes, true)) {
$imploded = implode("', '", $allowedEnumTypes);
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
}
}
}
if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
}
}
} else {
foreach($data as $property => $value) {
$values[$property] = self::sanitizeForSerialization($value);
}
}
return (object)$values;
} else {
return (string)$data;
}
}
/**
* Sanitize filename by removing path.
* e.g. ../../sun.gif becomes sun.gif
*
* @param string $filename filename to be sanitized
*
* @return string the sanitized filename
*/
public static function sanitizeFilename($filename)
{
if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
return $match[1];
} else {
return $filename;
}
}
/**
* Shorter timestamp microseconds to 6 digits length.
*
* @param string $timestamp Original timestamp
*
* @return string the shorten timestamp
*/
public static function sanitizeTimestamp($timestamp)
{
if (!is_string($timestamp)) return $timestamp;
return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
}
/**
* Take value and turn it into a string suitable for inclusion in
* the path, by url-encoding.
*
* @param string $value a string which will be part of the path
*
* @return string the serialized object
*/
public static function toPathValue($value)
{
return rawurlencode(self::toString($value));
}
/**
* Checks if a value is empty, based on its OpenAPI type.
*
* @param mixed $value
* @param string $openApiType
*
* @return bool true if $value is empty
*/
private static function isEmptyValue($value, string $openApiType): bool
{
# If empty() returns false, it is not empty regardless of its type.
if (!empty($value)) {
return false;
}
# Null is always empty, as we cannot send a real "null" value in a query parameter.
if ($value === null) {
return true;
}
switch ($openApiType) {
# For numeric values, false and '' are considered empty.
# This comparison is safe for floating point values, since the previous call to empty() will
# filter out values that don't match 0.
case 'int':
case 'integer':
return $value !== 0;
case 'number':
case 'float':
return $value !== 0 && $value !== 0.0;
# For boolean values, '' is considered empty
case 'bool':
case 'boolean':
return !in_array($value, [false, 0], true);
# For all the other types, any value at this point can be considered empty.
default:
return true;
}
}
/**
* Take query parameter properties and turn it into an array suitable for
* native http_build_query or GuzzleHttp\Psr7\Query::build.
*
* @param mixed $value Parameter value
* @param string $paramName Parameter name
* @param string $openApiType OpenAPIType eg. array or object
* @param string $style Parameter serialization style
* @param bool $explode Parameter explode option
* @param bool $required Whether query param is required or not
*
* @return array
*/
public static function toQueryValue(
$value,
string $paramName,
string $openApiType = 'string',
string $style = 'form',
bool $explode = true,
bool $required = true
): array {
# Check if we should omit this parameter from the query. This should only happen when:
# - Parameter is NOT required; AND
# - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For
# example, 0 as "int" or "boolean" is NOT an empty value.
if (self::isEmptyValue($value, $openApiType)) {
if ($required) {
return ["{$paramName}" => ''];
} else {
return [];
}
}
# Handle DateTime objects in query
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
}
$query = [];
$value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;
// since \GuzzleHttp\Psr7\Query::build fails with nested arrays
// need to flatten array first
$flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) {
if (!is_array($arr)) return $arr;
foreach ($arr as $k => $v) {
$prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k;
if (is_array($v)) {
$flattenArray($v, $prop, $result);
} else {
if ($style !== 'deepObject' && !$explode) {
// push key itself
$result[] = $prop;
}
$result[$prop] = $v;
}
}
return $result;
};
$value = $flattenArray($value, $paramName);
if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) {
return $value;
}
if ('boolean' === $openApiType && is_bool($value)) {
$value = self::convertBoolToQueryStringFormat($value);
}
// handle style in serializeCollection
$query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style);
return $query;
}
/**
* Convert boolean value to format for query string.
*
* @param bool $value Boolean value
*
* @return int|string Boolean value in format
*/
public static function convertBoolToQueryStringFormat(bool $value)
{
if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
return $value ? 'true' : 'false';
}
return (int) $value;
}
/**
* Take value and turn it into a string suitable for inclusion in
* the header. If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601
*
* @param string $value a string which will be part of the header
*
* @return string the header string
*/
public static function toHeaderValue($value)
{
$callable = [$value, 'toHeaderValue'];
if (is_callable($callable)) {
return $callable();
}
return self::toString($value);
}
/**
* Take value and turn it into a string suitable for inclusion in
* the http body (form parameter). If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601
*
* @param string|\SplFileObject $value the value of the form parameter
*
* @return string the form string
*/
public static function toFormValue($value)
{
if ($value instanceof \SplFileObject) {
return $value->getRealPath();
} else {
return self::toString($value);
}
}
/**
* Take value and turn it into a string suitable for inclusion in
* the parameter. If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601
* If it's a boolean, convert it to "true" or "false".
*
* @param string|bool|\DateTime $value the value of the parameter
*
* @return string the header string
*/
public static function toString($value)
{
if ($value instanceof \DateTime) { // datetime in ISO8601 format
return $value->format(self::$dateTimeFormat);
} elseif (is_bool($value)) {
return $value ? 'true' : 'false';
} else {
return (string) $value;
}
}
/**
* Serialize an array to a string.
*
* @param array $collection collection to serialize to a string
* @param string $style the format use for serialization (csv,
* ssv, tsv, pipes, multi)
* @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
*
* @return string
*/
public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
{
if ($allowCollectionFormatMulti && ('multi' === $style)) {
// http_build_query() almost does the job for us. We just
// need to fix the result of multidimensional arrays.
return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
}
switch ($style) {
case 'pipeDelimited':
case 'pipes':
return implode('|', $collection);
case 'tsv':
return implode("\t", $collection);
case 'spaceDelimited':
case 'ssv':
return implode(' ', $collection);
case 'simple':
case 'csv':
// Deliberate fall through. CSV is default format.
default:
return implode(',', $collection);
}
}
/**
* Deserialize a JSON string into an object
*
* @param mixed $data object or primitive to be deserialized
* @param string $class class name is passed as a string
* @param string[] $httpHeaders HTTP headers
* @param string $discriminator discriminator if polymorphism is used
*
* @return object|array|null a single or an array of $class instances
*/
public static function deserialize($data, $class, $httpHeaders = null)
{
if (null === $data) {
return null;
}
if (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
if (!is_array($data)) {
throw new \InvalidArgumentException("Invalid array '$class'");
}
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
$values[] = self::deserialize($value, $subClass, null);
}
return $values;
}
if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array<string,int>
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
$deserialized = [];
if (strrpos($inner, ",") !== false) {
$subClass_array = explode(',', $inner, 2);
$subClass = $subClass_array[1];
foreach ($data as $key => $value) {
$deserialized[$key] = self::deserialize($value, $subClass, null);
}
}
return $deserialized;
}
if ($class === 'object') {
settype($data, 'array');
return $data;
} elseif ($class === 'mixed') {
settype($data, gettype($data));
return $data;
}
if ($class === '\DateTime') {
// Some APIs return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
// what is meant. The invalid empty string is probably to
// be interpreted as a missing field/value. Let's handle
// this graceful.
if (!empty($data)) {
try {
return new \DateTime($data);
} catch (\Exception $exception) {
// Some APIs return a date-time with too high nanosecond
// precision for php's DateTime to handle.
// With provided regexp 6 digits of microseconds saved
return new \DateTime(self::sanitizeTimestamp($data));
}
} else {
return null;
}
}
if ($class === '\SplFileObject') {
$data = Utils::streamFor($data);
/** @var \Psr\Http\Message\StreamInterface $data */
// determine file name
if (
is_array($httpHeaders)
&& array_key_exists('Content-Disposition', $httpHeaders)
&& preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)
) {
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
} else {
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
}
$file = fopen($filename, 'w');
while ($chunk = $data->read(200)) {
fwrite($file, $chunk);
}
fclose($file);
return new \SplFileObject($filename, 'r');
}
/** @psalm-suppress ParadoxicalCondition */
if (in_array($class, [{{&primitives}}], true)) {
settype($data, $class);
return $data;
}
if (method_exists($class, 'getAllowableEnumValues')) {
if (!in_array($data, $class::getAllowableEnumValues(), true)) {
$imploded = implode("', '", $class::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
}
return $data;
} else {
$data = is_string($data) ? json_decode($data) : $data;
if (is_array($data)) {
$data = (object)$data;
}
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
$subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator};
if (is_subclass_of($subclass, $class)) {
$class = $subclass;
}
}
/** @var ModelInterface $instance */
$instance = new $class();
foreach ($instance::openAPITypes() as $property => $type) {
$propertySetter = $instance::setters()[$property];
if (!isset($propertySetter)) {
continue;
}
if (!isset($data->{$instance::attributeMap()[$property]})) {
if ($instance::isNullable($property)) {
$instance->$propertySetter(null);
}
continue;
}
if (isset($data->{$instance::attributeMap()[$property]})) {
$propertyValue = $data->{$instance::attributeMap()[$property]};
$instance->$propertySetter(self::deserialize($propertyValue, $type, null));
}
}
return $instance;
}
}
/**
* Native `http_build_query` wrapper.
* @see https://www.php.net/manual/en/function.http-build-query
*
* @param array|object $data May be an array or object containing properties.
* @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only.
* @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter.
* @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738.
*
* @return string
*/
public static function buildQuery(
$data,
string $numeric_prefix = '',
?string $arg_separator = null,
int $encoding_type = \PHP_QUERY_RFC3986
): string {
return \GuzzleHttp\Psr7\Query::build($data, $encoding_type);
}
}

View File

@ -0,0 +1,147 @@
# {{packageName}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}).
{{/infoUrl}}
## Installation & Usage
### Requirements
PHP 8.0 and later.
### Composer
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
```json
{
"repositories": [
{
"type": "vcs",
"url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
}
],
"require": {
"{{gitUserId}}/{{gitRepoId}}": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
<?php
require_once('/path/to/{{packageName}}/vendor/autoload.php');
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
{{> 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}}
);
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}}
{{/allParams}}
try {
{{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
print_r($result);{{/returnType}}
} catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
## API Endpoints
All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Models
{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}}
{{/models}}
## Authorization
{{^authMethods}}
All endpoints do not require authorization.
{{/authMethods}}
{{#authMethods}}
{{#last}} Authentication schemes defined for the API:{{/last}}
### {{{name}}}
{{#isApiKey}}
- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
- **Type**: `OAuth`
- **Flow**: `{{{flow}}}`
- **Authorization URL**: `{{{authorizationUrl}}}`
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}
- **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Tests
To run the tests, use:
```bash
composer install
vendor/bin/phpunit
```
## Author
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}
## About this package
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: `{{appVersion}}`
{{#artifactVersion}}
- Package version: `{{.}}`
{{/artifactVersion}}
{{^hideGenerationTimestamp}}
- Build date: `{{generatedDate}}`
{{/hideGenerationTimestamp}}
- Build package: `{{generatorClass}}`

View File

@ -0,0 +1,835 @@
<?php
/**
* {{classname}}
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{apiPackage}};
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use {{invokerPackage}}\ApiException;
use {{invokerPackage}}\Configuration;
use {{invokerPackage}}\HeaderSelector;
use {{invokerPackage}}\ObjectSerializer;
/**
* {{classname}} Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{#operations}}class {{classname}}
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [{{#operation}}
'{{{operationId}}}' => [{{#consumes}}
'{{{mediaType}}}',{{/consumes}}
{{^consumes}}
'application/json',
{{/consumes}} ],{{/operation}}
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
{{#operation}}
/**
* Operation {{{operationId}}}
{{#summary}}
*
* {{.}}
{{/summary}}
*
{{#description}}
* {{.}}
*
{{/description}}
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
* - {{{.}}}{{/enumValues}}
{{/variables}}
{{#-last}}
*
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
* @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
{{/-first}}
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \{{invokerPackage}}\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
{
{{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
return $response;{{/returnType}}
}
/**
* Operation {{{operationId}}}WithHttpInfo
{{#summary}}
*
* {{.}}
{{/summary}}
*
{{#description}}
* {{.}}
*
{{/description}}
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
* - {{{.}}}{{/enumValues}}
{{/variables}}
{{#-last}}
*
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
* @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
{{/-first}}
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \{{invokerPackage}}\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings)
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
{
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
{{#returnType}}
{{#responses}}
{{#-first}}
switch($statusCode) {
{{/-first}}
{{#dataType}}
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
if ('{{{dataType}}}' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('{{{dataType}}}' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '{{{dataType}}}', []),
$response->getStatusCode(),
$response->getHeaders()
];{{/isRange}}
{{/dataType}}
{{#-last}}
}
{{/-last}}
{{/responses}}
$returnType = '{{{returnType}}}';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
{{/returnType}}
{{^returnType}}
return [null, $statusCode, $response->getHeaders()];
{{/returnType}}
} catch (ApiException $e) {
switch ($e->getCode()) {
{{#responses}}
{{#dataType}}
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'{{{dataType}}}',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;{{/isRange}}
{{/dataType}}
{{/responses}}
}
throw $e;
}
}
/**
* Operation {{{operationId}}}Async
*
{{#summary}}
* {{.}}
*
{{/summary}}
{{#description}}
* {{.}}
*
{{/description}}
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
* - {{{.}}}{{/enumValues}}
{{/variables}}
{{#-last}}
*
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
* @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
{{/-first}}
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
{
return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation {{{operationId}}}AsyncWithHttpInfo
*
{{#summary}}
* {{.}}
*
{{/summary}}
{{#description}}
* {{.}}
*
{{/description}}
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
* - {{{.}}}{{/enumValues}}
{{/variables}}
{{#-last}}
*
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
* @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
{{/-first}}
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
{
$returnType = '{{{returnType}}}';
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
{{#returnType}}
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
{{/returnType}}
{{^returnType}}
return [null, $response->getStatusCode(), $response->getHeaders()];
{{/returnType}}
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation '{{{operationId}}}'
*
{{#vendorExtensions.x-group-parameters}}
* Note: the input parameter is an associative array with the keys listed as the parameter name below
*
{{/vendorExtensions.x-group-parameters}}
{{#servers}}
{{#-first}}
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
* if needed, use the 'variables' parameter to pass variables to the host.
{{/-first}}
* URL: {{{url}}}
{{#variables}}
{{#-first}}
* Variables:
{{/-first}}
* - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}}
{{#-first}}
* Allowed values:
{{/-first}}
* - {{{.}}}{{/enumValues}}
{{/variables}}
{{#-last}}
*
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
* @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
{{/-first}}
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
{
{{#vendorExtensions.x-group-parameters}}
// unbox the parameters from the associative array
{{#allParams}}
${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}};
{{/allParams}}{{#servers.0}}
$hostIndex = $associative_array['hostIndex'];
$variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : [];
{{/servers.0}}
$contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0];
{{/vendorExtensions.x-group-parameters}}{{#allParams}}
{{#required}}
// verify the required parameter '{{paramName}}' is set
if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter ${{paramName}} when calling {{operationId}}'
);
}
{{/required}}
{{#hasValidation}}
{{#maxLength}}
if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}
{{/maxLength}}
{{#minLength}}
if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) {
throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
}
{{/pattern}}
{{#maxItems}}
if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
}
{{/maxItems}}
{{#minItems}}
if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
}
{{/minItems}}
{{/hasValidation}}{{/allParams}}
$resourcePath = '{{{path}}}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
{{#queryParams}}
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
${{paramName}},
'{{baseName}}', // param base name
'{{#schema}}{{openApiType}}{{/schema}}', // openApiType
'{{style}}', // style
{{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode
{{required}} // required
) ?? []);
{{/queryParams}}
{{#headerParams}}
// header params
{{#collectionFormat}}
if (is_array(${{paramName}})) {
${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}');
}
{{/collectionFormat}}
if (${{paramName}} !== null) {
$headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}});
}
{{/headerParams}}
{{#pathParams}}
// path params
{{#collectionFormat}}
if (is_array(${{paramName}})) {
${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}');
}
{{/collectionFormat}}
if (${{paramName}} !== null) {
$resourcePath = str_replace(
'{' . '{{baseName}}' . '}',
ObjectSerializer::toPathValue(${{paramName}}),
$resourcePath
);
}
{{/pathParams}}
{{#formParams}}
// form params
if (${{paramName}} !== null) {
{{#isFile}}
$multipart = true;
$formParams['{{baseName}}'] = [];
$paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}];
foreach ($paramFiles as $paramFile) {
$formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
ObjectSerializer::toFormValue($paramFile),
'rb'
);
}
{{/isFile}}
{{^isFile}}
$formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}});
{{/isFile}}
}
{{/formParams}}
$headers = $this->headerSelector->selectHeaders(
[{{#produces}}'{{{mediaType}}}', {{/produces}}],
$contentType,
$multipart
);
// for model (json/xml)
{{#bodyParams}}
if (isset(${{paramName}})) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}}));
} else {
$httpBody = ${{paramName}};
}
} elseif (count($formParams) > 0) {
{{/bodyParams}}
{{^bodyParams}}
if (count($formParams) > 0) {
{{/bodyParams}}
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
{{#authMethods}}
{{#isApiKey}}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}');
if ($apiKey !== null) {
{{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
// this endpoint requires HTTP basic authentication
if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
$headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
}
{{/isBasicBasic}}
{{#isBasicBearer}}
// this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token)
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
// this endpoint requires OAuth (access token)
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
{{/isOAuth}}
{{/authMethods}}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
{{#servers.0}}
# Preserve the original behavior of server indexing.
if ($hostIndex === null) {
$hostIndex = $this->hostIndex;
}
$hostSettings = $this->getHostSettingsFor{{operationId}}();
if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
throw new \InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
}
$operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
{{/servers.0}}
{{^servers.0}}
$operationHost = $this->config->getHost();
{{/servers.0}}
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'{{httpMethod}}',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
{{#servers.0}}
/**
* Returns an array of host settings for Operation {{operationId}}
*
* @return array an array of host settings
*/
protected function getHostSettingsFor{{operationId}}(): array
{
return [
{{#servers}}
[
"url" => "{{{url}}}",
"description" => "{{{description}}}{{^description}}No description provided{{/description}}",
{{#variables}}
{{#-first}}
"variables" => [
{{/-first}}
"{{{name}}}" => [
"description" => "{{{description}}}{{^description}}No description provided{{/description}}",
"default_value" => "{{{defaultValue}}}",
{{#enumValues}}
{{#-first}}
"enum_values" => [
{{/-first}}
"{{{.}}}",
{{#-last}}
]
{{/-last}}
{{/enumValues}}
]{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/variables}}
]{{^-last}},{{/-last}}
{{/servers}}
];
}
{{/servers.0}}
{{/operation}}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
{{/operations}}

View File

@ -0,0 +1,104 @@
# {{invokerPackage}}\{{classname}}{{#description}}
{{.}}{{/description}}
All URIs are relative to {{basePath}}, except if the operation defines another base path.
| 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}}
```
{{#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}}
{{{summary}}}{{#notes}}
{{{.}}}{{/notes}}
### Example
```php
<?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;
}
```
### Parameters
{{#vendorExtensions.x-group-parameters}}
Note: the input parameter is an associative array with the keys listed as the parameter names below.
{{/vendorExtensions.x-group-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}} |
{{/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}}
### 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}}

View File

@ -0,0 +1,79 @@
<?php
/**
* {{classname}}Test
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Please update the test case below to test the endpoint.
*/
namespace {{invokerPackage}}\Test\Api;
use \{{invokerPackage}}\Configuration;
use \{{invokerPackage}}\ApiException;
use \{{invokerPackage}}\ObjectSerializer;
use PHPUnit\Framework\TestCase;
/**
* {{classname}}Test Class Doc Comment
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{#operations}}class {{classname}}Test extends TestCase
{
/**
* Setup before running any test cases
*/
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass(): void
{
}
{{#operation}}
/**
* Test case for {{{operationId}}}
*
* {{{summary}}}.
*
*/
public function test{{vendorExtensions.x-test-operation-id}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{/operation}}
}
{{/operations}}

View File

@ -0,0 +1,51 @@
{
{{#composerPackageName}}
"name": "{{.}}",
{{/composerPackageName}}
{{#artifactVersion}}
"version": "{{.}}",
{{/artifactVersion}}
"description": "{{{appDescription}}}",
"keywords": [
"openapitools",
"openapi-generator",
"openapi",
"php",
"sdk",
"rest",
"api"
],
"homepage": "https://openapi-generator.tech",
"license": "unlicense",
"authors": [
{
"name": "OpenAPI-Generator contributors",
"homepage": "https://openapi-generator.tech"
}
],
"require": {
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.5",
"overtrue/phplint": "^9.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }
},
"autoload-dev": {
"psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" }
},
"scripts": {
"test": [
"@phplint"
],
"phplint": "phplint"
}
}

View File

@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="{{{gitHost}}}"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="{{{gitUserId}}}"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="{{{gitRepoId}}}"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="{{{releaseNote}}}"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,19 @@
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# makes sense since it's a library(client SDK) and not a project
composer.lock
# php-cs-fixer cache
.php_cs.cache
.php-cs-fixer.cache
# PHPUnit cache
.phpunit.result.cache
# PHPLint cache
build/phplint.cache

View File

@ -0,0 +1,46 @@
<?php
{{#models}}
{{#model}}
/**
* {{classname}}
*
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace {{modelPackage}};
{{^isEnum}}
{{^parentSchema}}
use \ArrayAccess;
{{/parentSchema}}
{{/isEnum}}
use \{{invokerPackage}}\ObjectSerializer;
/**
* {{classname}} Class Doc Comment
*
* @category Class
{{#description}}
* @description {{.}}
{{/description}}
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
{{^isEnum}}
* @implements \ArrayAccess<string, mixed>
{{/isEnum}}
*/
{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}}
{{/model}}{{/models}}

View File

@ -0,0 +1,10 @@
# {{#models}}{{#model}}# {{classname}}
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md){{/model}}{{/models}}

View File

@ -0,0 +1,28 @@
class {{classname}}
{
/**
* Possible values of this enum
*/
{{#allowableValues}}
{{#enumVars}}
public const {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}};
{{/enumVars}}
{{/allowableValues}}
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
{{#allowableValues}}
{{#enumVars}}
self::{{^isString}}NUMBER_{{/isString}}{{{name}}}{{^-last}},
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
];
}
}

View File

@ -0,0 +1,560 @@
class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}}
{
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = '{{name}}';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
{{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}},
{{/-last}}{{/vars}}
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}},
{{/-last}}{{/vars}}
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
{{/-last}}{{/vars}}
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes{{#parentSchema}} + parent::openAPITypes(){{/parentSchema}};
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}};
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables{{#parentSchema}} + parent::openAPINullables(){{/parentSchema}};
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
{{#vars}}'{{name}}' => '{{baseName}}'{{^-last}},
{{/-last}}{{/vars}}
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
{{#vars}}'{{name}}' => '{{setter}}'{{^-last}},
{{/-last}}{{/vars}}
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
{{#vars}}'{{name}}' => '{{getter}}'{{^-last}},
{{/-last}}{{/vars}}
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
{{#vars}}
{{#isEnum}}
{{#allowableValues}}
{{#enumVars}}
public const {{enumName}}_{{{name}}} = {{{value}}};
{{/enumVars}}
{{/allowableValues}}
{{/isEnum}}
{{/vars}}
{{#vars}}
{{#isEnum}}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function {{getter}}AllowableValues()
{
return [
{{#allowableValues}}{{#enumVars}}self::{{enumName}}_{{{name}}},{{^-last}}
{{/-last}}{{/enumVars}}{{/allowableValues}}
];
}
{{/isEnum}}
{{/vars}}
{{^parentSchema}}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
{{/parentSchema}}
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
{{#parentSchema}}
parent::__construct($data);
{{/parentSchema}}
{{#vars}}
$this->setIfExists('{{name}}', $data ?? [], {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}});
{{/vars}}
{{#discriminator}}
// Initialize discriminator property with the model name.
$this->container['{{discriminatorName}}'] = static::$openAPIModelName;
{{/discriminator}}
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
{{#parentSchema}}
$invalidProperties = parent::listInvalidProperties();
{{/parentSchema}}
{{^parentSchema}}
$invalidProperties = [];
{{/parentSchema}}
{{#vars}}
{{#required}}
if ($this->container['{{name}}'] === null) {
$invalidProperties[] = "'{{name}}' can't be null";
}
{{/required}}
{{#isEnum}}
{{^isContainer}}
$allowedValues = $this->{{getter}}AllowableValues();
if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for '{{name}}', must be one of '%s'",
$this->container['{{name}}'],
implode("', '", $allowedValues)
);
}
{{/isContainer}}
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) > {{maxLength}})) {
$invalidProperties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}.";
}
{{/maxLength}}
{{#minLength}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) < {{minLength}})) {
$invalidProperties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}.";
}
{{/minLength}}
{{#maximum}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) {
$invalidProperties[] = "invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.";
}
{{/maximum}}
{{#minimum}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) {
$invalidProperties[] = "invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.";
}
{{/minimum}}
{{#pattern}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) {
$invalidProperties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}.";
}
{{/pattern}}
{{#maxItems}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) > {{maxItems}})) {
$invalidProperties[] = "invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}.";
}
{{/maxItems}}
{{#minItems}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) < {{minItems}})) {
$invalidProperties[] = "invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}.";
}
{{/minItems}}
{{/hasValidation}}
{{/vars}}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
{{#vars}}
/**
* Gets {{name}}
*
* @return {{{dataType}}}{{^required}}|null{{/required}}
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
public function {{getter}}()
{
return $this->container['{{name}}'];
}
/**
* Sets {{name}}
*
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}}
*
* @return self
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
public function {{setter}}(${{name}})
{
{{#isNullable}}
if (is_null(${{name}})) {
array_push($this->openAPINullablesSetToNull, '{{name}}');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('{{name}}', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
{{/isNullable}}
{{^isNullable}}
if (is_null(${{name}})) {
throw new \InvalidArgumentException('non-nullable {{name}} cannot be null');
}
{{/isNullable}}
{{#isEnum}}
$allowedValues = $this->{{getter}}AllowableValues();
{{^isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for '{{name}}', must be one of '%s'",
${{{name}}},
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{#isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for '{{name}}', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) > {{maxLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}{{/maxLength}}
{{#minLength}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) < {{minLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(!preg_match("{{{pattern}}}", ${{name}}))) {
throw new \InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
}
{{/pattern}}
{{#maxItems}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) > {{maxItems}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
}{{/maxItems}}
{{#minItems}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) < {{minItems}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
}
{{/minItems}}
{{/hasValidation}}
$this->container['{{name}}'] = ${{name}};
return $this;
}
{{/vars}}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}

View File

@ -0,0 +1,87 @@
<?php
{{#models}}
{{#model}}
/**
* {{classname}}Test
*
* PHP version 8.0
*
* @category Class
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
{{>partial_header}}
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Please update the test case below to test the model.
*/
namespace {{invokerPackage}}\Test\Model;
use PHPUnit\Framework\TestCase;
/**
* {{classname}}Test Class Doc Comment
*
* @category Class
* @description {{description}}{{^description}}{{classname}}{{/description}}
* @package {{invokerPackage}}
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class {{classname}}Test extends TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass(): void
{
}
/**
* Test "{{classname}}"
*/
public function test{{classname}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{#vars}}
/**
* Test attribute "{{name}}"
*/
public function testProperty{{nameInCamelCase}}()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
{{/vars}}
}
{{/model}}
{{/models}}

View File

@ -0,0 +1,18 @@
/**
{{#appName}}
* {{{.}}}
*
{{/appName}}
{{#appDescription}}
* {{{.}}}
*
{{/appDescription}}
{{#version}}
* The version of the OpenAPI document: {{{.}}}
{{/version}}
{{#infoEmail}}
* Contact: {{{.}}}
{{/infoEmail}}
* @generated Generated by: https://openapi-generator.tech
* OpenAPI Generator version: {{{generatorVersion}}}
*/

View File

@ -0,0 +1,23 @@
{{#hasAuthMethods}}{{#authMethods}}
{{#isBasic}}
{{#isBasicBasic}}
// Configure HTTP basic authorization: {{{name}}}
$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
{{/isBasicBasic}}
{{#isBasicBearer}}
// Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authorization: {{{name}}}
$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
// Configure API key authorization: {{{name}}}
$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');
{{/isApiKey}}
{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
{{/isOAuth}}{{/authMethods}}{{/hasAuthMethods}}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">{{apiSrcPath}}</directory>
<directory suffix=".php">{{modelSrcPath}}</directory>
</include>
</coverage>
<testsuites>
<testsuite name="tests">
<directory>{{apiTestPath}}</directory>
<directory>{{modelTestPath}}</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="E_ALL"/>
</php>
</phpunit>

View File

@ -0,0 +1,19 @@
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# makes sense since it's a library(client SDK) and not a project
composer.lock
# php-cs-fixer cache
.php_cs.cache
.php-cs-fixer.cache
# PHPUnit cache
.phpunit.result.cache
# PHPLint cache
build/phplint.cache

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,121 @@
.gitignore
.php-cs-fixer.dist.php
.phplint.yml
.travis.yml
README.md
composer.json
docs/Api/AnotherFakeApi.md
docs/Api/DefaultApi.md
docs/Api/FakeApi.md
docs/Api/FakeClassnameTags123Api.md
docs/Api/PetApi.md
docs/Api/StoreApi.md
docs/Api/UserApi.md
docs/Model/AdditionalPropertiesClass.md
docs/Model/AllOfWithSingleRef.md
docs/Model/Animal.md
docs/Model/ApiResponse.md
docs/Model/ArrayOfArrayOfNumberOnly.md
docs/Model/ArrayOfNumberOnly.md
docs/Model/ArrayTest.md
docs/Model/Capitalization.md
docs/Model/Cat.md
docs/Model/Category.md
docs/Model/ClassModel.md
docs/Model/Client.md
docs/Model/DeprecatedObject.md
docs/Model/Dog.md
docs/Model/EnumArrays.md
docs/Model/EnumClass.md
docs/Model/EnumTest.md
docs/Model/FakeBigDecimalMap200Response.md
docs/Model/File.md
docs/Model/FileSchemaTestClass.md
docs/Model/Foo.md
docs/Model/FooGetDefaultResponse.md
docs/Model/FormatTest.md
docs/Model/HasOnlyReadOnly.md
docs/Model/HealthCheckResult.md
docs/Model/MapTest.md
docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Model/Model200Response.md
docs/Model/ModelList.md
docs/Model/ModelReturn.md
docs/Model/Name.md
docs/Model/NullableClass.md
docs/Model/NumberOnly.md
docs/Model/ObjectWithDeprecatedFields.md
docs/Model/Order.md
docs/Model/OuterComposite.md
docs/Model/OuterEnum.md
docs/Model/OuterEnumDefaultValue.md
docs/Model/OuterEnumInteger.md
docs/Model/OuterEnumIntegerDefaultValue.md
docs/Model/OuterObjectWithEnumProperty.md
docs/Model/Pet.md
docs/Model/ReadOnlyFirst.md
docs/Model/SingleRefType.md
docs/Model/SpecialModelName.md
docs/Model/Tag.md
docs/Model/User.md
git_push.sh
phpunit.xml.dist
src/Api/AnotherFakeApi.php
src/Api/DefaultApi.php
src/Api/FakeApi.php
src/Api/FakeClassnameTags123Api.php
src/Api/PetApi.php
src/Api/StoreApi.php
src/Api/UserApi.php
src/ApiException.php
src/Configuration.php
src/HeaderSelector.php
src/Model/AdditionalPropertiesClass.php
src/Model/AllOfWithSingleRef.php
src/Model/Animal.php
src/Model/ApiResponse.php
src/Model/ArrayOfArrayOfNumberOnly.php
src/Model/ArrayOfNumberOnly.php
src/Model/ArrayTest.php
src/Model/Capitalization.php
src/Model/Cat.php
src/Model/Category.php
src/Model/ClassModel.php
src/Model/Client.php
src/Model/DeprecatedObject.php
src/Model/Dog.php
src/Model/EnumArrays.php
src/Model/EnumClass.php
src/Model/EnumTest.php
src/Model/FakeBigDecimalMap200Response.php
src/Model/File.php
src/Model/FileSchemaTestClass.php
src/Model/Foo.php
src/Model/FooGetDefaultResponse.php
src/Model/FormatTest.php
src/Model/HasOnlyReadOnly.php
src/Model/HealthCheckResult.php
src/Model/MapTest.php
src/Model/MixedPropertiesAndAdditionalPropertiesClass.php
src/Model/Model200Response.php
src/Model/ModelInterface.php
src/Model/ModelList.php
src/Model/ModelReturn.php
src/Model/Name.php
src/Model/NullableClass.php
src/Model/NumberOnly.php
src/Model/ObjectWithDeprecatedFields.php
src/Model/Order.php
src/Model/OuterComposite.php
src/Model/OuterEnum.php
src/Model/OuterEnumDefaultValue.php
src/Model/OuterEnumInteger.php
src/Model/OuterEnumIntegerDefaultValue.php
src/Model/OuterObjectWithEnumProperty.php
src/Model/Pet.php
src/Model/ReadOnlyFirst.php
src/Model/SingleRefType.php
src/Model/SpecialModelName.php
src/Model/Tag.php
src/Model/User.php
src/ObjectSerializer.php

View File

@ -0,0 +1 @@
7.0.1-SNAPSHOT

View File

@ -0,0 +1,29 @@
<?php
/**
* @generated
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
*/
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->exclude('test')
->exclude('tests')
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
'no_leading_import_slash' => false,
])
->setFinder($finder)
;

View File

@ -0,0 +1,23 @@
<?php
return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('test')
->exclude('tests')
->in(__DIR__)
);

View File

@ -0,0 +1,12 @@
path:
- ./lib
- ./test
- ./tests
jobs: 10
extensions:
- php
exclude:
- vendor
warning: true
memory-limit: -1
no-cache: true

View File

@ -0,0 +1,11 @@
path:
- ./src
- ./tests
jobs: 10
extensions:
- php
exclude:
- vendor
warning: true
memory-limit: -1
no-cache: true

View File

@ -0,0 +1,12 @@
language: php
# Jammy Jellyfish environment has preinstalled PHP 8.1
# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only
# https://docs.travis-ci.com/user/reference/jammy/#php-support
dist: jammy
os:
- linux
php:
- 8.0
- 8.1
before_install: "composer install"
script: "vendor/bin/phpunit"

View File

@ -0,0 +1,225 @@
# OpenAPIClient-php
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
## Installation & Usage
### Requirements
PHP 8.0 and later.
### Composer
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
```json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\AnotherFakeApi(
// 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()
);
$client = new \OpenAPI\Client\Model\Client(); // \OpenAPI\Client\Model\Client | client model
try {
$result = $apiInstance->call123TestSpecialTags($client);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->call123TestSpecialTags: ', $e->getMessage(), PHP_EOL;
}
```
## API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo |
*FakeApi* | [**fakeBigDecimalMap**](docs/Api/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap |
*FakeApi* | [**fakeHealthGet**](docs/Api/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**fakeHttpSignatureTest**](docs/Api/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
*FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**testGroupParameters**](docs/Api/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**testInlineAdditionalProperties**](docs/Api/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**testJsonFormData**](docs/Api/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**testQueryParameterCollectionFormat**](docs/Api/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters |
*FakeClassnameTags123Api* | [**testClassname**](docs/Api/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**addPet**](docs/Api/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/Api/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/Api/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/Api/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/Api/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/Api/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/Api/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/Api/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**uploadFileWithRequiredFile**](docs/Api/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
*StoreApi* | [**deleteOrder**](docs/Api/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/Api/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/Api/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/Api/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/Api/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/Api/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/Api/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/Api/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/Api/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/Api/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/Api/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/Api/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
## Models
- [AdditionalPropertiesClass](docs/Model/AdditionalPropertiesClass.md)
- [AllOfWithSingleRef](docs/Model/AllOfWithSingleRef.md)
- [Animal](docs/Model/Animal.md)
- [ApiResponse](docs/Model/ApiResponse.md)
- [ArrayOfArrayOfNumberOnly](docs/Model/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/Model/ArrayOfNumberOnly.md)
- [ArrayTest](docs/Model/ArrayTest.md)
- [Capitalization](docs/Model/Capitalization.md)
- [Cat](docs/Model/Cat.md)
- [Category](docs/Model/Category.md)
- [ClassModel](docs/Model/ClassModel.md)
- [Client](docs/Model/Client.md)
- [DeprecatedObject](docs/Model/DeprecatedObject.md)
- [Dog](docs/Model/Dog.md)
- [EnumArrays](docs/Model/EnumArrays.md)
- [EnumClass](docs/Model/EnumClass.md)
- [EnumTest](docs/Model/EnumTest.md)
- [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md)
- [File](docs/Model/File.md)
- [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md)
- [Foo](docs/Model/Foo.md)
- [FooGetDefaultResponse](docs/Model/FooGetDefaultResponse.md)
- [FormatTest](docs/Model/FormatTest.md)
- [HasOnlyReadOnly](docs/Model/HasOnlyReadOnly.md)
- [HealthCheckResult](docs/Model/HealthCheckResult.md)
- [MapTest](docs/Model/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/Model/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](docs/Model/Model200Response.md)
- [ModelList](docs/Model/ModelList.md)
- [ModelReturn](docs/Model/ModelReturn.md)
- [Name](docs/Model/Name.md)
- [NullableClass](docs/Model/NullableClass.md)
- [NumberOnly](docs/Model/NumberOnly.md)
- [ObjectWithDeprecatedFields](docs/Model/ObjectWithDeprecatedFields.md)
- [Order](docs/Model/Order.md)
- [OuterComposite](docs/Model/OuterComposite.md)
- [OuterEnum](docs/Model/OuterEnum.md)
- [OuterEnumDefaultValue](docs/Model/OuterEnumDefaultValue.md)
- [OuterEnumInteger](docs/Model/OuterEnumInteger.md)
- [OuterEnumIntegerDefaultValue](docs/Model/OuterEnumIntegerDefaultValue.md)
- [OuterObjectWithEnumProperty](docs/Model/OuterObjectWithEnumProperty.md)
- [Pet](docs/Model/Pet.md)
- [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md)
- [SingleRefType](docs/Model/SingleRefType.md)
- [SpecialModelName](docs/Model/SpecialModelName.md)
- [Tag](docs/Model/Tag.md)
- [User](docs/Model/User.md)
## Authorization
### petstore_auth
- **Type**: `OAuth`
- **Flow**: `implicit`
- **Authorization URL**: `http://petstore.swagger.io/api/oauth/dialog`
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### api_key_query
- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
### http_basic_test
- **Type**: HTTP basic authentication
### bearer_test
- **Type**: Bearer authentication (JWT)
### http_signature_test
## Tests
To run the tests, use:
```bash
composer install
vendor/bin/phpunit
```
## Author
## About this package
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: `1.0.0`
- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen`

View File

@ -0,0 +1,45 @@
{
"description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\",
"keywords": [
"openapitools",
"openapi-generator",
"openapi",
"php",
"sdk",
"rest",
"api"
],
"homepage": "https://openapi-generator.tech",
"license": "unlicense",
"authors": [
{
"name": "OpenAPI-Generator contributors",
"homepage": "https://openapi-generator.tech"
}
],
"require": {
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.5",
"overtrue/phplint": "^9.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": { "OpenAPI\\Client\\" : "src/" }
},
"autoload-dev": {
"psr-4": { "OpenAPI\\Client\\Test\\" : "tests/" }
},
"scripts": {
"test": [
"@phplint"
],
"phplint": "phplint"
}
}

View File

@ -0,0 +1,64 @@
# OpenAPI\Client\AnotherFakeApi
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**call123TestSpecialTags()**](AnotherFakeApi.md#call123TestSpecialTags) | **PATCH** /another-fake/dummy | To test special tags |
## `call123TestSpecialTags()`
```php
call123TestSpecialTags($client): \OpenAPI\Client\Model\Client
```
To test special tags
To test special tags and operation ID starting with number
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\AnotherFakeApi(
// 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()
);
$client = new \OpenAPI\Client\Model\Client(); // \OpenAPI\Client\Model\Client | client model
try {
$result = $apiInstance->call123TestSpecialTags($client);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->call123TestSpecialTags: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **client** | [**\OpenAPI\Client\Model\Client**](../Model/Client.md)| client model | |
### Return type
[**\OpenAPI\Client\Model\Client**](../Model/Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

View File

@ -0,0 +1,59 @@
# OpenAPI\Client\DefaultApi
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**fooGet()**](DefaultApi.md#fooGet) | **GET** /foo | |
## `fooGet()`
```php
fooGet(): \OpenAPI\Client\Model\FooGetDefaultResponse
```
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\DefaultApi(
// 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()
);
try {
$result = $apiInstance->fooGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->fooGet: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**\OpenAPI\Client\Model\FooGetDefaultResponse**](../Model/FooGetDefaultResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
# OpenAPI\Client\FakeClassnameTags123Api
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**testClassname()**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case |
## `testClassname()`
```php
testClassname($client): \OpenAPI\Client\Model\Client
```
To test class name in snake case
To test class name in snake case
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key_query
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key_query', 'Bearer');
$apiInstance = new OpenAPI\Client\Api\FakeClassnameTags123Api(
// 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(),
$config
);
$client = new \OpenAPI\Client\Model\Client(); // \OpenAPI\Client\Model\Client | client model
try {
$result = $apiInstance->testClassname($client);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FakeClassnameTags123Api->testClassname: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **client** | [**\OpenAPI\Client\Model\Client**](../Model/Client.md)| client model | |
### Return type
[**\OpenAPI\Client\Model\Client**](../Model/Client.md)
### Authorization
[api_key_query](../../README.md#api_key_query)
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

View File

@ -0,0 +1,614 @@
# OpenAPI\Client\PetApi
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**addPet()**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store |
| [**deletePet()**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet |
| [**findPetsByStatus()**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status |
| [**findPetsByTags()**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags |
| [**getPetById()**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID |
| [**updatePet()**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet |
| [**updatePetWithForm()**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data |
| [**uploadFile()**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image |
| [**uploadFileWithRequiredFile()**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) |
## `addPet()`
```php
addPet($pet)
```
### URI(s):
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
- Variables:
- server: target server
- Allowed values:
- petstore
- qa-petstore
- dev-petstore
- Default value: petstore
- port: No description provided
- Allowed values:
- 80
- 8080
- Default value: 80
Add a new pet to the store
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store
$hostIndex = 0;
$variables = [
];
try {
$apiInstance->addPet($pet, $hostIndex, $variables);
} catch (Exception $e) {
echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | |
| 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] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: `application/json`, `application/xml`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `deletePet()`
```php
deletePet($pet_id, $api_key)
```
Deletes a pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet_id = 56; // int | Pet id to delete
$api_key = 'api_key_example'; // string
try {
$apiInstance->deletePet($pet_id, $api_key);
} catch (Exception $e) {
echo 'Exception when calling PetApi->deletePet: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet_id** | **int**| Pet id to delete | |
| **api_key** | **string**| | [optional] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `findPetsByStatus()`
```php
findPetsByStatus($status): \OpenAPI\Client\Model\Pet[]
```
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$status = array('status_example'); // string[] | Status values that need to be considered for filter
try {
$result = $apiInstance->findPetsByStatus($status);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->findPetsByStatus: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **status** | [**string[]**](../Model/string.md)| Status values that need to be considered for filter | |
### Return type
[**\OpenAPI\Client\Model\Pet[]**](../Model/Pet.md)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `findPetsByTags()`
```php
findPetsByTags($tags): \OpenAPI\Client\Model\Pet[]
```
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$tags = array('tags_example'); // string[] | Tags to filter by
try {
$result = $apiInstance->findPetsByTags($tags);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->findPetsByTags: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **tags** | [**string[]**](../Model/string.md)| Tags to filter by | |
### Return type
[**\OpenAPI\Client\Model\Pet[]**](../Model/Pet.md)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `getPetById()`
```php
getPetById($pet_id): \OpenAPI\Client\Model\Pet
```
Find pet by ID
Returns a single pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet_id = 56; // int | ID of pet to return
try {
$result = $apiInstance->getPetById($pet_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->getPetById: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet_id** | **int**| ID of pet to return | |
### Return type
[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
### Authorization
[api_key](../../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `updatePet()`
```php
updatePet($pet)
```
### URI(s):
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
- Variables:
- server: target server
- Allowed values:
- petstore
- qa-petstore
- dev-petstore
- Default value: petstore
- port: No description provided
- Allowed values:
- 80
- 8080
- Default value: 80
Update an existing pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store
$hostIndex = 0;
$variables = [
];
try {
$apiInstance->updatePet($pet, $hostIndex, $variables);
} catch (Exception $e) {
echo 'Exception when calling PetApi->updatePet: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | |
| 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] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: `application/json`, `application/xml`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `updatePetWithForm()`
```php
updatePetWithForm($pet_id, $name, $status)
```
Updates a pet in the store with form data
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet_id = 56; // int | ID of pet that needs to be updated
$name = 'name_example'; // string | Updated name of the pet
$status = 'status_example'; // string | Updated status of the pet
try {
$apiInstance->updatePetWithForm($pet_id, $name, $status);
} catch (Exception $e) {
echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet_id** | **int**| ID of pet that needs to be updated | |
| **name** | **string**| Updated name of the pet | [optional] |
| **status** | **string**| Updated status of the pet | [optional] |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: `application/x-www-form-urlencoded`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `uploadFile()`
```php
uploadFile($pet_id, $additional_metadata, $file): \OpenAPI\Client\Model\ApiResponse
```
uploads an image
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet_id = 56; // int | ID of pet to update
$additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server
$file = "/path/to/file.txt"; // \SplFileObject | file to upload
try {
$result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet_id** | **int**| ID of pet to update | |
| **additional_metadata** | **string**| Additional data to pass to server | [optional] |
| **file** | **\SplFileObject****\SplFileObject**| file to upload | [optional] |
### Return type
[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: `multipart/form-data`
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `uploadFileWithRequiredFile()`
```php
uploadFileWithRequiredFile($pet_id, $required_file, $additional_metadata): \OpenAPI\Client\Model\ApiResponse
```
uploads an image (required)
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\PetApi(
// 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(),
$config
);
$pet_id = 56; // int | ID of pet to update
$required_file = "/path/to/file.txt"; // \SplFileObject | file to upload
$additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server
try {
$result = $apiInstance->uploadFileWithRequiredFile($pet_id, $required_file, $additional_metadata);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->uploadFileWithRequiredFile: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet_id** | **int**| ID of pet to update | |
| **required_file** | **\SplFileObject****\SplFileObject**| file to upload | |
| **additional_metadata** | **string**| Additional data to pass to server | [optional] |
### Return type
[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md)
### Authorization
[petstore_auth](../../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: `multipart/form-data`
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

View File

@ -0,0 +1,237 @@
# OpenAPI\Client\StoreApi
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**deleteOrder()**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID |
| [**getInventory()**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status |
| [**getOrderById()**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID |
| [**placeOrder()**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet |
## `deleteOrder()`
```php
deleteOrder($order_id)
```
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\StoreApi(
// 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()
);
$order_id = 'order_id_example'; // string | ID of the order that needs to be deleted
try {
$apiInstance->deleteOrder($order_id);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->deleteOrder: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **order_id** | **string**| ID of the order that needs to be deleted | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `getInventory()`
```php
getInventory(): array<string,int>
```
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer');
$apiInstance = new OpenAPI\Client\Api\StoreApi(
// 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(),
$config
);
try {
$result = $apiInstance->getInventory();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->getInventory: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**array<string,int>**
### Authorization
[api_key](../../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `getOrderById()`
```php
getOrderById($order_id): \OpenAPI\Client\Model\Order
```
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\StoreApi(
// 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()
);
$order_id = 56; // int | ID of pet that needs to be fetched
try {
$result = $apiInstance->getOrderById($order_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->getOrderById: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **order_id** | **int**| ID of pet that needs to be fetched | |
### Return type
[**\OpenAPI\Client\Model\Order**](../Model/Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `placeOrder()`
```php
placeOrder($order): \OpenAPI\Client\Model\Order
```
Place an order for a pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\StoreApi(
// 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()
);
$order = new \OpenAPI\Client\Model\Order(); // \OpenAPI\Client\Model\Order | order placed for purchasing the pet
try {
$result = $apiInstance->placeOrder($order);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->placeOrder: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **order** | [**\OpenAPI\Client\Model\Order**](../Model/Order.md)| order placed for purchasing the pet | |
### Return type
[**\OpenAPI\Client\Model\Order**](../Model/Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

View File

@ -0,0 +1,458 @@
# OpenAPI\Client\UserApi
All URIs are relative to http://petstore.swagger.io:80/v2, except if the operation defines another base path.
| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**createUser()**](UserApi.md#createUser) | **POST** /user | Create user |
| [**createUsersWithArrayInput()**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array |
| [**createUsersWithListInput()**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array |
| [**deleteUser()**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user |
| [**getUserByName()**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name |
| [**loginUser()**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system |
| [**logoutUser()**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session |
| [**updateUser()**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user |
## `createUser()`
```php
createUser($user)
```
Create user
This can only be done by the logged in user.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$user = new \OpenAPI\Client\Model\User(); // \OpenAPI\Client\Model\User | Created user object
try {
$apiInstance->createUser($user);
} catch (Exception $e) {
echo 'Exception when calling UserApi->createUser: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **user** | [**\OpenAPI\Client\Model\User**](../Model/User.md)| Created user object | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `createUsersWithArrayInput()`
```php
createUsersWithArrayInput($user)
```
Creates list of users with given input array
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
try {
$apiInstance->createUsersWithArrayInput($user);
} catch (Exception $e) {
echo 'Exception when calling UserApi->createUsersWithArrayInput: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `createUsersWithListInput()`
```php
createUsersWithListInput($user)
```
Creates list of users with given input array
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object
try {
$apiInstance->createUsersWithListInput($user);
} catch (Exception $e) {
echo 'Exception when calling UserApi->createUsersWithListInput: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `deleteUser()`
```php
deleteUser($username)
```
Delete user
This can only be done by the logged in user.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$username = 'username_example'; // string | The name that needs to be deleted
try {
$apiInstance->deleteUser($username);
} catch (Exception $e) {
echo 'Exception when calling UserApi->deleteUser: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **username** | **string**| The name that needs to be deleted | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `getUserByName()`
```php
getUserByName($username): \OpenAPI\Client\Model\User
```
Get user by user name
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$username = 'username_example'; // string | The name that needs to be fetched. Use user1 for testing.
try {
$result = $apiInstance->getUserByName($username);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->getUserByName: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **username** | **string**| The name that needs to be fetched. Use user1 for testing. | |
### Return type
[**\OpenAPI\Client\Model\User**](../Model/User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `loginUser()`
```php
loginUser($username, $password): string
```
Logs user into the system
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$username = 'username_example'; // string | The user name for login
$password = 'password_example'; // string | The password for login in clear text
try {
$result = $apiInstance->loginUser($username, $password);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->loginUser: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **username** | **string**| The user name for login | |
| **password** | **string**| The password for login in clear text | |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: `application/xml`, `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `logoutUser()`
```php
logoutUser()
```
Logs out current logged in user session
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
try {
$apiInstance->logoutUser();
} catch (Exception $e) {
echo 'Exception when calling UserApi->logoutUser: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `updateUser()`
```php
updateUser($username, $user)
```
Updated user
This can only be done by the logged in user.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\UserApi(
// 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()
);
$username = 'username_example'; // string | name that need to be deleted
$user = new \OpenAPI\Client\Model\User(); // \OpenAPI\Client\Model\User | Updated user object
try {
$apiInstance->updateUser($username, $user);
} catch (Exception $e) {
echo 'Exception when calling UserApi->updateUser: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **username** | **string**| name that need to be deleted | |
| **user** | [**\OpenAPI\Client\Model\User**](../Model/User.md)| Updated user object | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**map_property** | **array<string,string>** | | [optional]
**map_of_map_property** | **array<string,array<string,string>>** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # AllOfWithSingleRef
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**username** | **string** | | [optional]
**single_ref_type** | [**\OpenAPI\Client\Model\SingleRefType**](SingleRefType.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **string** | |
**color** | **string** | | [optional] [default to 'red']
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,11 @@
# # ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional]
**type** | **string** | | [optional]
**message** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_array_number** | **float[][]** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_number** | **float[]** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,11 @@
# # ArrayTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_of_string** | **string[]** | | [optional]
**array_array_of_integer** | **int[][]** | | [optional]
**array_array_of_model** | **\OpenAPI\Client\Model\ReadOnlyFirst[][]** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,14 @@
# # Capitalization
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**small_camel** | **string** | | [optional]
**capital_camel** | **string** | | [optional]
**small_snake** | **string** | | [optional]
**capital_snake** | **string** | | [optional]
**sca_eth_flow_points** | **string** | | [optional]
**att_name** | **string** | Name of the pet | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # CatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **string** | | [default to 'default-name']
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # ClassModel
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_class** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # Client
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # DeprecatedObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # DogAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_symbol** | **string** | | [optional]
**array_enum** | **string[]** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # EnumClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,16 @@
# # EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enum_string** | **string** | | [optional]
**enum_string_required** | **string** | |
**enum_integer** | **int** | | [optional]
**enum_number** | **float** | | [optional]
**outer_enum** | [**\OpenAPI\Client\Model\OuterEnum**](OuterEnum.md) | | [optional]
**outer_enum_integer** | [**\OpenAPI\Client\Model\OuterEnumInteger**](OuterEnumInteger.md) | | [optional]
**outer_enum_default_value** | [**\OpenAPI\Client\Model\OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional]
**outer_enum_integer_default_value** | [**\OpenAPI\Client\Model\OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # FakeBigDecimalMap200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**some_id** | **float** | | [optional]
**some_map** | **array<string,float>** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # File
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**source_uri** | **string** | Test capitalization | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # FileSchemaTestClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**file** | [**\OpenAPI\Client\Model\File**](File.md) | | [optional]
**files** | [**\OpenAPI\Client\Model\File[]**](File.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # Foo
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **string** | | [optional] [default to 'bar']
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # FooGetDefaultResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string** | [**\OpenAPI\Client\Model\Foo**](Foo.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,24 @@
# # FormatTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**integer** | **int** | | [optional]
**int32** | **int** | | [optional]
**int64** | **int** | | [optional]
**number** | **float** | |
**float** | **float** | | [optional]
**double** | **float** | | [optional]
**decimal** | **float** | | [optional]
**string** | **string** | | [optional]
**byte** | **string** | |
**binary** | **\SplFileObject** | | [optional]
**date** | **\DateTime** | |
**date_time** | **\DateTime** | | [optional]
**uuid** | **string** | | [optional]
**password** | **string** | |
**pattern_with_digits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **string** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # HasOnlyReadOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **string** | | [optional] [readonly]
**foo** | **string** | | [optional] [readonly]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # HealthCheckResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**nullable_message** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # InlineResponseDefault
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string** | [**\OpenAPI\Client\Model\Foo**](Foo.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,12 @@
# # MapTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**map_map_of_string** | **array<string,array<string,string>>** | | [optional]
**map_of_enum_string** | **array<string,string>** | | [optional]
**direct_map** | **array<string,bool>** | | [optional]
**indirect_map** | **array<string,bool>** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,11 @@
# # MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uuid** | **string** | | [optional]
**date_time** | **\DateTime** | | [optional]
**map** | [**array<string,\OpenAPI\Client\Model\Animal>**](Animal.md) | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # Model200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | | [optional]
**class** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # ModelList
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123_list** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**return** | **int** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,12 @@
# # Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | |
**snake_case** | **int** | | [optional] [readonly]
**property** | **string** | | [optional]
**_123_number** | **int** | | [optional] [readonly]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,20 @@
# # NullableClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**integer_prop** | **int** | | [optional]
**number_prop** | **float** | | [optional]
**boolean_prop** | **bool** | | [optional]
**string_prop** | **string** | | [optional]
**date_prop** | **\DateTime** | | [optional]
**datetime_prop** | **\DateTime** | | [optional]
**array_nullable_prop** | **object[]** | | [optional]
**array_and_items_nullable_prop** | **object[]** | | [optional]
**array_items_nullable** | **object[]** | | [optional]
**object_nullable_prop** | **array<string,object>** | | [optional]
**object_and_items_nullable_prop** | **array<string,object>** | | [optional]
**object_items_nullable** | **array<string,object>** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # NumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_number** | **float** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,12 @@
# # ObjectWithDeprecatedFields
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uuid** | **string** | | [optional]
**id** | **float** | | [optional]
**deprecated_ref** | [**\OpenAPI\Client\Model\DeprecatedObject**](DeprecatedObject.md) | | [optional]
**bars** | **string[]** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,14 @@
# # Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**pet_id** | **int** | | [optional]
**quantity** | **int** | | [optional]
**ship_date** | **\DateTime** | | [optional]
**status** | **string** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,11 @@
# # OuterComposite
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**my_number** | **float** | | [optional]
**my_string** | **string** | | [optional]
**my_boolean** | **bool** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # OuterEnum
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # OuterEnumDefaultValue
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # OuterEnumInteger
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # OuterEnumIntegerDefaultValue
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # OuterObjectWithEnumProperty
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**\OpenAPI\Client\Model\OuterEnumInteger**](OuterEnumInteger.md) | |
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,14 @@
# # Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional]
**name** | **string** | |
**photo_urls** | **string[]** | |
**tags** | [**\OpenAPI\Client\Model\Tag[]**](Tag.md) | | [optional]
**status** | **string** | pet status in the store | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **string** | | [optional] [readonly]
**baz** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,8 @@
# # SingleRefType
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,9 @@
# # SpecialModelName
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**special_property_name** | **int** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,10 @@
# # Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **string** | | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,16 @@
# # User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**username** | **string** | | [optional]
**first_name** | **string** | | [optional]
**last_name** | **string** | | [optional]
**email** | **string** | | [optional]
**password** | **string** | | [optional]
**phone** | **string** | | [optional]
**user_status** | **int** | User Status | [optional]
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

View File

@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,425 @@
<?php
/**
* AnotherFakeApi
* PHP version 8.0
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
* @generated Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.3.0-SNAPSHOT
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace OpenAPI\Client\Api;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
use OpenAPI\Client\ObjectSerializer;
/**
* AnotherFakeApi Class Doc Comment
*
* @category Class
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class AnotherFakeApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'call123TestSpecialTags' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation call123TestSpecialTags
*
* To test special tags
*
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Client
*/
public function call123TestSpecialTags($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
{
list($response) = $this->call123TestSpecialTagsWithHttpInfo($client, $contentType);
return $response;
}
/**
* Operation call123TestSpecialTagsWithHttpInfo
*
* To test special tags
*
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/
public function call123TestSpecialTagsWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
{
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\OpenAPI\Client\Model\Client' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Client', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\OpenAPI\Client\Model\Client';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\OpenAPI\Client\Model\Client',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation call123TestSpecialTagsAsync
*
* To test special tags
*
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function call123TestSpecialTagsAsync($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
{
return $this->call123TestSpecialTagsAsyncWithHttpInfo($client, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation call123TestSpecialTagsAsyncWithHttpInfo
*
* To test special tags
*
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function call123TestSpecialTagsAsyncWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
{
$returnType = '\OpenAPI\Client\Model\Client';
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'call123TestSpecialTags'
*
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function call123TestSpecialTagsRequest($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
{
// verify the required parameter 'client' is set
if ($client === null || (is_array($client) && count($client) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $client when calling call123TestSpecialTags'
);
}
$resourcePath = '/another-fake/dummy';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($client)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client));
} else {
$httpBody = $client;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}

Some files were not shown because too many files have changed in this diff Show More