From a587e852baff9fd7f92bc11a1d9dc291878be75a Mon Sep 17 00:00:00 2001 From: Cloudmersive <35204726+Cloudmersive@users.noreply.github.com> Date: Fri, 2 Apr 2021 20:58:04 -0700 Subject: [PATCH] 1.7.3 --- README.md | 8 +- composer.json | 2 +- docs/Api/TextInputApi.md | 116 +++- docs/Model/SqlInjectionCheckBatchRequest.md | 11 + docs/Model/SqlInjectionCheckBatchResponse.md | 10 + docs/Model/SqlInjectionCheckRequestItem.md | 10 + docs/Model/SqlInjectionDetectionResult.md | 12 + lib/Api/TextInputApi.php | 533 ++++++++++++++++++ lib/Configuration.php | 4 +- lib/Model/SqlInjectionCheckBatchRequest.php | 333 +++++++++++ lib/Model/SqlInjectionCheckBatchResponse.php | 303 ++++++++++ lib/Model/SqlInjectionCheckRequestItem.php | 303 ++++++++++ lib/Model/SqlInjectionDetectionResult.php | 363 ++++++++++++ packageconfig.json | 2 +- test/Api/TextInputApiTest.php | 20 + .../SqlInjectionCheckBatchRequestTest.php | 93 +++ .../SqlInjectionCheckBatchResponseTest.php | 86 +++ .../SqlInjectionCheckRequestItemTest.php | 86 +++ .../Model/SqlInjectionDetectionResultTest.php | 100 ++++ 19 files changed, 2389 insertions(+), 6 deletions(-) create mode 100644 docs/Model/SqlInjectionCheckBatchRequest.md create mode 100644 docs/Model/SqlInjectionCheckBatchResponse.md create mode 100644 docs/Model/SqlInjectionCheckRequestItem.md create mode 100644 docs/Model/SqlInjectionDetectionResult.md create mode 100644 lib/Model/SqlInjectionCheckBatchRequest.php create mode 100644 lib/Model/SqlInjectionCheckBatchResponse.php create mode 100644 lib/Model/SqlInjectionCheckRequestItem.php create mode 100644 lib/Model/SqlInjectionDetectionResult.php create mode 100644 test/Model/SqlInjectionCheckBatchRequestTest.php create mode 100644 test/Model/SqlInjectionCheckBatchResponseTest.php create mode 100644 test/Model/SqlInjectionCheckRequestItemTest.php create mode 100644 test/Model/SqlInjectionDetectionResultTest.php diff --git a/README.md b/README.md index e128b6d..21e3528 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.2 +- Package version: 1.7.3 ## Requirements @@ -131,6 +131,8 @@ Class | Method | HTTP request | Description *NameApi* | [**nameValidateFullName**](docs/Api/NameApi.md#namevalidatefullname) | **POST** /validate/name/full-name | Parse and validate a full name *NameApi* | [**nameValidateLastName**](docs/Api/NameApi.md#namevalidatelastname) | **POST** /validate/name/last | Validate a last name *PhoneNumberApi* | [**phoneNumberSyntaxOnly**](docs/Api/PhoneNumberApi.md#phonenumbersyntaxonly) | **POST** /validate/phonenumber/basic | Validate phone number (basic) +*TextInputApi* | [**textInputCheckSqlInjection**](docs/Api/TextInputApi.md#textinputchecksqlinjection) | **POST** /validate/text-input/check/sql-injection | Check text input for SQL Injection (SQLI) attacks +*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* | [**textInputProtectXss**](docs/Api/TextInputApi.md#textinputprotectxss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization @@ -181,6 +183,10 @@ Class | Method | HTTP request | Description - [PublicHolidaysResponse](docs/Model/PublicHolidaysResponse.md) - [ReverseGeocodeAddressRequest](docs/Model/ReverseGeocodeAddressRequest.md) - [ReverseGeocodeAddressResponse](docs/Model/ReverseGeocodeAddressResponse.md) + - [SqlInjectionCheckBatchRequest](docs/Model/SqlInjectionCheckBatchRequest.md) + - [SqlInjectionCheckBatchResponse](docs/Model/SqlInjectionCheckBatchResponse.md) + - [SqlInjectionCheckRequestItem](docs/Model/SqlInjectionCheckRequestItem.md) + - [SqlInjectionDetectionResult](docs/Model/SqlInjectionDetectionResult.md) - [Timezone](docs/Model/Timezone.md) - [TorNodeResponse](docs/Model/TorNodeResponse.md) - [UrlSafetyCheckRequestFull](docs/Model/UrlSafetyCheckRequestFull.md) diff --git a/composer.json b/composer.json index a00dc9e..c98fba3 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "cloudmersive/cloudmersive_validate_api_client", - "version": "1.7.2", + "version": "1.7.3", "description": "", "keywords": [ "swagger", diff --git a/docs/Api/TextInputApi.md b/docs/Api/TextInputApi.md index deab0a2..0a0a094 100644 --- a/docs/Api/TextInputApi.md +++ b/docs/Api/TextInputApi.md @@ -4,11 +4,125 @@ All URIs are relative to *https://api.cloudmersive.com* Method | HTTP request | Description ------------- | ------------- | ------------- +[**textInputCheckSqlInjection**](TextInputApi.md#textInputCheckSqlInjection) | **POST** /validate/text-input/check/sql-injection | Check text input for SQL Injection (SQLI) attacks +[**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 [**textInputProtectXss**](TextInputApi.md#textInputProtectXss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization +# **textInputCheckSqlInjection** +> \Swagger\Client\Model\SqlInjectionDetectionResult textInputCheckSqlInjection($value, $detection_level) + +Check text input for SQL Injection (SQLI) attacks + +Detects SQL Injection (SQLI) 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. +$detection_level = "detection_level_example"; // string | Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). + +try { + $result = $apiInstance->textInputCheckSqlInjection($value, $detection_level); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputCheckSqlInjection: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| User-facing text input. | + **detection_level** | **string**| Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). | [optional] + +### Return type + +[**\Swagger\Client\Model\SqlInjectionDetectionResult**](../Model/SqlInjectionDetectionResult.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) + +# **textInputCheckSqlInjectionBatch** +> \Swagger\Client\Model\SqlInjectionCheckBatchResponse textInputCheckSqlInjectionBatch($value) + +Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch + +Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items. + +### 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 = new \Swagger\Client\Model\SqlInjectionCheckBatchRequest(); // \Swagger\Client\Model\SqlInjectionCheckBatchRequest | User-facing text input. + +try { + $result = $apiInstance->textInputCheckSqlInjectionBatch($value); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputCheckSqlInjectionBatch: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | [**\Swagger\Client\Model\SqlInjectionCheckBatchRequest**](../Model/SqlInjectionCheckBatchRequest.md)| User-facing text input. | + +### Return type + +[**\Swagger\Client\Model\SqlInjectionCheckBatchResponse**](../Model/SqlInjectionCheckBatchResponse.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) + # **textInputCheckXss** > \Swagger\Client\Model\XssProtectionResult textInputCheckXss($value) @@ -69,7 +183,7 @@ Name | Type | Description | Notes Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch -Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items. +Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items. ### Example ```php diff --git a/docs/Model/SqlInjectionCheckBatchRequest.md b/docs/Model/SqlInjectionCheckBatchRequest.md new file mode 100644 index 0000000..49333d7 --- /dev/null +++ b/docs/Model/SqlInjectionCheckBatchRequest.md @@ -0,0 +1,11 @@ +# SqlInjectionCheckBatchRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_items** | [**\Swagger\Client\Model\SqlInjectionCheckRequestItem[]**](SqlInjectionCheckRequestItem.md) | Multiple items to detect for SQL Injection | [optional] +**detection_level** | **string** | Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). | [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/SqlInjectionCheckBatchResponse.md b/docs/Model/SqlInjectionCheckBatchResponse.md new file mode 100644 index 0000000..e753dba --- /dev/null +++ b/docs/Model/SqlInjectionCheckBatchResponse.md @@ -0,0 +1,10 @@ +# SqlInjectionCheckBatchResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**result_items** | [**\Swagger\Client\Model\SqlInjectionDetectionResult[]**](SqlInjectionDetectionResult.md) | Results from performing a batch SQL Injection detection operation; order is preserved from input data | [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/SqlInjectionCheckRequestItem.md b/docs/Model/SqlInjectionCheckRequestItem.md new file mode 100644 index 0000000..6fe2280 --- /dev/null +++ b/docs/Model/SqlInjectionCheckRequestItem.md @@ -0,0 +1,10 @@ +# SqlInjectionCheckRequestItem + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**input_text** | **string** | Individual input text item to check for SQL Injection | [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/SqlInjectionDetectionResult.md b/docs/Model/SqlInjectionDetectionResult.md new file mode 100644 index 0000000..1069ac1 --- /dev/null +++ b/docs/Model/SqlInjectionDetectionResult.md @@ -0,0 +1,12 @@ +# SqlInjectionDetectionResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**successful** | **bool** | True if the operation was successful, false otherwise | [optional] +**contained_sql_injection_attack** | **bool** | True if the input contained SQL Injection attacks, false otherwise | [optional] +**original_input** | **string** | Original input string | [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 77931b9..ef15ab3 100644 --- a/lib/Api/TextInputApi.php +++ b/lib/Api/TextInputApi.php @@ -82,6 +82,539 @@ public function getConfig() return $this->config; } + /** + * Operation textInputCheckSqlInjection + * + * Check text input for SQL Injection (SQLI) attacks + * + * @param string $value User-facing text input. (required) + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\SqlInjectionDetectionResult + */ + public function textInputCheckSqlInjection($value, $detection_level = null) + { + list($response) = $this->textInputCheckSqlInjectionWithHttpInfo($value, $detection_level); + return $response; + } + + /** + * Operation textInputCheckSqlInjectionWithHttpInfo + * + * Check text input for SQL Injection (SQLI) attacks + * + * @param string $value User-facing text input. (required) + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). (optional) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\SqlInjectionDetectionResult, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputCheckSqlInjectionWithHttpInfo($value, $detection_level = null) + { + $returnType = '\Swagger\Client\Model\SqlInjectionDetectionResult'; + $request = $this->textInputCheckSqlInjectionRequest($value, $detection_level); + + 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\SqlInjectionDetectionResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputCheckSqlInjectionAsync + * + * Check text input for SQL Injection (SQLI) attacks + * + * @param string $value User-facing text input. (required) + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckSqlInjectionAsync($value, $detection_level = null) + { + return $this->textInputCheckSqlInjectionAsyncWithHttpInfo($value, $detection_level) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputCheckSqlInjectionAsyncWithHttpInfo + * + * Check text input for SQL Injection (SQLI) attacks + * + * @param string $value User-facing text input. (required) + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckSqlInjectionAsyncWithHttpInfo($value, $detection_level = null) + { + $returnType = '\Swagger\Client\Model\SqlInjectionDetectionResult'; + $request = $this->textInputCheckSqlInjectionRequest($value, $detection_level); + + 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 'textInputCheckSqlInjection' + * + * @param string $value User-facing text input. (required) + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputCheckSqlInjectionRequest($value, $detection_level = null) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling textInputCheckSqlInjection' + ); + } + + $resourcePath = '/validate/text-input/check/sql-injection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // header params + if ($detection_level !== null) { + $headerParams['detectionLevel'] = ObjectSerializer::toHeaderValue($detection_level); + } + + + // 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 textInputCheckSqlInjectionBatch + * + * Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch + * + * @param \Swagger\Client\Model\SqlInjectionCheckBatchRequest $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\SqlInjectionCheckBatchResponse + */ + public function textInputCheckSqlInjectionBatch($value) + { + list($response) = $this->textInputCheckSqlInjectionBatchWithHttpInfo($value); + return $response; + } + + /** + * Operation textInputCheckSqlInjectionBatchWithHttpInfo + * + * Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch + * + * @param \Swagger\Client\Model\SqlInjectionCheckBatchRequest $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\SqlInjectionCheckBatchResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputCheckSqlInjectionBatchWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\SqlInjectionCheckBatchResponse'; + $request = $this->textInputCheckSqlInjectionBatchRequest($value); + + 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\SqlInjectionCheckBatchResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputCheckSqlInjectionBatchAsync + * + * Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch + * + * @param \Swagger\Client\Model\SqlInjectionCheckBatchRequest $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckSqlInjectionBatchAsync($value) + { + return $this->textInputCheckSqlInjectionBatchAsyncWithHttpInfo($value) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputCheckSqlInjectionBatchAsyncWithHttpInfo + * + * Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch + * + * @param \Swagger\Client\Model\SqlInjectionCheckBatchRequest $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckSqlInjectionBatchAsyncWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\SqlInjectionCheckBatchResponse'; + $request = $this->textInputCheckSqlInjectionBatchRequest($value); + + 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 'textInputCheckSqlInjectionBatch' + * + * @param \Swagger\Client\Model\SqlInjectionCheckBatchRequest $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputCheckSqlInjectionBatchRequest($value) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling textInputCheckSqlInjectionBatch' + ); + } + + $resourcePath = '/validate/text-input/check/sql-injection/batch'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // 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 textInputCheckXss * diff --git a/lib/Configuration.php b/lib/Configuration.php index ccdf352..4700a36 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -88,7 +88,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/1.7.2/php'; + protected $userAgent = 'Swagger-Codegen/1.7.3/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.2' . PHP_EOL; + $report .= ' SDK Package Version: 1.7.3' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/SqlInjectionCheckBatchRequest.php b/lib/Model/SqlInjectionCheckBatchRequest.php new file mode 100644 index 0000000..18c6937 --- /dev/null +++ b/lib/Model/SqlInjectionCheckBatchRequest.php @@ -0,0 +1,333 @@ + '\Swagger\Client\Model\SqlInjectionCheckRequestItem[]', + 'detection_level' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'request_items' => null, + 'detection_level' => 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', + 'detection_level' => 'DetectionLevel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'request_items' => 'setRequestItems', + 'detection_level' => 'setDetectionLevel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'request_items' => 'getRequestItems', + 'detection_level' => 'getDetectionLevel' + ]; + + /** + * 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; + $this->container['detection_level'] = isset($data['detection_level']) ? $data['detection_level'] : 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\SqlInjectionCheckRequestItem[] + */ + public function getRequestItems() + { + return $this->container['request_items']; + } + + /** + * Sets request_items + * + * @param \Swagger\Client\Model\SqlInjectionCheckRequestItem[] $request_items Multiple items to detect for SQL Injection + * + * @return $this + */ + public function setRequestItems($request_items) + { + $this->container['request_items'] = $request_items; + + return $this; + } + + /** + * Gets detection_level + * + * @return string + */ + public function getDetectionLevel() + { + return $this->container['detection_level']; + } + + /** + * Sets detection_level + * + * @param string $detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). + * + * @return $this + */ + public function setDetectionLevel($detection_level) + { + $this->container['detection_level'] = $detection_level; + + 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/SqlInjectionCheckBatchResponse.php b/lib/Model/SqlInjectionCheckBatchResponse.php new file mode 100644 index 0000000..2854ed3 --- /dev/null +++ b/lib/Model/SqlInjectionCheckBatchResponse.php @@ -0,0 +1,303 @@ + '\Swagger\Client\Model\SqlInjectionDetectionResult[]' + ]; + + /** + * 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\SqlInjectionDetectionResult[] + */ + public function getResultItems() + { + return $this->container['result_items']; + } + + /** + * Sets result_items + * + * @param \Swagger\Client\Model\SqlInjectionDetectionResult[] $result_items Results from performing a batch SQL Injection detection operation; order is preserved from input data + * + * @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/SqlInjectionCheckRequestItem.php b/lib/Model/SqlInjectionCheckRequestItem.php new file mode 100644 index 0000000..ce6e8dc --- /dev/null +++ b/lib/Model/SqlInjectionCheckRequestItem.php @@ -0,0 +1,303 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'input_text' => 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' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'input_text' => 'setInputText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'input_text' => 'getInputText' + ]; + + /** + * 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; + } + + /** + * 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 check for SQL Injection + * + * @return $this + */ + public function setInputText($input_text) + { + $this->container['input_text'] = $input_text; + + 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/SqlInjectionDetectionResult.php b/lib/Model/SqlInjectionDetectionResult.php new file mode 100644 index 0000000..3ca8f29 --- /dev/null +++ b/lib/Model/SqlInjectionDetectionResult.php @@ -0,0 +1,363 @@ + 'bool', + 'contained_sql_injection_attack' => 'bool', + 'original_input' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'successful' => null, + 'contained_sql_injection_attack' => null, + 'original_input' => 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_sql_injection_attack' => 'ContainedSqlInjectionAttack', + 'original_input' => 'OriginalInput' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'successful' => 'setSuccessful', + 'contained_sql_injection_attack' => 'setContainedSqlInjectionAttack', + 'original_input' => 'setOriginalInput' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'successful' => 'getSuccessful', + 'contained_sql_injection_attack' => 'getContainedSqlInjectionAttack', + 'original_input' => 'getOriginalInput' + ]; + + /** + * 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_sql_injection_attack'] = isset($data['contained_sql_injection_attack']) ? $data['contained_sql_injection_attack'] : null; + $this->container['original_input'] = isset($data['original_input']) ? $data['original_input'] : 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_sql_injection_attack + * + * @return bool + */ + public function getContainedSqlInjectionAttack() + { + return $this->container['contained_sql_injection_attack']; + } + + /** + * Sets contained_sql_injection_attack + * + * @param bool $contained_sql_injection_attack True if the input contained SQL Injection attacks, false otherwise + * + * @return $this + */ + public function setContainedSqlInjectionAttack($contained_sql_injection_attack) + { + $this->container['contained_sql_injection_attack'] = $contained_sql_injection_attack; + + return $this; + } + + /** + * Gets original_input + * + * @return string + */ + public function getOriginalInput() + { + return $this->container['original_input']; + } + + /** + * Sets original_input + * + * @param string $original_input Original input string + * + * @return $this + */ + public function setOriginalInput($original_input) + { + $this->container['original_input'] = $original_input; + + 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 f3a83c8..aaab459 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,5 +1,5 @@ { - "artifactVersion": "1.7.2", + "artifactVersion": "1.7.3", "gitUserId": "Cloudmersive", "gitRepoId": "Cloudmersive.APIClient.PHP.Validate", "composerVendorName": "cloudmersive", diff --git a/test/Api/TextInputApiTest.php b/test/Api/TextInputApiTest.php index 163fd98..691ee90 100644 --- a/test/Api/TextInputApiTest.php +++ b/test/Api/TextInputApiTest.php @@ -71,6 +71,26 @@ public static function tearDownAfterClass() { } + /** + * Test case for textInputCheckSqlInjection + * + * Check text input for SQL Injection (SQLI) attacks. + * + */ + public function testTextInputCheckSqlInjection() + { + } + + /** + * Test case for textInputCheckSqlInjectionBatch + * + * Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch. + * + */ + public function testTextInputCheckSqlInjectionBatch() + { + } + /** * Test case for textInputCheckXss * diff --git a/test/Model/SqlInjectionCheckBatchRequestTest.php b/test/Model/SqlInjectionCheckBatchRequestTest.php new file mode 100644 index 0000000..05e9e69 --- /dev/null +++ b/test/Model/SqlInjectionCheckBatchRequestTest.php @@ -0,0 +1,93 @@ +