Skip to content

Commit

Permalink
Regenerate API from Swagger definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Healyhatman committed Feb 15, 2022
1 parent 18a0925 commit 0a30232
Show file tree
Hide file tree
Showing 26 changed files with 1,688 additions and 0 deletions.
256 changes: 256 additions & 0 deletions src/lib/Api/BrandApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,262 @@ protected function brandReportGetRequest($brand_id, $request_email_addresses = n
);
}

/**
* Operation cancelBusinessCancel
*
* Cancel Business
*
* @param int $business_id business_id (required)
* @param string $brand_id brand_id (required)
*
* @throws \Swagger\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function cancelBusinessCancel($business_id, $brand_id)
{
$this->cancelBusinessCancelWithHttpInfo($business_id, $brand_id);
}

/**
* Operation cancelBusinessCancelWithHttpInfo
*
* Cancel Business
*
* @param int $business_id (required)
* @param string $brand_id (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 cancelBusinessCancelWithHttpInfo($business_id, $brand_id)
{
$returnType = '';
$request = $this->cancelBusinessCancelRequest($business_id, $brand_id);

try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
);
}

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$response->getBody()
);
}

return [null, $statusCode, $response->getHeaders()];

} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}

/**
* Operation cancelBusinessCancelAsync
*
* Cancel Business
*
* @param int $business_id (required)
* @param string $brand_id (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelBusinessCancelAsync($business_id, $brand_id)
{
return $this->cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id)
->then(
function ($response) {
return $response[0];
}
);
}

/**
* Operation cancelBusinessCancelAsyncWithHttpInfo
*
* Cancel Business
*
* @param int $business_id (required)
* @param string $brand_id (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelBusinessCancelAsyncWithHttpInfo($business_id, $brand_id)
{
$returnType = '';
$request = $this->cancelBusinessCancelRequest($business_id, $brand_id);

return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $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(),
$response->getBody()
);
}
);
}

/**
* Create request for operation 'cancelBusinessCancel'
*
* @param int $business_id (required)
* @param string $brand_id (required)
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelBusinessCancelRequest($business_id, $brand_id)
{
// verify the required parameter 'business_id' is set
if ($business_id === null || (is_array($business_id) && count($business_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $business_id when calling cancelBusinessCancel'
);
}
// verify the required parameter 'brand_id' is set
if ($brand_id === null || (is_array($brand_id) && count($brand_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $brand_id when calling cancelBusinessCancel'
);
}

$resourcePath = '/api/v2/brand/{brandId}/business/{businessId}/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;


// path params
if ($business_id !== null) {
$resourcePath = str_replace(
'{' . 'businessId' . '}',
ObjectSerializer::toPathValue($business_id),
$resourcePath
);
}
// path params
if ($brand_id !== null) {
$resourcePath = str_replace(
'{' . 'brandId' . '}',
ObjectSerializer::toPathValue($brand_id),
$resourcePath
);
}

// body params
$_tempBody = null;

if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json', 'text/json', 'application/xml', 'text/xml']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json', 'text/json', 'application/xml', 'text/xml'],
[]
);
}

// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;

if($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass) {
$httpBody = \GuzzleHttp\json_encode($httpBody);
}
// array has no __toString(), so we should encode it manually
if(is_array($httpBody)) {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));
}
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);

} elseif ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);

} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}

// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('apiKey');
if ($apiKey !== null) {
$headers['apiKey'] = $apiKey;
}

$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}

$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);

$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'DELETE',
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}

/**
* Create http client option
*
Expand Down
Loading

0 comments on commit 0a30232

Please sign in to comment.