From 24f0fb93460afed5666b6a0649cd18fdd636ed68 Mon Sep 17 00:00:00 2001 From: Cloudmersive <35204726+Cloudmersive@users.noreply.github.com> Date: Mon, 5 Oct 2020 18:26:50 -0700 Subject: [PATCH] 1.6.6 --- README.md | 7 +- composer.json | 2 +- docs/Api/IPAddressApi.md | 56 ++ docs/Api/TextInputApi.md | 120 ++++ docs/Model/GeolocateStreetAddressResponse.md | 15 + docs/Model/XssProtectionResult.md | 13 + lib/Api/IPAddressApi.php | 262 ++++++++ lib/Api/TextInputApi.php | 627 ++++++++++++++++++ lib/Configuration.php | 4 +- lib/Model/GeolocateStreetAddressResponse.php | 453 +++++++++++++ lib/Model/XssProtectionResult.php | 393 +++++++++++ packageconfig.json | 2 +- test/Api/IPAddressApiTest.php | 10 + test/Api/TextInputApiTest.php | 93 +++ .../GeolocateStreetAddressResponseTest.php | 121 ++++ test/Model/XssProtectionResultTest.php | 107 +++ 16 files changed, 2280 insertions(+), 5 deletions(-) create mode 100644 docs/Api/TextInputApi.md create mode 100644 docs/Model/GeolocateStreetAddressResponse.md create mode 100644 docs/Model/XssProtectionResult.md create mode 100644 lib/Api/TextInputApi.php create mode 100644 lib/Model/GeolocateStreetAddressResponse.php create mode 100644 lib/Model/XssProtectionResult.php create mode 100644 test/Api/TextInputApiTest.php create mode 100644 test/Model/GeolocateStreetAddressResponseTest.php create mode 100644 test/Model/XssProtectionResultTest.php diff --git a/README.md b/README.md index 7552047..ddfc969 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.6.5 +- Package version: 1.6.6 ## Requirements @@ -107,6 +107,7 @@ Class | Method | HTTP request | Description *EmailApi* | [**emailAddressGetServers**](docs/Api/EmailApi.md#emailaddressgetservers) | **POST** /validate/email/address/servers | Partially check whether an email address is valid *EmailApi* | [**emailFullValidation**](docs/Api/EmailApi.md#emailfullvalidation) | **POST** /validate/email/address/full | Fully validate an email address *EmailApi* | [**emailPost**](docs/Api/EmailApi.md#emailpost) | **POST** /validate/email/address/syntaxOnly | Validate email adddress for syntactic correctness only +*IPAddressApi* | [**iPAddressGeolocateStreetAddress**](docs/Api/IPAddressApi.md#ipaddressgeolocatestreetaddress) | **POST** /validate/ip/geolocate/street-address | Geolocate an IP address to a street address *IPAddressApi* | [**iPAddressIsThreat**](docs/Api/IPAddressApi.md#ipaddressisthreat) | **POST** /validate/ip/is-threat | Check if IP address is a known threat *IPAddressApi* | [**iPAddressIsTorNode**](docs/Api/IPAddressApi.md#ipaddressistornode) | **POST** /validate/ip/is-tor-node | Check if IP address is a Tor node server *IPAddressApi* | [**iPAddressPost**](docs/Api/IPAddressApi.md#ipaddresspost) | **POST** /validate/ip/geolocate | Geolocate an IP address @@ -117,6 +118,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* | [**textInputCheckXss**](docs/Api/TextInputApi.md#textinputcheckxss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) 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 @@ -135,6 +138,7 @@ Class | Method | HTTP request | Description - [FullNameValidationRequest](docs/Model/FullNameValidationRequest.md) - [FullNameValidationResponse](docs/Model/FullNameValidationResponse.md) - [GeolocateResponse](docs/Model/GeolocateResponse.md) + - [GeolocateStreetAddressResponse](docs/Model/GeolocateStreetAddressResponse.md) - [GetGenderRequest](docs/Model/GetGenderRequest.md) - [GetGenderResponse](docs/Model/GetGenderResponse.md) - [GetTimezonesRequest](docs/Model/GetTimezonesRequest.md) @@ -173,6 +177,7 @@ Class | Method | HTTP request | Description - [VatLookupRequest](docs/Model/VatLookupRequest.md) - [VatLookupResponse](docs/Model/VatLookupResponse.md) - [WhoisResponse](docs/Model/WhoisResponse.md) + - [XssProtectionResult](docs/Model/XssProtectionResult.md) ## Documentation For Authorization diff --git a/composer.json b/composer.json index f3eb021..a38b621 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "cloudmersive/cloudmersive_validate_api_client", - "version": "1.6.5", + "version": "1.6.6", "description": "", "keywords": [ "swagger", diff --git a/docs/Api/IPAddressApi.md b/docs/Api/IPAddressApi.md index e32302b..498c325 100644 --- a/docs/Api/IPAddressApi.md +++ b/docs/Api/IPAddressApi.md @@ -4,11 +4,67 @@ All URIs are relative to *https://api.cloudmersive.com* Method | HTTP request | Description ------------- | ------------- | ------------- +[**iPAddressGeolocateStreetAddress**](IPAddressApi.md#iPAddressGeolocateStreetAddress) | **POST** /validate/ip/geolocate/street-address | Geolocate an IP address to a street address [**iPAddressIsThreat**](IPAddressApi.md#iPAddressIsThreat) | **POST** /validate/ip/is-threat | Check if IP address is a known threat [**iPAddressIsTorNode**](IPAddressApi.md#iPAddressIsTorNode) | **POST** /validate/ip/is-tor-node | Check if IP address is a Tor node server [**iPAddressPost**](IPAddressApi.md#iPAddressPost) | **POST** /validate/ip/geolocate | Geolocate an IP address +# **iPAddressGeolocateStreetAddress** +> \Swagger\Client\Model\GeolocateStreetAddressResponse iPAddressGeolocateStreetAddress($value) + +Geolocate an IP address to a street address + +Identify an IP address's street address. Useful for security and UX applications. + +### 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\IPAddressApi( + // 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 | IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. + +try { + $result = $apiInstance->iPAddressGeolocateStreetAddress($value); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling IPAddressApi->iPAddressGeolocateStreetAddress: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. | + +### Return type + +[**\Swagger\Client\Model\GeolocateStreetAddressResponse**](../Model/GeolocateStreetAddressResponse.md) + +### Authorization + +[Apikey](../../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: text/javascript, 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) + # **iPAddressIsThreat** > \Swagger\Client\Model\IPThreatResponse iPAddressIsThreat($value) diff --git a/docs/Api/TextInputApi.md b/docs/Api/TextInputApi.md new file mode 100644 index 0000000..2192f87 --- /dev/null +++ b/docs/Api/TextInputApi.md @@ -0,0 +1,120 @@ +# Swagger\Client\TextInputApi + +All URIs are relative to *https://api.cloudmersive.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**textInputCheckXss**](TextInputApi.md#textInputCheckXss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) attacks +[**textInputProtectXss**](TextInputApi.md#textInputProtectXss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + + +# **textInputCheckXss** +> \Swagger\Client\Model\XssProtectionResult textInputCheckXss($value) + +Check text input for Cross-Site-Scripting (XSS) attacks + +Detects XSS (Cross-Site-Scripting) 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. + +try { + $result = $apiInstance->textInputCheckXss($value); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputCheckXss: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| User-facing text input. | + +### Return type + +[**\Swagger\Client\Model\XssProtectionResult**](../Model/XssProtectionResult.md) + +### Authorization + +[Apikey](../../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: text/javascript, 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) + +Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + +Detects and removes XSS (Cross-Site-Scripting) attacks from text input through normalization. Returns the normalized result, as well as information on whether the original input contained an XSS risk. + +### 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. + +try { + $result = $apiInstance->textInputProtectXss($value); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TextInputApi->textInputProtectXss: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| User-facing text input. | + +### Return type + +[**\Swagger\Client\Model\XssProtectionResult**](../Model/XssProtectionResult.md) + +### Authorization + +[Apikey](../../README.md#Apikey) + +### HTTP request headers + + - **Content-Type**: text/javascript, 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) + diff --git a/docs/Model/GeolocateStreetAddressResponse.md b/docs/Model/GeolocateStreetAddressResponse.md new file mode 100644 index 0000000..6981202 --- /dev/null +++ b/docs/Model/GeolocateStreetAddressResponse.md @@ -0,0 +1,15 @@ +# GeolocateStreetAddressResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**country_code** | **string** | Two-letter country code of IP address | [optional] +**country_name** | **string** | Country name of IP address | [optional] +**street_address** | **string** | Street address of IP address | [optional] +**city** | **string** | City of IP address | [optional] +**region_name** | **string** | State/region of IP address | [optional] +**zip_code** | **string** | Zip or postal code of IP address | [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/XssProtectionResult.md b/docs/Model/XssProtectionResult.md new file mode 100644 index 0000000..944ff9b --- /dev/null +++ b/docs/Model/XssProtectionResult.md @@ -0,0 +1,13 @@ +# XssProtectionResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**successful** | **bool** | True if the operation was successful, false otherwise | [optional] +**contained_xss** | **bool** | True if the input contained XSS scripting, false otherwise | [optional] +**original_input** | **string** | Original input string | [optional] +**normalized_result** | **string** | Normalized string result, with XSS removed | [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/IPAddressApi.php b/lib/Api/IPAddressApi.php index 6ac8c72..16acb69 100644 --- a/lib/Api/IPAddressApi.php +++ b/lib/Api/IPAddressApi.php @@ -82,6 +82,268 @@ public function getConfig() return $this->config; } + /** + * Operation iPAddressGeolocateStreetAddress + * + * Geolocate an IP address to a street address + * + * @param string $value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\GeolocateStreetAddressResponse + */ + public function iPAddressGeolocateStreetAddress($value) + { + list($response) = $this->iPAddressGeolocateStreetAddressWithHttpInfo($value); + return $response; + } + + /** + * Operation iPAddressGeolocateStreetAddressWithHttpInfo + * + * Geolocate an IP address to a street address + * + * @param string $value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\GeolocateStreetAddressResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function iPAddressGeolocateStreetAddressWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\GeolocateStreetAddressResponse'; + $request = $this->iPAddressGeolocateStreetAddressRequest($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\GeolocateStreetAddressResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation iPAddressGeolocateStreetAddressAsync + * + * Geolocate an IP address to a street address + * + * @param string $value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function iPAddressGeolocateStreetAddressAsync($value) + { + return $this->iPAddressGeolocateStreetAddressAsyncWithHttpInfo($value) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation iPAddressGeolocateStreetAddressAsyncWithHttpInfo + * + * Geolocate an IP address to a street address + * + * @param string $value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function iPAddressGeolocateStreetAddressAsyncWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\GeolocateStreetAddressResponse'; + $request = $this->iPAddressGeolocateStreetAddressRequest($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 'iPAddressGeolocateStreetAddress' + * + * @param string $value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function iPAddressGeolocateStreetAddressRequest($value) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling iPAddressGeolocateStreetAddress' + ); + } + + $resourcePath = '/validate/ip/geolocate/street-address'; + $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'], + ['text/javascript', '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 iPAddressIsThreat * diff --git a/lib/Api/TextInputApi.php b/lib/Api/TextInputApi.php new file mode 100644 index 0000000..8721d0e --- /dev/null +++ b/lib/Api/TextInputApi.php @@ -0,0 +1,627 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation textInputCheckXss + * + * Check text input for Cross-Site-Scripting (XSS) attacks + * + * @param string $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\XssProtectionResult + */ + public function textInputCheckXss($value) + { + list($response) = $this->textInputCheckXssWithHttpInfo($value); + return $response; + } + + /** + * Operation textInputCheckXssWithHttpInfo + * + * Check text input for Cross-Site-Scripting (XSS) attacks + * + * @param string $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\XssProtectionResult, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputCheckXssWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\XssProtectionResult'; + $request = $this->textInputCheckXssRequest($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\XssProtectionResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputCheckXssAsync + * + * Check text input for Cross-Site-Scripting (XSS) attacks + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXssAsync($value) + { + return $this->textInputCheckXssAsyncWithHttpInfo($value) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputCheckXssAsyncWithHttpInfo + * + * Check text input for Cross-Site-Scripting (XSS) attacks + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputCheckXssAsyncWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\XssProtectionResult'; + $request = $this->textInputCheckXssRequest($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 'textInputCheckXss' + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputCheckXssRequest($value) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling textInputCheckXss' + ); + } + + $resourcePath = '/validate/text-input/check/xss'; + $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'], + ['text/javascript', '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 + * + * Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + * + * @param string $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\XssProtectionResult + */ + public function textInputProtectXss($value) + { + list($response) = $this->textInputProtectXssWithHttpInfo($value); + return $response; + } + + /** + * Operation textInputProtectXssWithHttpInfo + * + * Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + * + * @param string $value User-facing text input. (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\XssProtectionResult, HTTP status code, HTTP response headers (array of strings) + */ + public function textInputProtectXssWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\XssProtectionResult'; + $request = $this->textInputProtectXssRequest($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\XssProtectionResult', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation textInputProtectXssAsync + * + * Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputProtectXssAsync($value) + { + return $this->textInputProtectXssAsyncWithHttpInfo($value) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation textInputProtectXssAsyncWithHttpInfo + * + * Protect text input from Cross-Site-Scripting (XSS) attacks through normalization + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function textInputProtectXssAsyncWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\XssProtectionResult'; + $request = $this->textInputProtectXssRequest($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 'textInputProtectXss' + * + * @param string $value User-facing text input. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function textInputProtectXssRequest($value) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling textInputProtectXss' + ); + } + + $resourcePath = '/validate/text-input/protect/xss'; + $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'], + ['text/javascript', '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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php index e60d473..514f61c 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -88,7 +88,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/1.6.5/php'; + protected $userAgent = 'Swagger-Codegen/1.6.6/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.6.5' . PHP_EOL; + $report .= ' SDK Package Version: 1.6.6' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/GeolocateStreetAddressResponse.php b/lib/Model/GeolocateStreetAddressResponse.php new file mode 100644 index 0000000..04416d6 --- /dev/null +++ b/lib/Model/GeolocateStreetAddressResponse.php @@ -0,0 +1,453 @@ + 'string', + 'country_name' => 'string', + 'street_address' => 'string', + 'city' => 'string', + 'region_name' => 'string', + 'zip_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'country_code' => null, + 'country_name' => null, + 'street_address' => null, + 'city' => null, + 'region_name' => null, + 'zip_code' => 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 = [ + 'country_code' => 'CountryCode', + 'country_name' => 'CountryName', + 'street_address' => 'StreetAddress', + 'city' => 'City', + 'region_name' => 'RegionName', + 'zip_code' => 'ZipCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country_code' => 'setCountryCode', + 'country_name' => 'setCountryName', + 'street_address' => 'setStreetAddress', + 'city' => 'setCity', + 'region_name' => 'setRegionName', + 'zip_code' => 'setZipCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country_code' => 'getCountryCode', + 'country_name' => 'getCountryName', + 'street_address' => 'getStreetAddress', + 'city' => 'getCity', + 'region_name' => 'getRegionName', + 'zip_code' => 'getZipCode' + ]; + + /** + * 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['country_code'] = isset($data['country_code']) ? $data['country_code'] : null; + $this->container['country_name'] = isset($data['country_name']) ? $data['country_name'] : null; + $this->container['street_address'] = isset($data['street_address']) ? $data['street_address'] : null; + $this->container['city'] = isset($data['city']) ? $data['city'] : null; + $this->container['region_name'] = isset($data['region_name']) ? $data['region_name'] : null; + $this->container['zip_code'] = isset($data['zip_code']) ? $data['zip_code'] : 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 country_code + * + * @return string + */ + public function getCountryCode() + { + return $this->container['country_code']; + } + + /** + * Sets country_code + * + * @param string $country_code Two-letter country code of IP address + * + * @return $this + */ + public function setCountryCode($country_code) + { + $this->container['country_code'] = $country_code; + + return $this; + } + + /** + * Gets country_name + * + * @return string + */ + public function getCountryName() + { + return $this->container['country_name']; + } + + /** + * Sets country_name + * + * @param string $country_name Country name of IP address + * + * @return $this + */ + public function setCountryName($country_name) + { + $this->container['country_name'] = $country_name; + + return $this; + } + + /** + * Gets street_address + * + * @return string + */ + public function getStreetAddress() + { + return $this->container['street_address']; + } + + /** + * Sets street_address + * + * @param string $street_address Street address of IP address + * + * @return $this + */ + public function setStreetAddress($street_address) + { + $this->container['street_address'] = $street_address; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city City of IP address + * + * @return $this + */ + public function setCity($city) + { + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets region_name + * + * @return string + */ + public function getRegionName() + { + return $this->container['region_name']; + } + + /** + * Sets region_name + * + * @param string $region_name State/region of IP address + * + * @return $this + */ + public function setRegionName($region_name) + { + $this->container['region_name'] = $region_name; + + return $this; + } + + /** + * Gets zip_code + * + * @return string + */ + public function getZipCode() + { + return $this->container['zip_code']; + } + + /** + * Sets zip_code + * + * @param string $zip_code Zip or postal code of IP address + * + * @return $this + */ + public function setZipCode($zip_code) + { + $this->container['zip_code'] = $zip_code; + + 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/XssProtectionResult.php b/lib/Model/XssProtectionResult.php new file mode 100644 index 0000000..99bf00b --- /dev/null +++ b/lib/Model/XssProtectionResult.php @@ -0,0 +1,393 @@ + 'bool', + 'contained_xss' => 'bool', + 'original_input' => 'string', + 'normalized_result' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'successful' => null, + 'contained_xss' => null, + 'original_input' => null, + 'normalized_result' => 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_xss' => 'ContainedXss', + 'original_input' => 'OriginalInput', + 'normalized_result' => 'NormalizedResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'successful' => 'setSuccessful', + 'contained_xss' => 'setContainedXss', + 'original_input' => 'setOriginalInput', + 'normalized_result' => 'setNormalizedResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'successful' => 'getSuccessful', + 'contained_xss' => 'getContainedXss', + 'original_input' => 'getOriginalInput', + 'normalized_result' => 'getNormalizedResult' + ]; + + /** + * 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_xss'] = isset($data['contained_xss']) ? $data['contained_xss'] : null; + $this->container['original_input'] = isset($data['original_input']) ? $data['original_input'] : null; + $this->container['normalized_result'] = isset($data['normalized_result']) ? $data['normalized_result'] : 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_xss + * + * @return bool + */ + public function getContainedXss() + { + return $this->container['contained_xss']; + } + + /** + * Sets contained_xss + * + * @param bool $contained_xss True if the input contained XSS scripting, false otherwise + * + * @return $this + */ + public function setContainedXss($contained_xss) + { + $this->container['contained_xss'] = $contained_xss; + + 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; + } + + /** + * Gets normalized_result + * + * @return string + */ + public function getNormalizedResult() + { + return $this->container['normalized_result']; + } + + /** + * Sets normalized_result + * + * @param string $normalized_result Normalized string result, with XSS removed + * + * @return $this + */ + public function setNormalizedResult($normalized_result) + { + $this->container['normalized_result'] = $normalized_result; + + 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 f3bcd84..11689aa 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,5 +1,5 @@ { - "artifactVersion": "1.6.5", + "artifactVersion": "1.6.6", "gitUserId": "Cloudmersive", "gitRepoId": "Cloudmersive.APIClient.PHP.Validate", "composerVendorName": "cloudmersive", diff --git a/test/Api/IPAddressApiTest.php b/test/Api/IPAddressApiTest.php index 4119bc6..accb42c 100644 --- a/test/Api/IPAddressApiTest.php +++ b/test/Api/IPAddressApiTest.php @@ -71,6 +71,16 @@ public static function tearDownAfterClass() { } + /** + * Test case for iPAddressGeolocateStreetAddress + * + * Geolocate an IP address to a street address. + * + */ + public function testIPAddressGeolocateStreetAddress() + { + } + /** * Test case for iPAddressIsThreat * diff --git a/test/Api/TextInputApiTest.php b/test/Api/TextInputApiTest.php new file mode 100644 index 0000000..cf0fa20 --- /dev/null +++ b/test/Api/TextInputApiTest.php @@ -0,0 +1,93 @@ +