diff --git a/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php index 1882abef..3e354a07 100644 --- a/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php +++ b/codegen/Crm/Extensions/Calling/Api/ChannelConnectionSettingsApi.php @@ -1,7 +1,7 @@ [ + 'create' => [ 'application/json', ], - 'create' => [ + 'get' => [ 'application/json', ], - 'getById' => [ + 'remove' => [ 'application/json', ], 'update' => [ @@ -132,37 +135,40 @@ public function getConfig() } /** - * Operation archive + * Operation create * - * Delete channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function archive($app_id, string $contentType = self::contentTypes['archive'][0]) + public function create($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) { - $this->archiveWithHttpInfo($app_id, $contentType); + list($response) = $this->createWithHttpInfo($app_id, $channel_connection_settings_request, $contentType); + return $response; } /** - * Operation archiveWithHttpInfo + * Operation createWithHttpInfo * - * Delete channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) { - $request = $this->archiveRequest($app_id, $contentType); + $request = $this->createRequest($app_id, $channel_connection_settings_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -187,10 +193,51 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); + } + + + + 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() + ); + } + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -198,26 +245,29 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation archiveAsync + * Operation createAsync * - * Delete channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsync($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) { - return $this->archiveAsyncWithHttpInfo($app_id, $contentType) + return $this->createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, $contentType) ->then( function ($response) { return $response[0]; @@ -226,26 +276,40 @@ function ($response) { } /** - * Operation archiveAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Delete channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) { - $returnType = ''; - $request = $this->archiveRequest($app_id, $contentType); + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; + $request = $this->createRequest($app_id, $channel_connection_settings_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -265,21 +329,29 @@ function ($exception) { } /** - * Create request for operation 'archive' + * Create request for operation 'create' * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createRequest($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling archive' + 'Missing the required parameter $app_id when calling create' + ); + } + + // verify the required parameter 'channel_connection_settings_request' is set + if ($channel_connection_settings_request === null || (is_array($channel_connection_settings_request) && count($channel_connection_settings_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $channel_connection_settings_request when calling create' ); } @@ -304,13 +376,20 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($channel_connection_settings_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_request)); + } else { + $httpBody = $channel_connection_settings_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -354,7 +433,7 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -362,40 +441,38 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes } /** - * Operation create + * Operation get * - * Configure channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request channel_connection_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function create($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + public function get($app_id, string $contentType = self::contentTypes['get'][0]) { - list($response) = $this->createWithHttpInfo($app_id, $channel_connection_settings_request, $contentType); + list($response) = $this->getWithHttpInfo($app_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getWithHttpInfo * - * Configure channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + public function getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { - $request = $this->createRequest($app_id, $channel_connection_settings_request, $contentType); + $request = $this->getRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -422,61 +499,21 @@ public function createWithHttpInfo($app_id, $channel_connection_settings_request switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -490,34 +527,11 @@ public function createWithHttpInfo($app_id, $channel_connection_settings_request ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -527,7 +541,7 @@ public function createWithHttpInfo($app_id, $channel_connection_settings_request $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -535,27 +549,28 @@ public function createWithHttpInfo($app_id, $channel_connection_settings_request $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation createAsync + * Operation getAsync * - * Configure channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) { - return $this->createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, $contentType) + return $this->getAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -564,21 +579,20 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getAsyncWithHttpInfo * - * Configure channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - $request = $this->createRequest($app_id, $channel_connection_settings_request, $contentType); + $request = $this->getRequest($app_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -617,29 +631,21 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'get' * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsRequest $channel_connection_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($app_id, $channel_connection_settings_request, string $contentType = self::contentTypes['create'][0]) + public function getRequest($app_id, string $contentType = self::contentTypes['get'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling create' - ); - } - - // verify the required parameter 'channel_connection_settings_request' is set - if ($channel_connection_settings_request === null || (is_array($channel_connection_settings_request) && count($channel_connection_settings_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $channel_connection_settings_request when calling create' + 'Missing the required parameter $app_id when calling get' ); } @@ -670,14 +676,7 @@ public function createRequest($app_id, $channel_connection_settings_request, str ); // for model (json/xml) - if (isset($channel_connection_settings_request)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($channel_connection_settings_request)); - } else { - $httpBody = $channel_connection_settings_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -721,7 +720,7 @@ public function createRequest($app_id, $channel_connection_settings_request, str $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -729,38 +728,37 @@ public function createRequest($app_id, $channel_connection_settings_request, str } /** - * Operation getById + * Operation remove * - * Retrieve channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + * @return void */ - public function getById($app_id, string $contentType = self::contentTypes['getById'][0]) + public function remove($app_id, string $contentType = self::contentTypes['remove'][0]) { - list($response) = $this->getByIdWithHttpInfo($app_id, $contentType); - return $response; + $this->removeWithHttpInfo($app_id, $contentType); } /** - * Operation getByIdWithHttpInfo + * Operation removeWithHttpInfo * - * Retrieve channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) { - $request = $this->getByIdRequest($app_id, $contentType); + $request = $this->removeRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -785,114 +783,9 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - 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 = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -900,26 +793,28 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation getByIdAsync + * Operation removeAsync * - * Retrieve channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeAsync($app_id, string $contentType = self::contentTypes['remove'][0]) { - return $this->getByIdAsyncWithHttpInfo($app_id, $contentType) + return $this->removeAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -928,39 +823,26 @@ function ($response) { } /** - * Operation getByIdAsyncWithHttpInfo + * Operation removeAsyncWithHttpInfo * - * Retrieve channel connection settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - $request = $this->getByIdRequest($app_id, $contentType); + $returnType = ''; + $request = $this->removeRequest($app_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -980,21 +862,21 @@ function ($exception) { } /** - * Create request for operation 'getById' + * Create request for operation 'remove' * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeRequest($app_id, string $contentType = self::contentTypes['remove'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getById' + 'Missing the required parameter $app_id when calling remove' ); } @@ -1019,7 +901,7 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); @@ -1069,7 +951,7 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1079,9 +961,9 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes /** * Operation update * - * Update channel connection settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request channel_connection_settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1098,9 +980,9 @@ public function update($app_id, $channel_connection_settings_patch_request, stri /** * Operation updateWithHttpInfo * - * Update channel connection settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1137,61 +1019,21 @@ public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_r switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1205,34 +1047,11 @@ public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_r ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1242,7 +1061,7 @@ public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_r $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1250,8 +1069,10 @@ public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_r $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1259,9 +1080,9 @@ public function updateWithHttpInfo($app_id, $channel_connection_settings_patch_r /** * Operation updateAsync * - * Update channel connection settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1281,9 +1102,9 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update channel connection settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1334,7 +1155,7 @@ function ($exception) { /** * Create request for operation 'update' * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ChannelConnectionSettingsPatchRequest $channel_connection_settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1459,6 +1280,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php b/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php index 0c16ec06..25db10a7 100644 --- a/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php +++ b/codegen/Crm/Extensions/Calling/Api/RecordingSettingsApi.php @@ -1,7 +1,7 @@ [ + 'create' => [ 'application/json', ], - 'markAsReady' => [ + 'get' => [ 'application/json', ], - 'registerUrlFormat' => [ + 'markAsReady' => [ 'application/json', ], - 'updateUrlFormat' => [ + 'update' => [ 'application/json', ], ]; @@ -132,38 +135,40 @@ public function getConfig() } /** - * Operation getUrlFormat + * Operation create * - * Retrieve recording settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request recording_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function getUrlFormat($app_id, string $contentType = self::contentTypes['getUrlFormat'][0]) + public function create($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->getUrlFormatWithHttpInfo($app_id, $contentType); + list($response) = $this->createWithHttpInfo($app_id, $recording_settings_request, $contentType); return $response; } /** - * Operation getUrlFormatWithHttpInfo + * Operation createWithHttpInfo * - * Retrieve recording settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::contentTypes['getUrlFormat'][0]) + public function createWithHttpInfo($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) { - $request = $this->getUrlFormatRequest($app_id, $contentType); + $request = $this->createRequest($app_id, $recording_settings_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -190,61 +195,21 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -258,34 +223,11 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -295,7 +237,7 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -303,26 +245,29 @@ public function getUrlFormatWithHttpInfo($app_id, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation getUrlFormatAsync + * Operation createAsync * - * Retrieve recording settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUrlFormatAsync($app_id, string $contentType = self::contentTypes['getUrlFormat'][0]) + public function createAsync($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) { - return $this->getUrlFormatAsyncWithHttpInfo($app_id, $contentType) + return $this->createAsyncWithHttpInfo($app_id, $recording_settings_request, $contentType) ->then( function ($response) { return $response[0]; @@ -331,20 +276,21 @@ function ($response) { } /** - * Operation getUrlFormatAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Retrieve recording settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUrlFormatAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getUrlFormat'][0]) + public function createAsyncWithHttpInfo($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->getUrlFormatRequest($app_id, $contentType); + $request = $this->createRequest($app_id, $recording_settings_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -383,21 +329,29 @@ function ($exception) { } /** - * Create request for operation 'getUrlFormat' + * Create request for operation 'create' * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUrlFormat'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getUrlFormatRequest($app_id, string $contentType = self::contentTypes['getUrlFormat'][0]) + public function createRequest($app_id, $recording_settings_request, string $contentType = self::contentTypes['create'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getUrlFormat' + 'Missing the required parameter $app_id when calling create' + ); + } + + // verify the required parameter 'recording_settings_request' is set + if ($recording_settings_request === null || (is_array($recording_settings_request) && count($recording_settings_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $recording_settings_request when calling create' ); } @@ -428,7 +382,14 @@ public function getUrlFormatRequest($app_id, string $contentType = self::content ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($recording_settings_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($recording_settings_request)); + } else { + $httpBody = $recording_settings_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -472,7 +433,7 @@ public function getUrlFormatRequest($app_id, string $contentType = self::content $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -480,37 +441,38 @@ public function getUrlFormatRequest($app_id, string $contentType = self::content } /** - * Operation markAsReady + * Operation get * - * Mark recording as ready for transcription + * * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function markAsReady($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) + public function get($app_id, string $contentType = self::contentTypes['get'][0]) { - $this->markAsReadyWithHttpInfo($mark_recording_as_ready_request, $contentType); + list($response) = $this->getWithHttpInfo($app_id, $contentType); + return $response; } /** - * Operation markAsReadyWithHttpInfo + * Operation getWithHttpInfo * - * Mark recording as ready for transcription + * * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) + public function getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { - $request = $this->markAsReadyRequest($mark_recording_as_ready_request, $contentType); + $request = $this->getRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -535,10 +497,51 @@ public function markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $statusCode = $response->getStatusCode(); - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); + } + + + 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() + ); + } + + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -546,26 +549,28 @@ public function markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation markAsReadyAsync + * Operation getAsync * - * Mark recording as ready for transcription + * * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function markAsReadyAsync($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) + public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) { - return $this->markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, $contentType) + return $this->getAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -574,26 +579,39 @@ function ($response) { } /** - * Operation markAsReadyAsyncWithHttpInfo + * Operation getAsyncWithHttpInfo * - * Mark recording as ready for transcription + * * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) + public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { - $returnType = ''; - $request = $this->markAsReadyRequest($mark_recording_as_ready_request, $contentType); + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; + $request = $this->getRequest($app_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -613,26 +631,26 @@ function ($exception) { } /** - * Create request for operation 'markAsReady' + * Create request for operation 'get' * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function markAsReadyRequest($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) + public function getRequest($app_id, string $contentType = self::contentTypes['get'][0]) { - // verify the required parameter 'mark_recording_as_ready_request' is set - if ($mark_recording_as_ready_request === null || (is_array($mark_recording_as_ready_request) && count($mark_recording_as_ready_request) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $mark_recording_as_ready_request when calling markAsReady' + 'Missing the required parameter $app_id when calling get' ); } - $resourcePath = '/crm/v3/extensions/calling/recordings/ready'; + $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/recording'; $formParams = []; $queryParams = []; $headerParams = []; @@ -641,23 +659,24 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'appId' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($mark_recording_as_ready_request)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($mark_recording_as_ready_request)); - } else { - $httpBody = $mark_recording_as_ready_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -681,9 +700,10 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con } } - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); + if ($apiKey !== null) { + $queryParams['hapikey'] = $apiKey; } $defaultHeaders = []; @@ -700,7 +720,7 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -708,40 +728,37 @@ public function markAsReadyRequest($mark_recording_as_ready_request, string $con } /** - * Operation registerUrlFormat + * Operation markAsReady * - * Enable the app for call recording + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request recording_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerUrlFormat'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request mark_recording_as_ready_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + * @return void */ - public function registerUrlFormat($app_id, $recording_settings_request, string $contentType = self::contentTypes['registerUrlFormat'][0]) + public function markAsReady($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) { - list($response) = $this->registerUrlFormatWithHttpInfo($app_id, $recording_settings_request, $contentType); - return $response; + $this->markAsReadyWithHttpInfo($mark_recording_as_ready_request, $contentType); } /** - * Operation registerUrlFormatWithHttpInfo + * Operation markAsReadyWithHttpInfo * - * Enable the app for call recording + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerUrlFormat'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_request, string $contentType = self::contentTypes['registerUrlFormat'][0]) + public function markAsReadyWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) { - $request = $this->registerUrlFormatRequest($app_id, $recording_settings_request, $contentType); + $request = $this->markAsReadyRequest($mark_recording_as_ready_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -766,114 +783,9 @@ public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_reque $statusCode = $response->getStatusCode(); - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - 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 = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -881,27 +793,28 @@ public function registerUrlFormatWithHttpInfo($app_id, $recording_settings_reque $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation registerUrlFormatAsync + * Operation markAsReadyAsync * - * Enable the app for call recording + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerUrlFormat'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function registerUrlFormatAsync($app_id, $recording_settings_request, string $contentType = self::contentTypes['registerUrlFormat'][0]) + public function markAsReadyAsync($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) { - return $this->registerUrlFormatAsyncWithHttpInfo($app_id, $recording_settings_request, $contentType) + return $this->markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, $contentType) ->then( function ($response) { return $response[0]; @@ -910,40 +823,26 @@ function ($response) { } /** - * Operation registerUrlFormatAsyncWithHttpInfo + * Operation markAsReadyAsyncWithHttpInfo * - * Enable the app for call recording + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerUrlFormat'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function registerUrlFormatAsyncWithHttpInfo($app_id, $recording_settings_request, string $contentType = self::contentTypes['registerUrlFormat'][0]) + public function markAsReadyAsyncWithHttpInfo($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->registerUrlFormatRequest($app_id, $recording_settings_request, $contentType); + $returnType = ''; + $request = $this->markAsReadyRequest($mark_recording_as_ready_request, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -963,34 +862,26 @@ function ($exception) { } /** - * Create request for operation 'registerUrlFormat' + * Create request for operation 'markAsReady' * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsRequest $recording_settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerUrlFormat'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\MarkRecordingAsReadyRequest $mark_recording_as_ready_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsReady'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function registerUrlFormatRequest($app_id, $recording_settings_request, string $contentType = self::contentTypes['registerUrlFormat'][0]) + public function markAsReadyRequest($mark_recording_as_ready_request, string $contentType = self::contentTypes['markAsReady'][0]) { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling registerUrlFormat' - ); - } - - // verify the required parameter 'recording_settings_request' is set - if ($recording_settings_request === null || (is_array($recording_settings_request) && count($recording_settings_request) === 0)) { + // verify the required parameter 'mark_recording_as_ready_request' is set + if ($mark_recording_as_ready_request === null || (is_array($mark_recording_as_ready_request) && count($mark_recording_as_ready_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $recording_settings_request when calling registerUrlFormat' + 'Missing the required parameter $mark_recording_as_ready_request when calling markAsReady' ); } - $resourcePath = '/crm/v3/extensions/calling/{appId}/settings/recording'; + $resourcePath = '/crm/v3/extensions/calling/recordings/ready'; $formParams = []; $queryParams = []; $headerParams = []; @@ -999,29 +890,21 @@ public function registerUrlFormatRequest($app_id, $recording_settings_request, s - // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'appId' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); // for model (json/xml) - if (isset($recording_settings_request)) { + if (isset($mark_recording_as_ready_request)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($recording_settings_request)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($mark_recording_as_ready_request)); } else { - $httpBody = $recording_settings_request; + $httpBody = $mark_recording_as_ready_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1047,10 +930,9 @@ public function registerUrlFormatRequest($app_id, $recording_settings_request, s } } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('hapikey'); - if ($apiKey !== null) { - $queryParams['hapikey'] = $apiKey; + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; @@ -1075,40 +957,40 @@ public function registerUrlFormatRequest($app_id, $recording_settings_request, s } /** - * Operation updateUrlFormat + * Operation update * - * Update recording settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request recording_settings_patch_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUrlFormat'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function updateUrlFormat($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['updateUrlFormat'][0]) + public function update($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_request, $contentType); + list($response) = $this->updateWithHttpInfo($app_id, $recording_settings_patch_request, $contentType); return $response; } /** - * Operation updateUrlFormatWithHttpInfo + * Operation updateWithHttpInfo * - * Update recording settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUrlFormat'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['updateUrlFormat'][0]) + public function updateWithHttpInfo($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateUrlFormatRequest($app_id, $recording_settings_patch_request, $contentType); + $request = $this->updateRequest($app_id, $recording_settings_patch_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -1135,61 +1017,21 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1203,34 +1045,11 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1240,7 +1059,7 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1248,27 +1067,29 @@ public function updateUrlFormatWithHttpInfo($app_id, $recording_settings_patch_r $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation updateUrlFormatAsync + * Operation updateAsync * - * Update recording settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUrlFormat'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateUrlFormatAsync($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['updateUrlFormat'][0]) + public function updateAsync($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) { - return $this->updateUrlFormatAsyncWithHttpInfo($app_id, $recording_settings_patch_request, $contentType) + return $this->updateAsyncWithHttpInfo($app_id, $recording_settings_patch_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1277,21 +1098,21 @@ function ($response) { } /** - * Operation updateUrlFormatAsyncWithHttpInfo + * Operation updateAsyncWithHttpInfo * - * Update recording settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUrlFormat'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateUrlFormatAsyncWithHttpInfo($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['updateUrlFormat'][0]) + public function updateAsyncWithHttpInfo($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsResponse'; - $request = $this->updateUrlFormatRequest($app_id, $recording_settings_patch_request, $contentType); + $request = $this->updateRequest($app_id, $recording_settings_patch_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1330,29 +1151,29 @@ function ($exception) { } /** - * Create request for operation 'updateUrlFormat' + * Create request for operation 'update' * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\RecordingSettingsPatchRequest $recording_settings_patch_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUrlFormat'] to see the possible values for this operation + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateUrlFormatRequest($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['updateUrlFormat'][0]) + public function updateRequest($app_id, $recording_settings_patch_request, string $contentType = self::contentTypes['update'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateUrlFormat' + 'Missing the required parameter $app_id when calling update' ); } // verify the required parameter 'recording_settings_patch_request' is set if ($recording_settings_patch_request === null || (is_array($recording_settings_patch_request) && count($recording_settings_patch_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $recording_settings_patch_request when calling updateUrlFormat' + 'Missing the required parameter $recording_settings_patch_request when calling update' ); } @@ -1457,6 +1278,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php b/codegen/Crm/Extensions/Calling/Api/SettingsApi.php index 7f8211e4..ec0154e8 100644 --- a/codegen/Crm/Extensions/Calling/Api/SettingsApi.php +++ b/codegen/Crm/Extensions/Calling/Api/SettingsApi.php @@ -1,7 +1,7 @@ [ + 'create' => [ 'application/json', ], - 'create' => [ + 'get' => [ 'application/json', ], - 'getById' => [ + 'remove' => [ 'application/json', ], 'update' => [ @@ -132,37 +135,40 @@ public function getConfig() } /** - * Operation archive + * Operation create * - * Delete calling settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return void + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function archive($app_id, string $contentType = self::contentTypes['archive'][0]) + public function create($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) { - $this->archiveWithHttpInfo($app_id, $contentType); + list($response) = $this->createWithHttpInfo($app_id, $settings_request, $contentType); + return $response; } /** - * Operation archiveWithHttpInfo + * Operation createWithHttpInfo * - * Delete calling settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createWithHttpInfo($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) { - $request = $this->archiveRequest($app_id, $contentType); + $request = $this->createRequest($app_id, $settings_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -187,10 +193,51 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); + } + + + + 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() + ); + } + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -198,26 +245,29 @@ public function archiveWithHttpInfo($app_id, string $contentType = self::content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation archiveAsync + * Operation createAsync * - * Delete calling settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsync($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) { - return $this->archiveAsyncWithHttpInfo($app_id, $contentType) + return $this->createAsyncWithHttpInfo($app_id, $settings_request, $contentType) ->then( function ($response) { return $response[0]; @@ -226,26 +276,40 @@ function ($response) { } /** - * Operation archiveAsyncWithHttpInfo + * Operation createAsyncWithHttpInfo * - * Delete calling settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createAsyncWithHttpInfo($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) { - $returnType = ''; - $request = $this->archiveRequest($app_id, $contentType); + $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; + $request = $this->createRequest($app_id, $settings_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + 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(); @@ -265,21 +329,29 @@ function ($exception) { } /** - * Create request for operation 'archive' + * Create request for operation 'create' * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation + * @param int $app_id (required) + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($app_id, string $contentType = self::contentTypes['archive'][0]) + public function createRequest($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling archive' + 'Missing the required parameter $app_id when calling create' + ); + } + + // verify the required parameter 'settings_request' is set + if ($settings_request === null || (is_array($settings_request) && count($settings_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $settings_request when calling create' ); } @@ -304,13 +376,20 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes $headers = $this->headerSelector->selectHeaders( - ['*/*', ], + ['application/json', '*/*', ], $contentType, $multipart ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($settings_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($settings_request)); + } else { + $httpBody = $settings_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -354,7 +433,7 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -362,40 +441,38 @@ public function archiveRequest($app_id, string $contentType = self::contentTypes } /** - * Operation create + * Operation get * - * Configure a calling extension + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error */ - public function create($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) + public function get($app_id, string $contentType = self::contentTypes['get'][0]) { - list($response) = $this->createWithHttpInfo($app_id, $settings_request, $contentType); + list($response) = $this->getWithHttpInfo($app_id, $contentType); return $response; } /** - * Operation createWithHttpInfo + * Operation getWithHttpInfo * - * Configure a calling extension + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) + public function getWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { - $request = $this->createRequest($app_id, $settings_request, $contentType); + $request = $this->getRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -422,61 +499,21 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -490,34 +527,11 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -527,7 +541,7 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -535,27 +549,28 @@ public function createWithHttpInfo($app_id, $settings_request, string $contentTy $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation createAsync + * Operation getAsync * - * Configure a calling extension + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) + public function getAsync($app_id, string $contentType = self::contentTypes['get'][0]) { - return $this->createAsyncWithHttpInfo($app_id, $settings_request, $contentType) + return $this->getAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -564,21 +579,20 @@ function ($response) { } /** - * Operation createAsyncWithHttpInfo + * Operation getAsyncWithHttpInfo * - * Configure a calling extension + * * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) + public function getAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['get'][0]) { $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - $request = $this->createRequest($app_id, $settings_request, $contentType); + $request = $this->getRequest($app_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -617,29 +631,21 @@ function ($exception) { } /** - * Create request for operation 'create' + * Create request for operation 'get' * - * @param int $app_id The ID of the app. (required) - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsRequest $settings_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($app_id, $settings_request, string $contentType = self::contentTypes['create'][0]) + public function getRequest($app_id, string $contentType = self::contentTypes['get'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling create' - ); - } - - // verify the required parameter 'settings_request' is set - if ($settings_request === null || (is_array($settings_request) && count($settings_request) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $settings_request when calling create' + 'Missing the required parameter $app_id when calling get' ); } @@ -670,14 +676,7 @@ public function createRequest($app_id, $settings_request, string $contentType = ); // for model (json/xml) - if (isset($settings_request)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($settings_request)); - } else { - $httpBody = $settings_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -721,7 +720,7 @@ public function createRequest($app_id, $settings_request, string $contentType = $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -729,38 +728,37 @@ public function createRequest($app_id, $settings_request, string $contentType = } /** - * Operation getById + * Operation remove * - * Retrieve settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error + * @return void */ - public function getById($app_id, string $contentType = self::contentTypes['getById'][0]) + public function remove($app_id, string $contentType = self::contentTypes['remove'][0]) { - list($response) = $this->getByIdWithHttpInfo($app_id, $contentType); - return $response; + $this->removeWithHttpInfo($app_id, $contentType); } /** - * Operation getByIdWithHttpInfo + * Operation removeWithHttpInfo * - * Retrieve settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Extensions\Calling\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse|\HubSpot\Client\Crm\Extensions\Calling\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) { - $request = $this->getByIdRequest($app_id, $contentType); + $request = $this->removeRequest($app_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -785,114 +783,9 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $statusCode = $response->getStatusCode(); - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - 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 = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -900,26 +793,28 @@ public function getByIdWithHttpInfo($app_id, string $contentType = self::content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } /** - * Operation getByIdAsync + * Operation removeAsync * - * Retrieve settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeAsync($app_id, string $contentType = self::contentTypes['remove'][0]) { - return $this->getByIdAsyncWithHttpInfo($app_id, $contentType) + return $this->removeAsyncWithHttpInfo($app_id, $contentType) ->then( function ($response) { return $response[0]; @@ -928,39 +823,26 @@ function ($response) { } /** - * Operation getByIdAsyncWithHttpInfo + * Operation removeAsyncWithHttpInfo * - * Retrieve settings + * * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeAsyncWithHttpInfo($app_id, string $contentType = self::contentTypes['remove'][0]) { - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - $request = $this->getByIdRequest($app_id, $contentType); + $returnType = ''; + $request = $this->removeRequest($app_id, $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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -980,21 +862,21 @@ function ($exception) { } /** - * Create request for operation 'getById' + * Create request for operation 'remove' * - * @param int $app_id The ID of the app. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation + * @param int $app_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['remove'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($app_id, string $contentType = self::contentTypes['getById'][0]) + public function removeRequest($app_id, string $contentType = self::contentTypes['remove'][0]) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getById' + 'Missing the required parameter $app_id when calling remove' ); } @@ -1019,7 +901,7 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], + ['*/*', ], $contentType, $multipart ); @@ -1069,7 +951,7 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'DELETE', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1079,9 +961,9 @@ public function getByIdRequest($app_id, string $contentType = self::contentTypes /** * Operation update * - * Update settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1098,9 +980,9 @@ public function update($app_id, $settings_patch_request, string $contentType = s /** * Operation updateWithHttpInfo * - * Update settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1137,61 +1019,21 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Extensions\Calling\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1205,34 +1047,11 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con ); } - $returnType = '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Extensions\Calling\Model\SettingsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1242,7 +1061,7 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1250,8 +1069,10 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1259,9 +1080,9 @@ public function updateWithHttpInfo($app_id, $settings_patch_request, string $con /** * Operation updateAsync * - * Update settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1281,9 +1102,9 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update settings + * * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1334,7 +1155,7 @@ function ($exception) { /** * Create request for operation 'update' * - * @param int $app_id The ID of the app. (required) + * @param int $app_id (required) * @param \HubSpot\Client\Crm\Extensions\Calling\Model\SettingsPatchRequest $settings_patch_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1459,6 +1280,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Extensions/Calling/ApiException.php b/codegen/Crm/Extensions/Calling/ApiException.php index 191f081e..0af0b636 100644 --- a/codegen/Crm/Extensions/Calling/ApiException.php +++ b/codegen/Crm/Extensions/Calling/ApiException.php @@ -1,7 +1,7 @@ tempFolderPath; } + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + /** * Gets the default configuration instance * diff --git a/codegen/Crm/Extensions/Calling/FormDataProcessor.php b/codegen/Crm/Extensions/Calling/FormDataProcessor.php new file mode 100644 index 00000000..ac2a6036 --- /dev/null +++ b/codegen/Crm/Extensions/Calling/FormDataProcessor.php @@ -0,0 +1,246 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/codegen/Crm/Extensions/Calling/HeaderSelector.php b/codegen/Crm/Extensions/Calling/HeaderSelector.php index 9319e9fb..e2680217 100644 --- a/codegen/Crm/Extensions/Calling/HeaderSelector.php +++ b/codegen/Crm/Extensions/Calling/HeaderSelector.php @@ -1,7 +1,7 @@ container[$offset]); } @@ -364,12 +364,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -394,11 +394,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php index c3302f1b..5173ce76 100644 --- a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsRequest.php @@ -2,7 +2,7 @@ /** * ChannelConnectionSettingsRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -315,7 +315,7 @@ public function getIsReady() /** * Sets is_ready * - * @param bool $is_ready If true, this app will be considered to support channel connection + * @param bool $is_ready is_ready * * @return self */ @@ -342,7 +342,7 @@ public function getUrl() /** * Sets url * - * @param string $url The URL to fetch phone numbers available for channel connection + * @param string $url url * * @return self */ @@ -358,11 +358,11 @@ public function setUrl($url) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -370,12 +370,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -400,11 +400,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php index 216f4a69..9c117b72 100644 --- a/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php +++ b/codegen/Crm/Extensions/Calling/Model/ChannelConnectionSettingsResponse.php @@ -2,7 +2,7 @@ /** * ChannelConnectionSettingsResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -59,8 +59,8 @@ class ChannelConnectionSettingsResponse implements ModelInterface, ArrayAccess, protected static $openAPITypes = [ 'created_at' => '\DateTime', 'is_ready' => 'bool', - 'url' => 'string', - 'updated_at' => '\DateTime' + 'updated_at' => '\DateTime', + 'url' => 'string' ]; /** @@ -73,8 +73,8 @@ class ChannelConnectionSettingsResponse implements ModelInterface, ArrayAccess, protected static $openAPIFormats = [ 'created_at' => 'date-time', 'is_ready' => null, - 'url' => null, - 'updated_at' => 'date-time' + 'updated_at' => 'date-time', + 'url' => null ]; /** @@ -85,8 +85,8 @@ class ChannelConnectionSettingsResponse implements ModelInterface, ArrayAccess, protected static array $openAPINullables = [ 'created_at' => false, 'is_ready' => false, - 'url' => false, - 'updated_at' => false + 'updated_at' => false, + 'url' => false ]; /** @@ -177,8 +177,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'created_at' => 'createdAt', 'is_ready' => 'isReady', - 'url' => 'url', - 'updated_at' => 'updatedAt' + 'updated_at' => 'updatedAt', + 'url' => 'url' ]; /** @@ -189,8 +189,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'created_at' => 'setCreatedAt', 'is_ready' => 'setIsReady', - 'url' => 'setUrl', - 'updated_at' => 'setUpdatedAt' + 'updated_at' => 'setUpdatedAt', + 'url' => 'setUrl' ]; /** @@ -201,8 +201,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'created_at' => 'getCreatedAt', 'is_ready' => 'getIsReady', - 'url' => 'getUrl', - 'updated_at' => 'getUpdatedAt' + 'updated_at' => 'getUpdatedAt', + 'url' => 'getUrl' ]; /** @@ -264,8 +264,8 @@ public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); - $this->setIfExists('url', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); } /** @@ -301,12 +301,12 @@ public function listInvalidProperties() if ($this->container['is_ready'] === null) { $invalidProperties[] = "'is_ready' can't be null"; } - if ($this->container['url'] === null) { - $invalidProperties[] = "'url' can't be null"; - } if ($this->container['updated_at'] === null) { $invalidProperties[] = "'updated_at' can't be null"; } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } return $invalidProperties; } @@ -335,7 +335,7 @@ public function getCreatedAt() /** * Sets created_at * - * @param \DateTime $created_at The timestamp this setting was created + * @param \DateTime $created_at created_at * * @return self */ @@ -362,7 +362,7 @@ public function getIsReady() /** * Sets is_ready * - * @param bool $is_ready If true, this app will be considered to support channel connection + * @param bool $is_ready is_ready * * @return self */ @@ -377,66 +377,66 @@ public function setIsReady($is_ready) } /** - * Gets url + * Gets updated_at * - * @return string + * @return \DateTime */ - public function getUrl() + public function getUpdatedAt() { - return $this->container['url']; + return $this->container['updated_at']; } /** - * Sets url + * Sets updated_at * - * @param string $url The URL to fetch phone numbers available for channel connection + * @param \DateTime $updated_at updated_at * * @return self */ - public function setUrl($url) + public function setUpdatedAt($updated_at) { - if (is_null($url)) { - throw new \InvalidArgumentException('non-nullable url cannot be null'); + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); } - $this->container['url'] = $url; + $this->container['updated_at'] = $updated_at; return $this; } /** - * Gets updated_at + * Gets url * - * @return \DateTime + * @return string */ - public function getUpdatedAt() + public function getUrl() { - return $this->container['updated_at']; + return $this->container['url']; } /** - * Sets updated_at + * Sets url * - * @param \DateTime $updated_at The timestamp this setting was last updated + * @param string $url url * * @return self */ - public function setUpdatedAt($updated_at) + public function setUrl($url) { - if (is_null($updated_at)) { - throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); } - $this->container['updated_at'] = $updated_at; + $this->container['url'] = $url; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -444,12 +444,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -474,11 +474,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/Error.php b/codegen/Crm/Extensions/Calling/Model/Error.php index beeffec0..25dad42b 100644 --- a/codegen/Crm/Extensions/Calling/Model/Error.php +++ b/codegen/Crm/Extensions/Calling/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -57,13 +57,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]' + 'sub_category' => 'string' ]; /** @@ -74,13 +74,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, 'correlation_id' => 'uuid', + 'errors' => null, 'links' => null, 'message' => null, - 'category' => null, - 'errors' => null + 'sub_category' => null ]; /** @@ -89,13 +89,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, 'correlation_id' => false, + 'errors' => false, 'links' => false, 'message' => false, - 'category' => false, - 'errors' => false + 'sub_category' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', 'correlation_id' => 'correlationId', + 'errors' => 'errors', 'links' => 'links', 'message' => 'message', - 'category' => 'category', - 'errors' => 'errors' + 'sub_category' => 'subCategory' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', 'correlation_id' => 'setCorrelationId', + 'errors' => 'setErrors', 'links' => 'setLinks', 'message' => 'setMessage', - 'category' => 'setCategory', - 'errors' => 'setErrors' + 'sub_category' => 'setSubCategory' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', 'correlation_id' => 'getCorrelationId', + 'errors' => 'getErrors', 'links' => 'getLinks', 'message' => 'getMessage', - 'category' => 'getCategory', - 'errors' => 'getErrors' + 'sub_category' => 'getSubCategory' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -316,15 +316,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['correlation_id'] === null) { $invalidProperties[] = "'correlation_id' can't be null"; } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } return $invalidProperties; } @@ -341,28 +341,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return string|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string $category The error category * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -421,6 +421,33 @@ public function setCorrelationId($correlation_id) return $this; } + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** * Gets links * @@ -476,66 +503,39 @@ public function setMessage($message) } /** - * Gets category - * - * @return string - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string $category The error category - * - * @return self - */ - public function setCategory($category) - { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); - } - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets errors + * Gets sub_category * - * @return \HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]|null + * @return string|null */ - public function getErrors() + public function getSubCategory() { - return $this->container['errors']; + return $this->container['sub_category']; } /** - * Sets errors + * Sets sub_category * - * @param \HubSpot\Client\Crm\Extensions\Calling\Model\ErrorDetail[]|null $errors further information about the error + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setErrors($errors) + public function setSubCategory($sub_category) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['errors'] = $errors; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -543,12 +543,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -573,11 +573,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php b/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php index 5b75812f..5fe9fb64 100644 --- a/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php +++ b/codegen/Crm/Extensions/Calling/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -57,11 +57,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', 'code' => 'string', - 'in' => 'string', 'context' => 'array', - 'message' => 'string' + 'in' => 'string', + 'message' => 'string', + 'sub_category' => 'string' ]; /** @@ -72,11 +72,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, 'code' => null, - 'in' => null, 'context' => null, - 'message' => null + 'in' => null, + 'message' => null, + 'sub_category' => null ]; /** @@ -85,11 +85,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, 'code' => false, - 'in' => false, 'context' => false, - 'message' => false + 'in' => false, + 'message' => false, + 'sub_category' => false ]; /** @@ -178,11 +178,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', 'code' => 'code', - 'in' => 'in', 'context' => 'context', - 'message' => 'message' + 'in' => 'in', + 'message' => 'message', + 'sub_category' => 'subCategory' ]; /** @@ -191,11 +191,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', 'code' => 'setCode', - 'in' => 'setIn', 'context' => 'setContext', - 'message' => 'setMessage' + 'in' => 'setIn', + 'message' => 'setMessage', + 'sub_category' => 'setSubCategory' ]; /** @@ -204,11 +204,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', 'code' => 'getCode', - 'in' => 'getIn', 'context' => 'getContext', - 'message' => 'getMessage' + 'in' => 'getIn', + 'message' => 'getMessage', + 'sub_category' => 'getSubCategory' ]; /** @@ -268,11 +268,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -321,55 +321,55 @@ public function valid() /** - * Gets sub_category + * Gets code * * @return string|null */ - public function getSubCategory() + public function getCode() { - return $this->container['sub_category']; + return $this->container['code']; } /** - * Sets sub_category + * Sets code * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $code The status code associated with the error detail * * @return self */ - public function setSubCategory($sub_category) + public function setCode($code) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['code'] = $code; return $this; } /** - * Gets code + * Gets context * - * @return string|null + * @return array|null */ - public function getCode() + public function getContext() { - return $this->container['code']; + return $this->container['context']; } /** - * Sets code + * Sets context * - * @param string|null $code The status code associated with the error detail + * @param array|null $context Context about the error condition * * @return self */ - public function setCode($code) + public function setContext($context) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); } - $this->container['code'] = $code; + $this->container['context'] = $context; return $this; } @@ -402,66 +402,66 @@ public function setIn($in) } /** - * Gets context + * Gets message * - * @return array|null + * @return string */ - public function getContext() + public function getMessage() { - return $this->container['context']; + return $this->container['message']; } /** - * Sets context + * Sets message * - * @param array|null $context Context about the error condition + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setContext($context) + public function setMessage($message) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['context'] = $context; + $this->container['message'] = $message; return $this; } /** - * Gets message + * Gets sub_category * - * @return string + * @return string|null */ - public function getMessage() + public function getSubCategory() { - return $this->container['message']; + return $this->container['sub_category']; } /** - * Sets message + * Sets sub_category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setMessage($message) + public function setSubCategory($sub_category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['message'] = $message; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -469,12 +469,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -499,11 +499,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php b/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php index 276410bc..475096fe 100644 --- a/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/MarkRecordingAsReadyRequest.php @@ -2,7 +2,7 @@ /** * MarkRecordingAsReadyRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -321,11 +321,11 @@ public function setEngagementId($engagement_id) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/ModelInterface.php b/codegen/Crm/Extensions/Calling/Model/ModelInterface.php index 91f95b42..9ce9b4de 100644 --- a/codegen/Crm/Extensions/Calling/Model/ModelInterface.php +++ b/codegen/Crm/Extensions/Calling/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling\Model @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php index b5b50c8c..f5367b32 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsPatchRequest.php @@ -2,7 +2,7 @@ /** * RecordingSettingsPatchRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -318,11 +318,11 @@ public function setUrlToRetrieveAuthedRecording($url_to_retrieve_authed_recordin /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -330,12 +330,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -360,11 +360,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php index 4fc04af1..c82de853 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsRequest.php @@ -2,7 +2,7 @@ /** * RecordingSettingsRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -321,11 +321,11 @@ public function setUrlToRetrieveAuthedRecording($url_to_retrieve_authed_recordin /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php index a59fb4e3..474ac373 100644 --- a/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php +++ b/codegen/Crm/Extensions/Calling/Model/RecordingSettingsResponse.php @@ -2,7 +2,7 @@ /** * RecordingSettingsResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -305,7 +305,7 @@ public function getUrlToRetrieveAuthedRecording() /** * Sets url_to_retrieve_authed_recording * - * @param string $url_to_retrieve_authed_recording + * @param string $url_to_retrieve_authed_recording The URL used to retrieve authenticated call recordings. * * @return self */ @@ -321,11 +321,11 @@ public function setUrlToRetrieveAuthedRecording($url_to_retrieve_authed_recordin /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php b/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php index be259f67..93d954e4 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsPatchRequest.php @@ -2,7 +2,7 @@ /** * SettingsPatchRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -57,15 +57,15 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'supports_custom_objects' => 'bool', - 'uses_remote' => 'bool', + 'height' => 'int', 'is_ready' => 'bool', 'name' => 'string', - 'width' => 'int', - 'uses_calling_window' => 'bool', + 'supports_custom_objects' => 'bool', 'supports_inbound_calling' => 'bool', 'url' => 'string', - 'height' => 'int' + 'uses_calling_window' => 'bool', + 'uses_remote' => 'bool', + 'width' => 'int' ]; /** @@ -76,15 +76,15 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'supports_custom_objects' => null, - 'uses_remote' => null, + 'height' => 'int32', 'is_ready' => null, 'name' => null, - 'width' => 'int32', - 'uses_calling_window' => null, + 'supports_custom_objects' => null, 'supports_inbound_calling' => null, 'url' => null, - 'height' => 'int32' + 'uses_calling_window' => null, + 'uses_remote' => null, + 'width' => 'int32' ]; /** @@ -93,15 +93,15 @@ class SettingsPatchRequest implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'supports_custom_objects' => false, - 'uses_remote' => false, + 'height' => false, 'is_ready' => false, 'name' => false, - 'width' => false, - 'uses_calling_window' => false, + 'supports_custom_objects' => false, 'supports_inbound_calling' => false, 'url' => false, - 'height' => false + 'uses_calling_window' => false, + 'uses_remote' => false, + 'width' => false ]; /** @@ -190,15 +190,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'supports_custom_objects' => 'supportsCustomObjects', - 'uses_remote' => 'usesRemote', + 'height' => 'height', 'is_ready' => 'isReady', 'name' => 'name', - 'width' => 'width', - 'uses_calling_window' => 'usesCallingWindow', + 'supports_custom_objects' => 'supportsCustomObjects', 'supports_inbound_calling' => 'supportsInboundCalling', 'url' => 'url', - 'height' => 'height' + 'uses_calling_window' => 'usesCallingWindow', + 'uses_remote' => 'usesRemote', + 'width' => 'width' ]; /** @@ -207,15 +207,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'supports_custom_objects' => 'setSupportsCustomObjects', - 'uses_remote' => 'setUsesRemote', + 'height' => 'setHeight', 'is_ready' => 'setIsReady', 'name' => 'setName', - 'width' => 'setWidth', - 'uses_calling_window' => 'setUsesCallingWindow', + 'supports_custom_objects' => 'setSupportsCustomObjects', 'supports_inbound_calling' => 'setSupportsInboundCalling', 'url' => 'setUrl', - 'height' => 'setHeight' + 'uses_calling_window' => 'setUsesCallingWindow', + 'uses_remote' => 'setUsesRemote', + 'width' => 'setWidth' ]; /** @@ -224,15 +224,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'supports_custom_objects' => 'getSupportsCustomObjects', - 'uses_remote' => 'getUsesRemote', + 'height' => 'getHeight', 'is_ready' => 'getIsReady', 'name' => 'getName', - 'width' => 'getWidth', - 'uses_calling_window' => 'getUsesCallingWindow', + 'supports_custom_objects' => 'getSupportsCustomObjects', 'supports_inbound_calling' => 'getSupportsInboundCalling', 'url' => 'getUrl', - 'height' => 'getHeight' + 'uses_calling_window' => 'getUsesCallingWindow', + 'uses_remote' => 'getUsesRemote', + 'width' => 'getWidth' ]; /** @@ -292,15 +292,15 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('supports_custom_objects', $data ?? [], null); - $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('width', $data ?? [], null); - $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('supports_custom_objects', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); - $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); } /** @@ -346,55 +346,28 @@ public function valid() /** - * Gets supports_custom_objects - * - * @return bool|null - */ - public function getSupportsCustomObjects() - { - return $this->container['supports_custom_objects']; - } - - /** - * Sets supports_custom_objects - * - * @param bool|null $supports_custom_objects When true, users will be able to click to dial from custom objects. - * - * @return self - */ - public function setSupportsCustomObjects($supports_custom_objects) - { - if (is_null($supports_custom_objects)) { - throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); - } - $this->container['supports_custom_objects'] = $supports_custom_objects; - - return $this; - } - - /** - * Gets uses_remote + * Gets height * - * @return bool|null + * @return int|null */ - public function getUsesRemote() + public function getHeight() { - return $this->container['uses_remote']; + return $this->container['height']; } /** - * Sets uses_remote + * Sets height * - * @param bool|null $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * @param int|null $height height * * @return self */ - public function setUsesRemote($uses_remote) + public function setHeight($height) { - if (is_null($uses_remote)) { - throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); } - $this->container['uses_remote'] = $uses_remote; + $this->container['height'] = $height; return $this; } @@ -412,7 +385,7 @@ public function getIsReady() /** * Sets is_ready * - * @param bool|null $is_ready When true, this indicates that your calling app is ready for production. Users will be able to select your calling app as their provider and can then click to dial within HubSpot. + * @param bool|null $is_ready is_ready * * @return self */ @@ -439,7 +412,7 @@ public function getName() /** * Sets name * - * @param string|null $name The name of your calling service to display to users. + * @param string|null $name name * * @return self */ @@ -454,55 +427,28 @@ public function setName($name) } /** - * Gets width - * - * @return int|null - */ - public function getWidth() - { - return $this->container['width']; - } - - /** - * Sets width - * - * @param int|null $width The target width of the iframe that will contain your phone/calling UI. - * - * @return self - */ - public function setWidth($width) - { - if (is_null($width)) { - throw new \InvalidArgumentException('non-nullable width cannot be null'); - } - $this->container['width'] = $width; - - return $this; - } - - /** - * Gets uses_calling_window + * Gets supports_custom_objects * * @return bool|null */ - public function getUsesCallingWindow() + public function getSupportsCustomObjects() { - return $this->container['uses_calling_window']; + return $this->container['supports_custom_objects']; } /** - * Sets uses_calling_window + * Sets supports_custom_objects * - * @param bool|null $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * @param bool|null $supports_custom_objects supports_custom_objects * * @return self */ - public function setUsesCallingWindow($uses_calling_window) + public function setSupportsCustomObjects($supports_custom_objects) { - if (is_null($uses_calling_window)) { - throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + if (is_null($supports_custom_objects)) { + throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); } - $this->container['uses_calling_window'] = $uses_calling_window; + $this->container['supports_custom_objects'] = $supports_custom_objects; return $this; } @@ -520,7 +466,7 @@ public function getSupportsInboundCalling() /** * Sets supports_inbound_calling * - * @param bool|null $supports_inbound_calling When true, this indicates that your calling app supports inbound calling within HubSpot. + * @param bool|null $supports_inbound_calling supports_inbound_calling * * @return self */ @@ -547,7 +493,7 @@ public function getUrl() /** * Sets url * - * @param string|null $url The URL to your phone/calling UI, built with the [Calling SDK](#). + * @param string|null $url url * * @return self */ @@ -562,39 +508,93 @@ public function setUrl($url) } /** - * Gets height + * Gets uses_calling_window + * + * @return bool|null + */ + public function getUsesCallingWindow() + { + return $this->container['uses_calling_window']; + } + + /** + * Sets uses_calling_window + * + * @param bool|null $uses_calling_window uses_calling_window + * + * @return self + */ + public function setUsesCallingWindow($uses_calling_window) + { + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + } + $this->container['uses_calling_window'] = $uses_calling_window; + + return $this; + } + + /** + * Gets uses_remote + * + * @return bool|null + */ + public function getUsesRemote() + { + return $this->container['uses_remote']; + } + + /** + * Sets uses_remote + * + * @param bool|null $uses_remote uses_remote + * + * @return self + */ + public function setUsesRemote($uses_remote) + { + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + } + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + + /** + * Gets width * * @return int|null */ - public function getHeight() + public function getWidth() { - return $this->container['height']; + return $this->container['width']; } /** - * Sets height + * Sets width * - * @param int|null $height The target height of the iframe that will contain your phone/calling UI. + * @param int|null $width width * * @return self */ - public function setHeight($height) + public function setWidth($width) { - if (is_null($height)) { - throw new \InvalidArgumentException('non-nullable height cannot be null'); + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); } - $this->container['height'] = $height; + $this->container['width'] = $width; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -602,12 +602,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -632,11 +632,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php b/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php index e3697f47..d5112595 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsRequest.php @@ -2,7 +2,7 @@ /** * SettingsRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -57,15 +57,15 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'supports_custom_objects' => 'bool', - 'uses_remote' => 'bool', + 'height' => 'int', 'is_ready' => 'bool', 'name' => 'string', - 'width' => 'int', - 'uses_calling_window' => 'bool', + 'supports_custom_objects' => 'bool', 'supports_inbound_calling' => 'bool', 'url' => 'string', - 'height' => 'int' + 'uses_calling_window' => 'bool', + 'uses_remote' => 'bool', + 'width' => 'int' ]; /** @@ -76,15 +76,15 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'supports_custom_objects' => null, - 'uses_remote' => null, + 'height' => 'int32', 'is_ready' => null, 'name' => null, - 'width' => 'int32', - 'uses_calling_window' => null, + 'supports_custom_objects' => null, 'supports_inbound_calling' => null, 'url' => null, - 'height' => 'int32' + 'uses_calling_window' => null, + 'uses_remote' => null, + 'width' => 'int32' ]; /** @@ -93,15 +93,15 @@ class SettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'supports_custom_objects' => false, - 'uses_remote' => false, + 'height' => false, 'is_ready' => false, 'name' => false, - 'width' => false, - 'uses_calling_window' => false, + 'supports_custom_objects' => false, 'supports_inbound_calling' => false, 'url' => false, - 'height' => false + 'uses_calling_window' => false, + 'uses_remote' => false, + 'width' => false ]; /** @@ -190,15 +190,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'supports_custom_objects' => 'supportsCustomObjects', - 'uses_remote' => 'usesRemote', + 'height' => 'height', 'is_ready' => 'isReady', 'name' => 'name', - 'width' => 'width', - 'uses_calling_window' => 'usesCallingWindow', + 'supports_custom_objects' => 'supportsCustomObjects', 'supports_inbound_calling' => 'supportsInboundCalling', 'url' => 'url', - 'height' => 'height' + 'uses_calling_window' => 'usesCallingWindow', + 'uses_remote' => 'usesRemote', + 'width' => 'width' ]; /** @@ -207,15 +207,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'supports_custom_objects' => 'setSupportsCustomObjects', - 'uses_remote' => 'setUsesRemote', + 'height' => 'setHeight', 'is_ready' => 'setIsReady', 'name' => 'setName', - 'width' => 'setWidth', - 'uses_calling_window' => 'setUsesCallingWindow', + 'supports_custom_objects' => 'setSupportsCustomObjects', 'supports_inbound_calling' => 'setSupportsInboundCalling', 'url' => 'setUrl', - 'height' => 'setHeight' + 'uses_calling_window' => 'setUsesCallingWindow', + 'uses_remote' => 'setUsesRemote', + 'width' => 'setWidth' ]; /** @@ -224,15 +224,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'supports_custom_objects' => 'getSupportsCustomObjects', - 'uses_remote' => 'getUsesRemote', + 'height' => 'getHeight', 'is_ready' => 'getIsReady', 'name' => 'getName', - 'width' => 'getWidth', - 'uses_calling_window' => 'getUsesCallingWindow', + 'supports_custom_objects' => 'getSupportsCustomObjects', 'supports_inbound_calling' => 'getSupportsInboundCalling', 'url' => 'getUrl', - 'height' => 'getHeight' + 'uses_calling_window' => 'getUsesCallingWindow', + 'uses_remote' => 'getUsesRemote', + 'width' => 'getWidth' ]; /** @@ -292,15 +292,15 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('supports_custom_objects', $data ?? [], null); - $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('width', $data ?? [], null); - $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('supports_custom_objects', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); - $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); } /** @@ -330,12 +330,33 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['height'] === null) { + $invalidProperties[] = "'height' can't be null"; + } + if ($this->container['is_ready'] === null) { + $invalidProperties[] = "'is_ready' can't be null"; + } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } + if ($this->container['supports_custom_objects'] === null) { + $invalidProperties[] = "'supports_custom_objects' can't be null"; + } + if ($this->container['supports_inbound_calling'] === null) { + $invalidProperties[] = "'supports_inbound_calling' can't be null"; + } if ($this->container['url'] === null) { $invalidProperties[] = "'url' can't be null"; } + if ($this->container['uses_calling_window'] === null) { + $invalidProperties[] = "'uses_calling_window' can't be null"; + } + if ($this->container['uses_remote'] === null) { + $invalidProperties[] = "'uses_remote' can't be null"; + } + if ($this->container['width'] === null) { + $invalidProperties[] = "'width' can't be null"; + } return $invalidProperties; } @@ -352,55 +373,28 @@ public function valid() /** - * Gets supports_custom_objects - * - * @return bool|null - */ - public function getSupportsCustomObjects() - { - return $this->container['supports_custom_objects']; - } - - /** - * Sets supports_custom_objects - * - * @param bool|null $supports_custom_objects When true, users will be able to click to dial from custom objects. - * - * @return self - */ - public function setSupportsCustomObjects($supports_custom_objects) - { - if (is_null($supports_custom_objects)) { - throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); - } - $this->container['supports_custom_objects'] = $supports_custom_objects; - - return $this; - } - - /** - * Gets uses_remote + * Gets height * - * @return bool|null + * @return int */ - public function getUsesRemote() + public function getHeight() { - return $this->container['uses_remote']; + return $this->container['height']; } /** - * Sets uses_remote + * Sets height * - * @param bool|null $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * @param int $height height * * @return self */ - public function setUsesRemote($uses_remote) + public function setHeight($height) { - if (is_null($uses_remote)) { - throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); } - $this->container['uses_remote'] = $uses_remote; + $this->container['height'] = $height; return $this; } @@ -408,7 +402,7 @@ public function setUsesRemote($uses_remote) /** * Gets is_ready * - * @return bool|null + * @return bool */ public function getIsReady() { @@ -418,7 +412,7 @@ public function getIsReady() /** * Sets is_ready * - * @param bool|null $is_ready When true, this indicates that your calling app is ready for production. Users will be able to select your calling app as their provider and can then click to dial within HubSpot. + * @param bool $is_ready is_ready * * @return self */ @@ -445,7 +439,7 @@ public function getName() /** * Sets name * - * @param string $name The name of your calling service to display to users. + * @param string $name name * * @return self */ @@ -460,55 +454,28 @@ public function setName($name) } /** - * Gets width - * - * @return int|null - */ - public function getWidth() - { - return $this->container['width']; - } - - /** - * Sets width - * - * @param int|null $width The target width of the iframe that will contain your phone/calling UI. - * - * @return self - */ - public function setWidth($width) - { - if (is_null($width)) { - throw new \InvalidArgumentException('non-nullable width cannot be null'); - } - $this->container['width'] = $width; - - return $this; - } - - /** - * Gets uses_calling_window + * Gets supports_custom_objects * - * @return bool|null + * @return bool */ - public function getUsesCallingWindow() + public function getSupportsCustomObjects() { - return $this->container['uses_calling_window']; + return $this->container['supports_custom_objects']; } /** - * Sets uses_calling_window + * Sets supports_custom_objects * - * @param bool|null $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * @param bool $supports_custom_objects supports_custom_objects * * @return self */ - public function setUsesCallingWindow($uses_calling_window) + public function setSupportsCustomObjects($supports_custom_objects) { - if (is_null($uses_calling_window)) { - throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + if (is_null($supports_custom_objects)) { + throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); } - $this->container['uses_calling_window'] = $uses_calling_window; + $this->container['supports_custom_objects'] = $supports_custom_objects; return $this; } @@ -516,7 +483,7 @@ public function setUsesCallingWindow($uses_calling_window) /** * Gets supports_inbound_calling * - * @return bool|null + * @return bool */ public function getSupportsInboundCalling() { @@ -526,7 +493,7 @@ public function getSupportsInboundCalling() /** * Sets supports_inbound_calling * - * @param bool|null $supports_inbound_calling When true, this indicates that your calling app supports inbound calling within HubSpot. + * @param bool $supports_inbound_calling supports_inbound_calling * * @return self */ @@ -553,7 +520,7 @@ public function getUrl() /** * Sets url * - * @param string $url The URL to your phone/calling UI, built with the [Calling SDK](#). + * @param string $url url * * @return self */ @@ -568,39 +535,93 @@ public function setUrl($url) } /** - * Gets height + * Gets uses_calling_window * - * @return int|null + * @return bool */ - public function getHeight() + public function getUsesCallingWindow() { - return $this->container['height']; + return $this->container['uses_calling_window']; } /** - * Sets height + * Sets uses_calling_window * - * @param int|null $height The target height of the iframe that will contain your phone/calling UI. + * @param bool $uses_calling_window uses_calling_window * * @return self */ - public function setHeight($height) + public function setUsesCallingWindow($uses_calling_window) { - if (is_null($height)) { - throw new \InvalidArgumentException('non-nullable height cannot be null'); + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); } - $this->container['height'] = $height; + $this->container['uses_calling_window'] = $uses_calling_window; + + return $this; + } + + /** + * Gets uses_remote + * + * @return bool + */ + public function getUsesRemote() + { + return $this->container['uses_remote']; + } + + /** + * Sets uses_remote + * + * @param bool $uses_remote uses_remote + * + * @return self + */ + public function setUsesRemote($uses_remote) + { + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + } + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + + /** + * Gets width + * + * @return int + */ + public function getWidth() + { + return $this->container['width']; + } + + /** + * Sets width + * + * @param int $width width + * + * @return self + */ + public function setWidth($width) + { + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); + } + $this->container['width'] = $width; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -608,12 +629,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -638,11 +659,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php b/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php index 7d2dc42e..a93d79a5 100644 --- a/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php +++ b/codegen/Crm/Extensions/Calling/Model/SettingsResponse.php @@ -2,7 +2,7 @@ /** * SettingsResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -58,16 +58,16 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'created_at' => '\DateTime', - 'supports_custom_objects' => 'bool', - 'uses_remote' => 'bool', + 'height' => 'int', 'is_ready' => 'bool', 'name' => 'string', - 'width' => 'int', - 'uses_calling_window' => 'bool', + 'supports_custom_objects' => 'bool', 'supports_inbound_calling' => 'bool', + 'updated_at' => '\DateTime', 'url' => 'string', - 'height' => 'int', - 'updated_at' => '\DateTime' + 'uses_calling_window' => 'bool', + 'uses_remote' => 'bool', + 'width' => 'int' ]; /** @@ -79,16 +79,16 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'created_at' => 'date-time', - 'supports_custom_objects' => null, - 'uses_remote' => null, + 'height' => 'int32', 'is_ready' => null, 'name' => null, - 'width' => 'int32', - 'uses_calling_window' => null, + 'supports_custom_objects' => null, 'supports_inbound_calling' => null, + 'updated_at' => 'date-time', 'url' => null, - 'height' => 'int32', - 'updated_at' => 'date-time' + 'uses_calling_window' => null, + 'uses_remote' => null, + 'width' => 'int32' ]; /** @@ -98,16 +98,16 @@ class SettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'created_at' => false, - 'supports_custom_objects' => false, - 'uses_remote' => false, + 'height' => false, 'is_ready' => false, 'name' => false, - 'width' => false, - 'uses_calling_window' => false, + 'supports_custom_objects' => false, 'supports_inbound_calling' => false, + 'updated_at' => false, 'url' => false, - 'height' => false, - 'updated_at' => false + 'uses_calling_window' => false, + 'uses_remote' => false, + 'width' => false ]; /** @@ -197,16 +197,16 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'created_at' => 'createdAt', - 'supports_custom_objects' => 'supportsCustomObjects', - 'uses_remote' => 'usesRemote', + 'height' => 'height', 'is_ready' => 'isReady', 'name' => 'name', - 'width' => 'width', - 'uses_calling_window' => 'usesCallingWindow', + 'supports_custom_objects' => 'supportsCustomObjects', 'supports_inbound_calling' => 'supportsInboundCalling', + 'updated_at' => 'updatedAt', 'url' => 'url', - 'height' => 'height', - 'updated_at' => 'updatedAt' + 'uses_calling_window' => 'usesCallingWindow', + 'uses_remote' => 'usesRemote', + 'width' => 'width' ]; /** @@ -216,16 +216,16 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'created_at' => 'setCreatedAt', - 'supports_custom_objects' => 'setSupportsCustomObjects', - 'uses_remote' => 'setUsesRemote', + 'height' => 'setHeight', 'is_ready' => 'setIsReady', 'name' => 'setName', - 'width' => 'setWidth', - 'uses_calling_window' => 'setUsesCallingWindow', + 'supports_custom_objects' => 'setSupportsCustomObjects', 'supports_inbound_calling' => 'setSupportsInboundCalling', + 'updated_at' => 'setUpdatedAt', 'url' => 'setUrl', - 'height' => 'setHeight', - 'updated_at' => 'setUpdatedAt' + 'uses_calling_window' => 'setUsesCallingWindow', + 'uses_remote' => 'setUsesRemote', + 'width' => 'setWidth' ]; /** @@ -235,16 +235,16 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'created_at' => 'getCreatedAt', - 'supports_custom_objects' => 'getSupportsCustomObjects', - 'uses_remote' => 'getUsesRemote', + 'height' => 'getHeight', 'is_ready' => 'getIsReady', 'name' => 'getName', - 'width' => 'getWidth', - 'uses_calling_window' => 'getUsesCallingWindow', + 'supports_custom_objects' => 'getSupportsCustomObjects', 'supports_inbound_calling' => 'getSupportsInboundCalling', + 'updated_at' => 'getUpdatedAt', 'url' => 'getUrl', - 'height' => 'getHeight', - 'updated_at' => 'getUpdatedAt' + 'uses_calling_window' => 'getUsesCallingWindow', + 'uses_remote' => 'getUsesRemote', + 'width' => 'getWidth' ]; /** @@ -305,16 +305,16 @@ public function getModelName() public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('supports_custom_objects', $data ?? [], null); - $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); $this->setIfExists('is_ready', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('width', $data ?? [], null); - $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('supports_custom_objects', $data ?? [], null); $this->setIfExists('supports_inbound_calling', $data ?? [], null); - $this->setIfExists('url', $data ?? [], null); - $this->setIfExists('height', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('uses_calling_window', $data ?? [], null); + $this->setIfExists('uses_remote', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); } /** @@ -347,11 +347,8 @@ public function listInvalidProperties() if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } - if ($this->container['supports_custom_objects'] === null) { - $invalidProperties[] = "'supports_custom_objects' can't be null"; - } - if ($this->container['uses_remote'] === null) { - $invalidProperties[] = "'uses_remote' can't be null"; + if ($this->container['height'] === null) { + $invalidProperties[] = "'height' can't be null"; } if ($this->container['is_ready'] === null) { $invalidProperties[] = "'is_ready' can't be null"; @@ -359,23 +356,26 @@ public function listInvalidProperties() if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - if ($this->container['width'] === null) { - $invalidProperties[] = "'width' can't be null"; - } - if ($this->container['uses_calling_window'] === null) { - $invalidProperties[] = "'uses_calling_window' can't be null"; + if ($this->container['supports_custom_objects'] === null) { + $invalidProperties[] = "'supports_custom_objects' can't be null"; } if ($this->container['supports_inbound_calling'] === null) { $invalidProperties[] = "'supports_inbound_calling' can't be null"; } + if ($this->container['updated_at'] === null) { + $invalidProperties[] = "'updated_at' can't be null"; + } if ($this->container['url'] === null) { $invalidProperties[] = "'url' can't be null"; } - if ($this->container['height'] === null) { - $invalidProperties[] = "'height' can't be null"; + if ($this->container['uses_calling_window'] === null) { + $invalidProperties[] = "'uses_calling_window' can't be null"; } - if ($this->container['updated_at'] === null) { - $invalidProperties[] = "'updated_at' can't be null"; + if ($this->container['uses_remote'] === null) { + $invalidProperties[] = "'uses_remote' can't be null"; + } + if ($this->container['width'] === null) { + $invalidProperties[] = "'width' can't be null"; } return $invalidProperties; } @@ -405,7 +405,7 @@ public function getCreatedAt() /** * Sets created_at * - * @param \DateTime $created_at When this calling extension was created. + * @param \DateTime $created_at created_at * * @return self */ @@ -420,55 +420,28 @@ public function setCreatedAt($created_at) } /** - * Gets supports_custom_objects - * - * @return bool - */ - public function getSupportsCustomObjects() - { - return $this->container['supports_custom_objects']; - } - - /** - * Sets supports_custom_objects - * - * @param bool $supports_custom_objects When true, users will be able to click to dial from custom objects. - * - * @return self - */ - public function setSupportsCustomObjects($supports_custom_objects) - { - if (is_null($supports_custom_objects)) { - throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); - } - $this->container['supports_custom_objects'] = $supports_custom_objects; - - return $this; - } - - /** - * Gets uses_remote + * Gets height * - * @return bool + * @return int */ - public function getUsesRemote() + public function getHeight() { - return $this->container['uses_remote']; + return $this->container['height']; } /** - * Sets uses_remote + * Sets height * - * @param bool $uses_remote When false, this indicates that your calling app does not use the anchored calling remote within the HubSpot app. + * @param int $height height * * @return self */ - public function setUsesRemote($uses_remote) + public function setHeight($height) { - if (is_null($uses_remote)) { - throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); } - $this->container['uses_remote'] = $uses_remote; + $this->container['height'] = $height; return $this; } @@ -486,7 +459,7 @@ public function getIsReady() /** * Sets is_ready * - * @param bool $is_ready When true, this indicates that your calling app is ready for production. Users will be able to select your calling app as their provider and can then click to dial within HubSpot. + * @param bool $is_ready is_ready * * @return self */ @@ -513,7 +486,7 @@ public function getName() /** * Sets name * - * @param string $name The name of your calling service to display to users. + * @param string $name name * * @return self */ @@ -528,82 +501,82 @@ public function setName($name) } /** - * Gets width + * Gets supports_custom_objects * - * @return int + * @return bool */ - public function getWidth() + public function getSupportsCustomObjects() { - return $this->container['width']; + return $this->container['supports_custom_objects']; } /** - * Sets width + * Sets supports_custom_objects * - * @param int $width The target width of the iframe that will contain your phone/calling UI. + * @param bool $supports_custom_objects supports_custom_objects * * @return self */ - public function setWidth($width) + public function setSupportsCustomObjects($supports_custom_objects) { - if (is_null($width)) { - throw new \InvalidArgumentException('non-nullable width cannot be null'); + if (is_null($supports_custom_objects)) { + throw new \InvalidArgumentException('non-nullable supports_custom_objects cannot be null'); } - $this->container['width'] = $width; + $this->container['supports_custom_objects'] = $supports_custom_objects; return $this; } /** - * Gets uses_calling_window + * Gets supports_inbound_calling * * @return bool */ - public function getUsesCallingWindow() + public function getSupportsInboundCalling() { - return $this->container['uses_calling_window']; + return $this->container['supports_inbound_calling']; } /** - * Sets uses_calling_window + * Sets supports_inbound_calling * - * @param bool $uses_calling_window When false, this indicates that your calling app does not require the use of the separate calling window to hold the call connection. + * @param bool $supports_inbound_calling supports_inbound_calling * * @return self */ - public function setUsesCallingWindow($uses_calling_window) + public function setSupportsInboundCalling($supports_inbound_calling) { - if (is_null($uses_calling_window)) { - throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); + if (is_null($supports_inbound_calling)) { + throw new \InvalidArgumentException('non-nullable supports_inbound_calling cannot be null'); } - $this->container['uses_calling_window'] = $uses_calling_window; + $this->container['supports_inbound_calling'] = $supports_inbound_calling; return $this; } /** - * Gets supports_inbound_calling + * Gets updated_at * - * @return bool + * @return \DateTime */ - public function getSupportsInboundCalling() + public function getUpdatedAt() { - return $this->container['supports_inbound_calling']; + return $this->container['updated_at']; } /** - * Sets supports_inbound_calling + * Sets updated_at * - * @param bool $supports_inbound_calling When true, this indicates that your calling app supports inbound calling within HubSpot. + * @param \DateTime $updated_at updated_at * * @return self */ - public function setSupportsInboundCalling($supports_inbound_calling) + public function setUpdatedAt($updated_at) { - if (is_null($supports_inbound_calling)) { - throw new \InvalidArgumentException('non-nullable supports_inbound_calling cannot be null'); + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); } - $this->container['supports_inbound_calling'] = $supports_inbound_calling; + $this->container['updated_at'] = $updated_at; return $this; } @@ -621,7 +594,7 @@ public function getUrl() /** * Sets url * - * @param string $url The URL to your phone/calling UI, built with the [Calling SDK](#). + * @param string $url url * * @return self */ @@ -636,66 +609,93 @@ public function setUrl($url) } /** - * Gets height + * Gets uses_calling_window * - * @return int + * @return bool */ - public function getHeight() + public function getUsesCallingWindow() { - return $this->container['height']; + return $this->container['uses_calling_window']; } /** - * Sets height + * Sets uses_calling_window * - * @param int $height The target height of the iframe that will contain your phone/calling UI. + * @param bool $uses_calling_window uses_calling_window * * @return self */ - public function setHeight($height) + public function setUsesCallingWindow($uses_calling_window) { - if (is_null($height)) { - throw new \InvalidArgumentException('non-nullable height cannot be null'); + if (is_null($uses_calling_window)) { + throw new \InvalidArgumentException('non-nullable uses_calling_window cannot be null'); } - $this->container['height'] = $height; + $this->container['uses_calling_window'] = $uses_calling_window; return $this; } /** - * Gets updated_at + * Gets uses_remote * - * @return \DateTime + * @return bool */ - public function getUpdatedAt() + public function getUsesRemote() { - return $this->container['updated_at']; + return $this->container['uses_remote']; } /** - * Sets updated_at + * Sets uses_remote * - * @param \DateTime $updated_at The last time the settings for this calling extension were modified. + * @param bool $uses_remote uses_remote * * @return self */ - public function setUpdatedAt($updated_at) + public function setUsesRemote($uses_remote) { - if (is_null($updated_at)) { - throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + if (is_null($uses_remote)) { + throw new \InvalidArgumentException('non-nullable uses_remote cannot be null'); } - $this->container['updated_at'] = $updated_at; + $this->container['uses_remote'] = $uses_remote; + + return $this; + } + + /** + * Gets width + * + * @return int + */ + public function getWidth() + { + return $this->container['width']; + } + + /** + * Sets width + * + * @param int $width width + * + * @return self + */ + public function setWidth($width) + { + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); + } + $this->container['width'] = $width; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -703,12 +703,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -733,11 +733,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Extensions/Calling/ObjectSerializer.php b/codegen/Crm/Extensions/Calling/ObjectSerializer.php index ebd27586..21e8d4f8 100644 --- a/codegen/Crm/Extensions/Calling/ObjectSerializer.php +++ b/codegen/Crm/Extensions/Calling/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Extensions\Calling @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.17.0 */ /** @@ -323,24 +323,6 @@ public static function toHeaderValue($value) 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 @@ -612,6 +594,6 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } } - return $qs ? (string) substr($qs, 0, -1) : ''; + return $qs ? substr($qs, 0, -1) : ''; } }