From 7a707e6bea6f2968879b0cd76d9d3a1a2d6e9118 Mon Sep 17 00:00:00 2001 From: Cloudmersive <35204726+Cloudmersive@users.noreply.github.com> Date: Sun, 11 Apr 2021 18:13:58 -0700 Subject: [PATCH] 1.7.4 --- README.md | 8 +- composer.json | 2 +- docs/Api/TextInputApi.md | 118 ++++ docs/Model/XxeDetectionBatchRequest.md | 10 + docs/Model/XxeDetectionBatchResponse.md | 10 + docs/Model/XxeDetectionRequestItem.md | 13 + docs/Model/XxeDetectionResult.md | 11 + lib/Api/TextInputApi.php | 551 +++++++++++++++++++ lib/Configuration.php | 4 +- lib/Model/XxeDetectionBatchRequest.php | 303 ++++++++++ lib/Model/XxeDetectionBatchResponse.php | 303 ++++++++++ lib/Model/XxeDetectionRequestItem.php | 393 +++++++++++++ lib/Model/XxeDetectionResult.php | 333 +++++++++++ packageconfig.json | 2 +- test/Api/TextInputApiTest.php | 20 + test/Model/XxeDetectionBatchRequestTest.php | 86 +++ test/Model/XxeDetectionBatchResponseTest.php | 86 +++ test/Model/XxeDetectionRequestItemTest.php | 107 ++++ test/Model/XxeDetectionResultTest.php | 93 ++++ 19 files changed, 2448 insertions(+), 5 deletions(-) create mode 100644 docs/Model/XxeDetectionBatchRequest.md create mode 100644 docs/Model/XxeDetectionBatchResponse.md create mode 100644 docs/Model/XxeDetectionRequestItem.md create mode 100644 docs/Model/XxeDetectionResult.md create mode 100644 lib/Model/XxeDetectionBatchRequest.php create mode 100644 lib/Model/XxeDetectionBatchResponse.php create mode 100644 lib/Model/XxeDetectionRequestItem.php create mode 100644 lib/Model/XxeDetectionResult.php create mode 100644 test/Model/XxeDetectionBatchRequestTest.php create mode 100644 test/Model/XxeDetectionBatchResponseTest.php create mode 100644 test/Model/XxeDetectionRequestItemTest.php create mode 100644 test/Model/XxeDetectionResultTest.php diff --git a/README.md b/README.md index 21e3528..224989d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The validation APIs help you validate data. Check if an E-mail address is real. [Cloudmersive Validation API](https://www.cloudmersive.com/validate-api) provides data validation capabilities for validating email addresses, phone numbers, IP addresses, and many other types of business data. - API version: v1 -- Package version: 1.7.3 +- Package version: 1.7.4 ## Requirements @@ -135,6 +135,8 @@ Class | Method | HTTP request | Description *TextInputApi* | [**textInputCheckSqlInjectionBatch**](docs/Api/TextInputApi.md#textinputchecksqlinjectionbatch) | **POST** /validate/text-input/check/sql-injection/batch | Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch *TextInputApi* | [**textInputCheckXss**](docs/Api/TextInputApi.md#textinputcheckxss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) attacks *TextInputApi* | [**textInputCheckXssBatch**](docs/Api/TextInputApi.md#textinputcheckxssbatch) | **POST** /validate/text-input/check-and-protect/xss/batch | Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch +*TextInputApi* | [**textInputCheckXxe**](docs/Api/TextInputApi.md#textinputcheckxxe) | **POST** /validate/text-input/check/xxe | Protect text input from XML External Entity (XXE) attacks +*TextInputApi* | [**textInputCheckXxeBatch**](docs/Api/TextInputApi.md#textinputcheckxxebatch) | **POST** /validate/text-input/check/xxe/batch | Protect text input from XML External Entity (XXE) attacks *TextInputApi* | [**textInputProtectXss**](docs/Api/TextInputApi.md#textinputprotectxss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization *UserAgentApi* | [**userAgentParse**](docs/Api/UserAgentApi.md#useragentparse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots *VatApi* | [**vatVatLookup**](docs/Api/VatApi.md#vatvatlookup) | **POST** /validate/vat/lookup | Validate a VAT number @@ -220,6 +222,10 @@ Class | Method | HTTP request | Description - [XssProtectionBatchResponse](docs/Model/XssProtectionBatchResponse.md) - [XssProtectionRequestItem](docs/Model/XssProtectionRequestItem.md) - [XssProtectionResult](docs/Model/XssProtectionResult.md) + - [XxeDetectionBatchRequest](docs/Model/XxeDetectionBatchRequest.md) + - [XxeDetectionBatchResponse](docs/Model/XxeDetectionBatchResponse.md) + - [XxeDetectionRequestItem](docs/Model/XxeDetectionRequestItem.md) + - [XxeDetectionResult](docs/Model/XxeDetectionResult.md) ## Documentation For Authorization diff --git a/composer.json b/composer.json index c98fba3..ec8b269 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "cloudmersive/cloudmersive_validate_api_client", - "version": "1.7.3", + "version": "1.7.4", "description": "", "keywords": [ "swagger", diff --git a/docs/Api/TextInputApi.md b/docs/Api/TextInputApi.md index 0a0a094..f7548b8 100644 --- a/docs/Api/TextInputApi.md +++ b/docs/Api/TextInputApi.md @@ -8,6 +8,8 @@ Method | HTTP request | Description [**textInputCheckSqlInjectionBatch**](TextInputApi.md#textInputCheckSqlInjectionBatch) | **POST** /validate/text-input/check/sql-injection/batch | Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch [**textInputCheckXss**](TextInputApi.md#textInputCheckXss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) attacks [**textInputCheckXssBatch**](TextInputApi.md#textInputCheckXssBatch) | **POST** /validate/text-input/check-and-protect/xss/batch | Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch +[**textInputCheckXxe**](TextInputApi.md#textInputCheckXxe) | **POST** /validate/text-input/check/xxe | Protect text input from XML External Entity (XXE) attacks +[**textInputCheckXxeBatch**](TextInputApi.md#textInputCheckXxeBatch) | **POST** /validate/text-input/check/xxe/batch | Protect text input from XML External Entity (XXE) attacks [**textInputProtectXss**](TextInputApi.md#textInputProtectXss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization @@ -233,6 +235,122 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +# **textInputCheckXxe** +> \Swagger\Client\Model\XxeDetectionResult textInputCheckXxe($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls) + +Protect text input from XML External Entity (XXE) attacks + +Detects XXE (XML External Entity) attacks from text input. + +### Example +```php +setApiKey('Apikey', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Apikey', 'Bearer'); + +$apiInstance = new Swagger\Client\Api\TextInputApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$value = "value_example"; // string | User-facing text input. +$allow_internet_urls = true; // bool | Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. +$known_safe_urls = "known_safe_urls_example"; // string | Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. +$known_unsafe_urls = "known_unsafe_urls_example"; // string | Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. + +try { + $result = $apiInstance->textInputCheckXxe($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputCheckXxe: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| User-facing text input. | + **allow_internet_urls** | **bool**| Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. | [optional] + **known_safe_urls** | **string**| Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. | [optional] + **known_unsafe_urls** | **string**| Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. | [optional] + +### Return type + +[**\Swagger\Client\Model\XxeDetectionResult**](../Model/XxeDetectionResult.md) + +### Authorization + +[Apikey](../../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: application/json, text/json + - **Accept**: application/json, text/json, application/xml, text/xml + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **textInputCheckXxeBatch** +> \Swagger\Client\Model\XxeDetectionBatchResponse textInputCheckXxeBatch($request) + +Protect text input from XML External Entity (XXE) attacks + +Detects XXE (XML External Entity) attacks from text input. + +### Example +```php +setApiKey('Apikey', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Apikey', 'Bearer'); + +$apiInstance = new Swagger\Client\Api\TextInputApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$request = new \Swagger\Client\Model\XxeDetectionBatchRequest(); // \Swagger\Client\Model\XxeDetectionBatchRequest | + +try { + $result = $apiInstance->textInputCheckXxeBatch($request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputCheckXxeBatch: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request** | [**\Swagger\Client\Model\XxeDetectionBatchRequest**](../Model/XxeDetectionBatchRequest.md)| | + +### Return type + +[**\Swagger\Client\Model\XxeDetectionBatchResponse**](../Model/XxeDetectionBatchResponse.md) + +### Authorization + +[Apikey](../../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: application/json, text/json + - **Accept**: application/json, text/json, application/xml, text/xml + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **textInputProtectXss** > \Swagger\Client\Model\XssProtectionResult textInputProtectXss($value) diff --git a/docs/Model/XxeDetectionBatchRequest.md b/docs/Model/XxeDetectionBatchRequest.md new file mode 100644 index 0000000..3de9dc7 --- /dev/null +++ b/docs/Model/XxeDetectionBatchRequest.md @@ -0,0 +1,10 @@ +# XxeDetectionBatchRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_items** | [**\Swagger\Client\Model\XxeDetectionRequestItem[]**](XxeDetectionRequestItem.md) | Multiple items to protect for XXE | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/XxeDetectionBatchResponse.md b/docs/Model/XxeDetectionBatchResponse.md new file mode 100644 index 0000000..d9eaa34 --- /dev/null +++ b/docs/Model/XxeDetectionBatchResponse.md @@ -0,0 +1,10 @@ +# XxeDetectionBatchResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**result_items** | [**\Swagger\Client\Model\XxeDetectionResult[]**](XxeDetectionResult.md) | Results from performing a batch XSS protection operation | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/XxeDetectionRequestItem.md b/docs/Model/XxeDetectionRequestItem.md new file mode 100644 index 0000000..7b85f94 --- /dev/null +++ b/docs/Model/XxeDetectionRequestItem.md @@ -0,0 +1,13 @@ +# XxeDetectionRequestItem + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**input_text** | **string** | Individual input text item to protect from XXE | [optional] +**allow_internet_urls** | **bool** | Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. | [optional] +**known_safe_urls** | **string[]** | Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. | [optional] +**known_unsafe_urls** | **string[]** | Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Model/XxeDetectionResult.md b/docs/Model/XxeDetectionResult.md new file mode 100644 index 0000000..e2800c8 --- /dev/null +++ b/docs/Model/XxeDetectionResult.md @@ -0,0 +1,11 @@ +# XxeDetectionResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**successful** | **bool** | True if the operation was successful, false otherwise | [optional] +**contained_xxe** | **bool** | True if the input contained XXE threats, false otherwise | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lib/Api/TextInputApi.php b/lib/Api/TextInputApi.php index ef15ab3..a656d9d 100644 --- a/lib/Api/TextInputApi.php +++ b/lib/Api/TextInputApi.php @@ -1139,6 +1139,557 @@ protected function textInputCheckXssBatchRequest($value) ); } + /** + * Operation textInputCheckXxe + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param string $value User-facing text input. (required) + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. (optional) + * @param string $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. (optional) + * @param string $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\XxeDetectionResult + */ + public function textInputCheckXxe($value, $allow_internet_urls = null, $known_safe_urls = null, $known_unsafe_urls = null) + { + list($response) = $this->textInputCheckXxeWithHttpInfo($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls); + return $response; + } + + /** + * Operation textInputCheckXxeWithHttpInfo + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param string $value User-facing text input. (required) + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. (optional) + * @param string $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. (optional) + * @param string $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\XxeDetectionResult, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputCheckXxeWithHttpInfo($value, $allow_internet_urls = null, $known_safe_urls = null, $known_unsafe_urls = null) + { + $returnType = '\Swagger\Client\Model\XxeDetectionResult'; + $request = $this->textInputCheckXxeRequest($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\XxeDetectionResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputCheckXxeAsync + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param string $value User-facing text input. (required) + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. (optional) + * @param string $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. (optional) + * @param string $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXxeAsync($value, $allow_internet_urls = null, $known_safe_urls = null, $known_unsafe_urls = null) + { + return $this->textInputCheckXxeAsyncWithHttpInfo($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputCheckXxeAsyncWithHttpInfo + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param string $value User-facing text input. (required) + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. (optional) + * @param string $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. (optional) + * @param string $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXxeAsyncWithHttpInfo($value, $allow_internet_urls = null, $known_safe_urls = null, $known_unsafe_urls = null) + { + $returnType = '\Swagger\Client\Model\XxeDetectionResult'; + $request = $this->textInputCheckXxeRequest($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'textInputCheckXxe' + * + * @param string $value User-facing text input. (required) + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. (optional) + * @param string $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. (optional) + * @param string $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputCheckXxeRequest($value, $allow_internet_urls = null, $known_safe_urls = null, $known_unsafe_urls = null) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling textInputCheckXxe' + ); + } + + $resourcePath = '/validate/text-input/check/xxe'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // header params + if ($allow_internet_urls !== null) { + $headerParams['allowInternetUrls'] = ObjectSerializer::toHeaderValue($allow_internet_urls); + } + // header params + if ($known_safe_urls !== null) { + $headerParams['knownSafeUrls'] = ObjectSerializer::toHeaderValue($known_safe_urls); + } + // header params + if ($known_unsafe_urls !== null) { + $headerParams['knownUnsafeUrls'] = ObjectSerializer::toHeaderValue($known_unsafe_urls); + } + + + // body params + $_tempBody = null; + if (isset($value)) { + $_tempBody = $value; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation textInputCheckXxeBatch + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param \Swagger\Client\Model\XxeDetectionBatchRequest $request request (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\XxeDetectionBatchResponse + */ + public function textInputCheckXxeBatch($request) + { + list($response) = $this->textInputCheckXxeBatchWithHttpInfo($request); + return $response; + } + + /** + * Operation textInputCheckXxeBatchWithHttpInfo + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param \Swagger\Client\Model\XxeDetectionBatchRequest $request (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\XxeDetectionBatchResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputCheckXxeBatchWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\XxeDetectionBatchResponse'; + $request = $this->textInputCheckXxeBatchRequest($request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\XxeDetectionBatchResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputCheckXxeBatchAsync + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param \Swagger\Client\Model\XxeDetectionBatchRequest $request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXxeBatchAsync($request) + { + return $this->textInputCheckXxeBatchAsyncWithHttpInfo($request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputCheckXxeBatchAsyncWithHttpInfo + * + * Protect text input from XML External Entity (XXE) attacks + * + * @param \Swagger\Client\Model\XxeDetectionBatchRequest $request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXxeBatchAsyncWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\XxeDetectionBatchResponse'; + $request = $this->textInputCheckXxeBatchRequest($request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'textInputCheckXxeBatch' + * + * @param \Swagger\Client\Model\XxeDetectionBatchRequest $request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputCheckXxeBatchRequest($request) + { + // verify the required parameter 'request' is set + if ($request === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling textInputCheckXxeBatch' + ); + } + + $resourcePath = '/validate/text-input/check/xxe/batch'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($request)) { + $_tempBody = $request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation textInputProtectXss * diff --git a/lib/Configuration.php b/lib/Configuration.php index 4700a36..223ec52 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -88,7 +88,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/1.7.3/php'; + protected $userAgent = 'Swagger-Codegen/1.7.4/php'; /** * Debug switch (default set to false) @@ -397,7 +397,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' OpenAPI Spec Version: v1' . PHP_EOL; - $report .= ' SDK Package Version: 1.7.3' . PHP_EOL; + $report .= ' SDK Package Version: 1.7.4' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/XxeDetectionBatchRequest.php b/lib/Model/XxeDetectionBatchRequest.php new file mode 100644 index 0000000..56b7d75 --- /dev/null +++ b/lib/Model/XxeDetectionBatchRequest.php @@ -0,0 +1,303 @@ + '\Swagger\Client\Model\XxeDetectionRequestItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'request_items' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'request_items' => 'RequestItems' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request_items' => 'setRequestItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request_items' => 'getRequestItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['request_items'] = isset($data['request_items']) ? $data['request_items'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + + return true; + } + + + /** + * Gets request_items + * + * @return \Swagger\Client\Model\XxeDetectionRequestItem[] + */ + public function getRequestItems() + { + return $this->container['request_items']; + } + + /** + * Sets request_items + * + * @param \Swagger\Client\Model\XxeDetectionRequestItem[] $request_items Multiple items to protect for XXE + * + * @return $this + */ + public function setRequestItems($request_items) + { + $this->container['request_items'] = $request_items; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/XxeDetectionBatchResponse.php b/lib/Model/XxeDetectionBatchResponse.php new file mode 100644 index 0000000..6a3c734 --- /dev/null +++ b/lib/Model/XxeDetectionBatchResponse.php @@ -0,0 +1,303 @@ + '\Swagger\Client\Model\XxeDetectionResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'result_items' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'result_items' => 'ResultItems' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result_items' => 'setResultItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result_items' => 'getResultItems' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['result_items'] = isset($data['result_items']) ? $data['result_items'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + + return true; + } + + + /** + * Gets result_items + * + * @return \Swagger\Client\Model\XxeDetectionResult[] + */ + public function getResultItems() + { + return $this->container['result_items']; + } + + /** + * Sets result_items + * + * @param \Swagger\Client\Model\XxeDetectionResult[] $result_items Results from performing a batch XSS protection operation + * + * @return $this + */ + public function setResultItems($result_items) + { + $this->container['result_items'] = $result_items; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/XxeDetectionRequestItem.php b/lib/Model/XxeDetectionRequestItem.php new file mode 100644 index 0000000..9869a62 --- /dev/null +++ b/lib/Model/XxeDetectionRequestItem.php @@ -0,0 +1,393 @@ + 'string', + 'allow_internet_urls' => 'bool', + 'known_safe_urls' => 'string[]', + 'known_unsafe_urls' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'input_text' => null, + 'allow_internet_urls' => null, + 'known_safe_urls' => null, + 'known_unsafe_urls' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'input_text' => 'InputText', + 'allow_internet_urls' => 'AllowInternetUrls', + 'known_safe_urls' => 'KnownSafeUrls', + 'known_unsafe_urls' => 'KnownUnsafeUrls' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'input_text' => 'setInputText', + 'allow_internet_urls' => 'setAllowInternetUrls', + 'known_safe_urls' => 'setKnownSafeUrls', + 'known_unsafe_urls' => 'setKnownUnsafeUrls' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'input_text' => 'getInputText', + 'allow_internet_urls' => 'getAllowInternetUrls', + 'known_safe_urls' => 'getKnownSafeUrls', + 'known_unsafe_urls' => 'getKnownUnsafeUrls' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['input_text'] = isset($data['input_text']) ? $data['input_text'] : null; + $this->container['allow_internet_urls'] = isset($data['allow_internet_urls']) ? $data['allow_internet_urls'] : null; + $this->container['known_safe_urls'] = isset($data['known_safe_urls']) ? $data['known_safe_urls'] : null; + $this->container['known_unsafe_urls'] = isset($data['known_unsafe_urls']) ? $data['known_unsafe_urls'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + + return true; + } + + + /** + * Gets input_text + * + * @return string + */ + public function getInputText() + { + return $this->container['input_text']; + } + + /** + * Sets input_text + * + * @param string $input_text Individual input text item to protect from XXE + * + * @return $this + */ + public function setInputText($input_text) + { + $this->container['input_text'] = $input_text; + + return $this; + } + + /** + * Gets allow_internet_urls + * + * @return bool + */ + public function getAllowInternetUrls() + { + return $this->container['allow_internet_urls']; + } + + /** + * Sets allow_internet_urls + * + * @param bool $allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. + * + * @return $this + */ + public function setAllowInternetUrls($allow_internet_urls) + { + $this->container['allow_internet_urls'] = $allow_internet_urls; + + return $this; + } + + /** + * Gets known_safe_urls + * + * @return string[] + */ + public function getKnownSafeUrls() + { + return $this->container['known_safe_urls']; + } + + /** + * Sets known_safe_urls + * + * @param string[] $known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. + * + * @return $this + */ + public function setKnownSafeUrls($known_safe_urls) + { + $this->container['known_safe_urls'] = $known_safe_urls; + + return $this; + } + + /** + * Gets known_unsafe_urls + * + * @return string[] + */ + public function getKnownUnsafeUrls() + { + return $this->container['known_unsafe_urls']; + } + + /** + * Sets known_unsafe_urls + * + * @param string[] $known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. + * + * @return $this + */ + public function setKnownUnsafeUrls($known_unsafe_urls) + { + $this->container['known_unsafe_urls'] = $known_unsafe_urls; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/XxeDetectionResult.php b/lib/Model/XxeDetectionResult.php new file mode 100644 index 0000000..0eecdcf --- /dev/null +++ b/lib/Model/XxeDetectionResult.php @@ -0,0 +1,333 @@ + 'bool', + 'contained_xxe' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'successful' => null, + 'contained_xxe' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function swaggerFormats() + { + return self::$swaggerFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'successful' => 'Successful', + 'contained_xxe' => 'ContainedXxe' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'successful' => 'setSuccessful', + 'contained_xxe' => 'setContainedXxe' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'successful' => 'getSuccessful', + 'contained_xxe' => 'getContainedXxe' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$swaggerModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['successful'] = isset($data['successful']) ? $data['successful'] : null; + $this->container['contained_xxe'] = isset($data['contained_xxe']) ? $data['contained_xxe'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + + return true; + } + + + /** + * Gets successful + * + * @return bool + */ + public function getSuccessful() + { + return $this->container['successful']; + } + + /** + * Sets successful + * + * @param bool $successful True if the operation was successful, false otherwise + * + * @return $this + */ + public function setSuccessful($successful) + { + $this->container['successful'] = $successful; + + return $this; + } + + /** + * Gets contained_xxe + * + * @return bool + */ + public function getContainedXxe() + { + return $this->container['contained_xxe']; + } + + /** + * Sets contained_xxe + * + * @param bool $contained_xxe True if the input contained XXE threats, false otherwise + * + * @return $this + */ + public function setContainedXxe($contained_xxe) + { + $this->container['contained_xxe'] = $contained_xxe; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/packageconfig.json b/packageconfig.json index aaab459..307c917 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,5 +1,5 @@ { - "artifactVersion": "1.7.3", + "artifactVersion": "1.7.4", "gitUserId": "Cloudmersive", "gitRepoId": "Cloudmersive.APIClient.PHP.Validate", "composerVendorName": "cloudmersive", diff --git a/test/Api/TextInputApiTest.php b/test/Api/TextInputApiTest.php index 691ee90..53d27a1 100644 --- a/test/Api/TextInputApiTest.php +++ b/test/Api/TextInputApiTest.php @@ -111,6 +111,26 @@ public function testTextInputCheckXssBatch() { } + /** + * Test case for textInputCheckXxe + * + * Protect text input from XML External Entity (XXE) attacks. + * + */ + public function testTextInputCheckXxe() + { + } + + /** + * Test case for textInputCheckXxeBatch + * + * Protect text input from XML External Entity (XXE) attacks. + * + */ + public function testTextInputCheckXxeBatch() + { + } + /** * Test case for textInputProtectXss * diff --git a/test/Model/XxeDetectionBatchRequestTest.php b/test/Model/XxeDetectionBatchRequestTest.php new file mode 100644 index 0000000..c751243 --- /dev/null +++ b/test/Model/XxeDetectionBatchRequestTest.php @@ -0,0 +1,86 @@ +