[php] 2.3 - fix form params json encoding (#5701)

* fixed tests expectations not compatible with phpunit 4

* added test and endpoint definition, updated template

* regenerated sample

* regenerated security sample
This commit is contained in:
baartosz
2017-06-04 18:36:40 +02:00
committed by wing328
parent 08a11c1d75
commit d7202a7c76
14 changed files with 681 additions and 337 deletions

View File

@@ -126,6 +126,17 @@ class FakeApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -141,22 +152,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -273,6 +276,17 @@ class FakeApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -288,22 +302,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -420,6 +426,17 @@ class FakeApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -435,22 +452,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -567,6 +576,17 @@ class FakeApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -582,22 +602,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
[],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -718,6 +730,17 @@ class FakeApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -733,22 +756,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -1004,6 +1019,17 @@ class FakeApi
$formParams['callback'] = ObjectSerializer::toFormValue($callback);
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml; charset=utf-8', 'application/json; charset=utf-8']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml; charset=utf-8', 'application/json; charset=utf-8'],
['application/xml; charset=utf-8', 'application/json; charset=utf-8']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -1019,22 +1045,14 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml; charset=utf-8', 'application/json; charset=utf-8']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml; charset=utf-8', 'application/json; charset=utf-8'],
['application/xml; charset=utf-8', 'application/json; charset=utf-8']
);
}
// this endpoint requires HTTP basic authentication
if ($this->config->getUsername() !== null || $this->config->getPassword() !== null) {
$headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
@@ -1183,6 +1201,17 @@ class FakeApi
$formParams['enum_query_double'] = ObjectSerializer::toFormValue($enum_query_double);
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['*/*']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['*/*'],
['*/*']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -1198,22 +1227,158 @@ class FakeApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$request = new Request(
'GET',
$url,
$headers,
$httpBody
);
try {
try {
$response = $this->client->send($request);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
"[$statusCode] Error connecting to the API ($url)",
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation testJsonFormData
*
* test json serialization of form data
*
* @param string $param field1 (required)
* @param string $param2 field2 (required)
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testJsonFormData($param, $param2)
{
$this->testJsonFormDataWithHttpInfo($param, $param2);
}
/**
* Operation testJsonFormDataWithHttpInfo
*
* test json serialization of form data
*
* @param string $param field1 (required)
* @param string $param2 field2 (required)
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function testJsonFormDataWithHttpInfo($param, $param2)
{
// verify the required parameter 'param' is set
if ($param === null) {
throw new \InvalidArgumentException('Missing the required parameter $param when calling testJsonFormData');
}
// verify the required parameter 'param2' is set
if ($param2 === null) {
throw new \InvalidArgumentException('Missing the required parameter $param2 when calling testJsonFormData');
}
$resourcePath = '/fake/jsonFormData';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$returnType = '';
// form params
if ($param !== null) {
$formParams['param'] = ObjectSerializer::toFormValue($param);
}
// form params
if ($param2 !== null) {
$formParams['param2'] = ObjectSerializer::toFormValue($param2);
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['*/*']
[]
);
} else {
$headers = $this->headerSelector->selectHeaders(
['*/*'],
['*/*']
[],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');

View File

@@ -130,6 +130,17 @@ class Fake_classname_tags123Api
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -145,22 +156,14 @@ class Fake_classname_tags123Api
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/json']
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');

View File

@@ -129,6 +129,17 @@ class PetApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/json', 'application/xml']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -144,22 +155,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/json', 'application/xml']
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -270,6 +273,17 @@ class PetApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -285,22 +299,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -409,6 +415,17 @@ class PetApi
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -424,22 +441,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -566,6 +575,17 @@ class PetApi
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -581,22 +601,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -720,6 +732,17 @@ class PetApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -735,22 +758,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('api_key');
if ($apiKey !== null) {
@@ -875,6 +890,17 @@ class PetApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/json', 'application/xml']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -890,22 +916,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/json', 'application/xml']
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -1022,6 +1040,17 @@ class PetApi
$formParams['status'] = ObjectSerializer::toFormValue($status);
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/x-www-form-urlencoded']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -1037,22 +1066,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
['application/x-www-form-urlencoded']
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
@@ -1171,6 +1192,17 @@ class PetApi
$formParams['file'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue($file), 'rb');
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['multipart/form-data']
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -1186,22 +1218,14 @@ class PetApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['multipart/form-data']
);
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();

View File

@@ -128,6 +128,17 @@ class StoreApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -143,22 +154,14 @@ class StoreApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -250,6 +253,17 @@ class StoreApi
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -265,22 +279,14 @@ class StoreApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
);
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('api_key');
if ($apiKey !== null) {
@@ -412,6 +418,17 @@ class StoreApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -427,22 +444,14 @@ class StoreApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -563,6 +572,17 @@ class StoreApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -578,22 +598,14 @@ class StoreApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');

View File

@@ -129,6 +129,17 @@ class UserApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -144,22 +155,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -261,6 +264,17 @@ class UserApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -276,22 +290,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -393,6 +399,17 @@ class UserApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -408,22 +425,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -524,6 +533,17 @@ class UserApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -539,22 +559,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -656,6 +668,17 @@ class UserApi
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -671,22 +694,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -816,6 +831,17 @@ class UserApi
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -831,22 +857,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -955,6 +973,17 @@ class UserApi
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -970,22 +999,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');
@@ -1097,6 +1118,17 @@ class UserApi
$_tempBody = $body;
}
if ($multipart) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
@@ -1112,22 +1144,14 @@ class UserApi
}
$httpBody = new MultipartStream($multipartContents); // for HTTP post (form)
} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
$httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form)
}
}
if ($httpBody instanceof MultipartStream) {
$headers= $this->headerSelector->selectHeadersForMultipart(
['application/xml', 'application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/xml', 'application/json'],
[]
);
}
$query = \GuzzleHttp\Psr7\build_query($queryParams);
$url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');