diff --git a/README.md b/README.md index e2fb190..cf95375 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.0 +- Package version: 1.7.1 ## Requirements @@ -105,8 +105,11 @@ Class | Method | HTTP request | Description *DateTimeApi* | [**dateTimeParseNaturalLanguageDateTime**](docs/Api/DateTimeApi.md#datetimeparsenaturallanguagedatetime) | **POST** /validate/date-time/parse/date-time/natural-language | Parses a free-form natural language date and time string into a date and time *DateTimeApi* | [**dateTimeParseStandardDateTime**](docs/Api/DateTimeApi.md#datetimeparsestandarddatetime) | **POST** /validate/date-time/parse/date-time/structured | Parses a standardized date and time string into a date and time *DomainApi* | [**domainCheck**](docs/Api/DomainApi.md#domaincheck) | **POST** /validate/domain/check | Validate a domain name +*DomainApi* | [**domainGetTopLevelDomainFromUrl**](docs/Api/DomainApi.md#domaingettopleveldomainfromurl) | **POST** /validate/domain/url/get-top-level-domain | Get top-level domain name from URL *DomainApi* | [**domainPost**](docs/Api/DomainApi.md#domainpost) | **POST** /validate/domain/whois | Get WHOIS information for a domain *DomainApi* | [**domainQualityScore**](docs/Api/DomainApi.md#domainqualityscore) | **POST** /validate/domain/quality-score | Validate a domain name's quality score +*DomainApi* | [**domainSsrfCheck**](docs/Api/DomainApi.md#domainssrfcheck) | **POST** /validate/domain/url/ssrf-threat-check | Check a URL for SSRF threats +*DomainApi* | [**domainSsrfCheckBatch**](docs/Api/DomainApi.md#domainssrfcheckbatch) | **POST** /validate/domain/url/ssrf-threat-check/batch | Check a URL for SSRF threats in batches *DomainApi* | [**domainUrlFull**](docs/Api/DomainApi.md#domainurlfull) | **POST** /validate/domain/url/full | Validate a URL fully *DomainApi* | [**domainUrlSyntaxOnly**](docs/Api/DomainApi.md#domainurlsyntaxonly) | **POST** /validate/domain/url/syntax-only | Validate a URL syntactically *EmailApi* | [**emailAddressGetServers**](docs/Api/EmailApi.md#emailaddressgetservers) | **POST** /validate/email/address/servers | Partially check whether an email address is valid @@ -176,6 +179,10 @@ Class | Method | HTTP request | Description - [ReverseGeocodeAddressResponse](docs/Model/ReverseGeocodeAddressResponse.md) - [Timezone](docs/Model/Timezone.md) - [TorNodeResponse](docs/Model/TorNodeResponse.md) + - [UrlSsrfRequestBatch](docs/Model/UrlSsrfRequestBatch.md) + - [UrlSsrfRequestFull](docs/Model/UrlSsrfRequestFull.md) + - [UrlSsrfResponseBatch](docs/Model/UrlSsrfResponseBatch.md) + - [UrlSsrfResponseFull](docs/Model/UrlSsrfResponseFull.md) - [UserAgentValidateRequest](docs/Model/UserAgentValidateRequest.md) - [UserAgentValidateResponse](docs/Model/UserAgentValidateResponse.md) - [ValidateAddressRequest](docs/Model/ValidateAddressRequest.md) diff --git a/composer.json b/composer.json index a4ed7ac..3745c3b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "cloudmersive/cloudmersive_validate_api_client", - "version": "1.7.0", + "version": "1.7.1", "description": "", "keywords": [ "swagger", diff --git a/docs/Api/DomainApi.md b/docs/Api/DomainApi.md index 1afb07a..9a7577a 100644 --- a/docs/Api/DomainApi.md +++ b/docs/Api/DomainApi.md @@ -5,8 +5,11 @@ All URIs are relative to *https://api.cloudmersive.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**domainCheck**](DomainApi.md#domainCheck) | **POST** /validate/domain/check | Validate a domain name +[**domainGetTopLevelDomainFromUrl**](DomainApi.md#domainGetTopLevelDomainFromUrl) | **POST** /validate/domain/url/get-top-level-domain | Get top-level domain name from URL [**domainPost**](DomainApi.md#domainPost) | **POST** /validate/domain/whois | Get WHOIS information for a domain [**domainQualityScore**](DomainApi.md#domainQualityScore) | **POST** /validate/domain/quality-score | Validate a domain name's quality score +[**domainSsrfCheck**](DomainApi.md#domainSsrfCheck) | **POST** /validate/domain/url/ssrf-threat-check | Check a URL for SSRF threats +[**domainSsrfCheckBatch**](DomainApi.md#domainSsrfCheckBatch) | **POST** /validate/domain/url/ssrf-threat-check/batch | Check a URL for SSRF threats in batches [**domainUrlFull**](DomainApi.md#domainUrlFull) | **POST** /validate/domain/url/full | Validate a URL fully [**domainUrlSyntaxOnly**](DomainApi.md#domainUrlSyntaxOnly) | **POST** /validate/domain/url/syntax-only | Validate a URL syntactically @@ -66,6 +69,61 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +# **domainGetTopLevelDomainFromUrl** +> \Swagger\Client\Model\ValidateUrlResponseSyntaxOnly domainGetTopLevelDomainFromUrl($request) + +Get top-level domain name from URL + +Gets the top-level domain name from a URL, such as mydomain.com. + +### 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\DomainApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$request = new \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly(); // \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly | Input URL information + +try { + $result = $apiInstance->domainGetTopLevelDomainFromUrl($request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainApi->domainGetTopLevelDomainFromUrl: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request** | [**\Swagger\Client\Model\ValidateUrlRequestSyntaxOnly**](../Model/ValidateUrlRequestSyntaxOnly.md)| Input URL information | + +### Return type + +[**\Swagger\Client\Model\ValidateUrlResponseSyntaxOnly**](../Model/ValidateUrlResponseSyntaxOnly.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) + # **domainPost** > \Swagger\Client\Model\WhoisResponse domainPost($domain) @@ -176,6 +234,116 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +# **domainSsrfCheck** +> \Swagger\Client\Model\UrlSsrfResponseFull domainSsrfCheck($request) + +Check a URL for SSRF threats + +Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack. + +### 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\DomainApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$request = new \Swagger\Client\Model\UrlSsrfRequestFull(); // \Swagger\Client\Model\UrlSsrfRequestFull | Input URL request + +try { + $result = $apiInstance->domainSsrfCheck($request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainApi->domainSsrfCheck: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request** | [**\Swagger\Client\Model\UrlSsrfRequestFull**](../Model/UrlSsrfRequestFull.md)| Input URL request | + +### Return type + +[**\Swagger\Client\Model\UrlSsrfResponseFull**](../Model/UrlSsrfResponseFull.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) + +# **domainSsrfCheckBatch** +> \Swagger\Client\Model\UrlSsrfResponseBatch domainSsrfCheckBatch($request) + +Check a URL for SSRF threats in batches + +Batch-checks if input URLs are at risk of being an SSRF (Server-side request forgery) threat or attack. + +### 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\DomainApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$request = new \Swagger\Client\Model\UrlSsrfRequestBatch(); // \Swagger\Client\Model\UrlSsrfRequestBatch | Input URL request as a batch of multiple URLs + +try { + $result = $apiInstance->domainSsrfCheckBatch($request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainApi->domainSsrfCheckBatch: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request** | [**\Swagger\Client\Model\UrlSsrfRequestBatch**](../Model/UrlSsrfRequestBatch.md)| Input URL request as a batch of multiple URLs | + +### Return type + +[**\Swagger\Client\Model\UrlSsrfResponseBatch**](../Model/UrlSsrfResponseBatch.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) + # **domainUrlFull** > \Swagger\Client\Model\ValidateUrlResponseFull domainUrlFull($request) diff --git a/docs/Model/UrlSsrfRequestBatch.md b/docs/Model/UrlSsrfRequestBatch.md new file mode 100644 index 0000000..febe607 --- /dev/null +++ b/docs/Model/UrlSsrfRequestBatch.md @@ -0,0 +1,10 @@ +# UrlSsrfRequestBatch + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**input_items** | [**\Swagger\Client\Model\UrlSsrfRequestFull[]**](UrlSsrfRequestFull.md) | Input URLs to check for SSRF threats | [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/UrlSsrfRequestFull.md b/docs/Model/UrlSsrfRequestFull.md new file mode 100644 index 0000000..b92eb31 --- /dev/null +++ b/docs/Model/UrlSsrfRequestFull.md @@ -0,0 +1,11 @@ +# UrlSsrfRequestFull + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **string** | URL to validate | [optional] +**blocked_domains** | **string[]** | Top level domains that you do not want to allow access to, e.g. mydomain.com - will block all subdomains as well | [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/UrlSsrfResponseBatch.md b/docs/Model/UrlSsrfResponseBatch.md new file mode 100644 index 0000000..1e93386 --- /dev/null +++ b/docs/Model/UrlSsrfResponseBatch.md @@ -0,0 +1,10 @@ +# UrlSsrfResponseBatch + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**output_items** | [**\Swagger\Client\Model\UrlSsrfResponseFull[]**](UrlSsrfResponseFull.md) | Results of the operation, with indexes matched to input values | [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/UrlSsrfResponseFull.md b/docs/Model/UrlSsrfResponseFull.md new file mode 100644 index 0000000..bda1269 --- /dev/null +++ b/docs/Model/UrlSsrfResponseFull.md @@ -0,0 +1,11 @@ +# UrlSsrfResponseFull + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clean_url** | **bool** | True if the URL is clean, false if it is at risk of containing an SSRF threat or attack | [optional] +**threat_level** | **string** | Threat level of the URL; possible values are High, Medium, Low and None | [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/ValidateUrlResponseSyntaxOnly.md b/docs/Model/ValidateUrlResponseSyntaxOnly.md index e8694d0..ca98fc0 100644 --- a/docs/Model/ValidateUrlResponseSyntaxOnly.md +++ b/docs/Model/ValidateUrlResponseSyntaxOnly.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **valid_url** | **bool** | True if the URL is valid, false otherwise | [optional] **well_formed_url** | **string** | Well-formed version of the URL | [optional] +**top_level_domain_name** | **string** | The top-level domain name of the URL, e.g. mydomain.com | [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/DomainApi.php b/lib/Api/DomainApi.php index 6004c38..f24441c 100644 --- a/lib/Api/DomainApi.php +++ b/lib/Api/DomainApi.php @@ -344,6 +344,268 @@ protected function domainCheckRequest($domain) ); } + /** + * Operation domainGetTopLevelDomainFromUrl + * + * Get top-level domain name from URL + * + * @param \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly $request Input URL information (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\ValidateUrlResponseSyntaxOnly + */ + public function domainGetTopLevelDomainFromUrl($request) + { + list($response) = $this->domainGetTopLevelDomainFromUrlWithHttpInfo($request); + return $response; + } + + /** + * Operation domainGetTopLevelDomainFromUrlWithHttpInfo + * + * Get top-level domain name from URL + * + * @param \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly $request Input URL information (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\ValidateUrlResponseSyntaxOnly, HTTP status code, HTTP response headers (array of strings) + */ + public function domainGetTopLevelDomainFromUrlWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\ValidateUrlResponseSyntaxOnly'; + $request = $this->domainGetTopLevelDomainFromUrlRequest($request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ValidateUrlResponseSyntaxOnly', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation domainGetTopLevelDomainFromUrlAsync + * + * Get top-level domain name from URL + * + * @param \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly $request Input URL information (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainGetTopLevelDomainFromUrlAsync($request) + { + return $this->domainGetTopLevelDomainFromUrlAsyncWithHttpInfo($request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation domainGetTopLevelDomainFromUrlAsyncWithHttpInfo + * + * Get top-level domain name from URL + * + * @param \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly $request Input URL information (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainGetTopLevelDomainFromUrlAsyncWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\ValidateUrlResponseSyntaxOnly'; + $request = $this->domainGetTopLevelDomainFromUrlRequest($request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'domainGetTopLevelDomainFromUrl' + * + * @param \Swagger\Client\Model\ValidateUrlRequestSyntaxOnly $request Input URL information (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function domainGetTopLevelDomainFromUrlRequest($request) + { + // verify the required parameter 'request' is set + if ($request === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling domainGetTopLevelDomainFromUrl' + ); + } + + $resourcePath = '/validate/domain/url/get-top-level-domain'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($request)) { + $_tempBody = $request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation domainPost * @@ -868,6 +1130,530 @@ protected function domainQualityScoreRequest($domain) ); } + /** + * Operation domainSsrfCheck + * + * Check a URL for SSRF threats + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull $request Input URL request (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\UrlSsrfResponseFull + */ + public function domainSsrfCheck($request) + { + list($response) = $this->domainSsrfCheckWithHttpInfo($request); + return $response; + } + + /** + * Operation domainSsrfCheckWithHttpInfo + * + * Check a URL for SSRF threats + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull $request Input URL request (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\UrlSsrfResponseFull, HTTP status code, HTTP response headers (array of strings) + */ + public function domainSsrfCheckWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\UrlSsrfResponseFull'; + $request = $this->domainSsrfCheckRequest($request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\UrlSsrfResponseFull', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation domainSsrfCheckAsync + * + * Check a URL for SSRF threats + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull $request Input URL request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainSsrfCheckAsync($request) + { + return $this->domainSsrfCheckAsyncWithHttpInfo($request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation domainSsrfCheckAsyncWithHttpInfo + * + * Check a URL for SSRF threats + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull $request Input URL request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainSsrfCheckAsyncWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\UrlSsrfResponseFull'; + $request = $this->domainSsrfCheckRequest($request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'domainSsrfCheck' + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull $request Input URL request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function domainSsrfCheckRequest($request) + { + // verify the required parameter 'request' is set + if ($request === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling domainSsrfCheck' + ); + } + + $resourcePath = '/validate/domain/url/ssrf-threat-check'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($request)) { + $_tempBody = $request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation domainSsrfCheckBatch + * + * Check a URL for SSRF threats in batches + * + * @param \Swagger\Client\Model\UrlSsrfRequestBatch $request Input URL request as a batch of multiple URLs (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\UrlSsrfResponseBatch + */ + public function domainSsrfCheckBatch($request) + { + list($response) = $this->domainSsrfCheckBatchWithHttpInfo($request); + return $response; + } + + /** + * Operation domainSsrfCheckBatchWithHttpInfo + * + * Check a URL for SSRF threats in batches + * + * @param \Swagger\Client\Model\UrlSsrfRequestBatch $request Input URL request as a batch of multiple URLs (required) + * + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\UrlSsrfResponseBatch, HTTP status code, HTTP response headers (array of strings) + */ + public function domainSsrfCheckBatchWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\UrlSsrfResponseBatch'; + $request = $this->domainSsrfCheckBatchRequest($request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\UrlSsrfResponseBatch', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation domainSsrfCheckBatchAsync + * + * Check a URL for SSRF threats in batches + * + * @param \Swagger\Client\Model\UrlSsrfRequestBatch $request Input URL request as a batch of multiple URLs (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainSsrfCheckBatchAsync($request) + { + return $this->domainSsrfCheckBatchAsyncWithHttpInfo($request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation domainSsrfCheckBatchAsyncWithHttpInfo + * + * Check a URL for SSRF threats in batches + * + * @param \Swagger\Client\Model\UrlSsrfRequestBatch $request Input URL request as a batch of multiple URLs (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainSsrfCheckBatchAsyncWithHttpInfo($request) + { + $returnType = '\Swagger\Client\Model\UrlSsrfResponseBatch'; + $request = $this->domainSsrfCheckBatchRequest($request); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'domainSsrfCheckBatch' + * + * @param \Swagger\Client\Model\UrlSsrfRequestBatch $request Input URL request as a batch of multiple URLs (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function domainSsrfCheckBatchRequest($request) + { + // verify the required parameter 'request' is set + if ($request === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request when calling domainSsrfCheckBatch' + ); + } + + $resourcePath = '/validate/domain/url/ssrf-threat-check/batch'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($request)) { + $_tempBody = $request; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation domainUrlFull * diff --git a/lib/Configuration.php b/lib/Configuration.php index 5f558ca..f7165de 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -88,7 +88,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/1.7.0/php'; + protected $userAgent = 'Swagger-Codegen/1.7.1/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.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.7.1' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/UrlSsrfRequestBatch.php b/lib/Model/UrlSsrfRequestBatch.php new file mode 100644 index 0000000..cd1d97e --- /dev/null +++ b/lib/Model/UrlSsrfRequestBatch.php @@ -0,0 +1,303 @@ + '\Swagger\Client\Model\UrlSsrfRequestFull[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'input_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 = [ + 'input_items' => 'InputItems' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'input_items' => 'setInputItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'input_items' => 'getInputItems' + ]; + + /** + * 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_items'] = isset($data['input_items']) ? $data['input_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 input_items + * + * @return \Swagger\Client\Model\UrlSsrfRequestFull[] + */ + public function getInputItems() + { + return $this->container['input_items']; + } + + /** + * Sets input_items + * + * @param \Swagger\Client\Model\UrlSsrfRequestFull[] $input_items Input URLs to check for SSRF threats + * + * @return $this + */ + public function setInputItems($input_items) + { + $this->container['input_items'] = $input_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/UrlSsrfRequestFull.php b/lib/Model/UrlSsrfRequestFull.php new file mode 100644 index 0000000..3bf90fd --- /dev/null +++ b/lib/Model/UrlSsrfRequestFull.php @@ -0,0 +1,333 @@ + 'string', + 'blocked_domains' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'url' => null, + 'blocked_domains' => 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 = [ + 'url' => 'URL', + 'blocked_domains' => 'BlockedDomains' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'url' => 'setUrl', + 'blocked_domains' => 'setBlockedDomains' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'url' => 'getUrl', + 'blocked_domains' => 'getBlockedDomains' + ]; + + /** + * 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['url'] = isset($data['url']) ? $data['url'] : null; + $this->container['blocked_domains'] = isset($data['blocked_domains']) ? $data['blocked_domains'] : 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 url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url URL to validate + * + * @return $this + */ + public function setUrl($url) + { + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets blocked_domains + * + * @return string[] + */ + public function getBlockedDomains() + { + return $this->container['blocked_domains']; + } + + /** + * Sets blocked_domains + * + * @param string[] $blocked_domains Top level domains that you do not want to allow access to, e.g. mydomain.com - will block all subdomains as well + * + * @return $this + */ + public function setBlockedDomains($blocked_domains) + { + $this->container['blocked_domains'] = $blocked_domains; + + 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/UrlSsrfResponseBatch.php b/lib/Model/UrlSsrfResponseBatch.php new file mode 100644 index 0000000..f82d7c6 --- /dev/null +++ b/lib/Model/UrlSsrfResponseBatch.php @@ -0,0 +1,303 @@ + '\Swagger\Client\Model\UrlSsrfResponseFull[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'output_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 = [ + 'output_items' => 'OutputItems' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'output_items' => 'setOutputItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'output_items' => 'getOutputItems' + ]; + + /** + * 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['output_items'] = isset($data['output_items']) ? $data['output_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 output_items + * + * @return \Swagger\Client\Model\UrlSsrfResponseFull[] + */ + public function getOutputItems() + { + return $this->container['output_items']; + } + + /** + * Sets output_items + * + * @param \Swagger\Client\Model\UrlSsrfResponseFull[] $output_items Results of the operation, with indexes matched to input values + * + * @return $this + */ + public function setOutputItems($output_items) + { + $this->container['output_items'] = $output_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/UrlSsrfResponseFull.php b/lib/Model/UrlSsrfResponseFull.php new file mode 100644 index 0000000..0e79b9c --- /dev/null +++ b/lib/Model/UrlSsrfResponseFull.php @@ -0,0 +1,333 @@ + 'bool', + 'threat_level' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'clean_url' => null, + 'threat_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 = [ + 'clean_url' => 'CleanURL', + 'threat_level' => 'ThreatLevel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'clean_url' => 'setCleanUrl', + 'threat_level' => 'setThreatLevel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'clean_url' => 'getCleanUrl', + 'threat_level' => 'getThreatLevel' + ]; + + /** + * 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['clean_url'] = isset($data['clean_url']) ? $data['clean_url'] : null; + $this->container['threat_level'] = isset($data['threat_level']) ? $data['threat_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 clean_url + * + * @return bool + */ + public function getCleanUrl() + { + return $this->container['clean_url']; + } + + /** + * Sets clean_url + * + * @param bool $clean_url True if the URL is clean, false if it is at risk of containing an SSRF threat or attack + * + * @return $this + */ + public function setCleanUrl($clean_url) + { + $this->container['clean_url'] = $clean_url; + + return $this; + } + + /** + * Gets threat_level + * + * @return string + */ + public function getThreatLevel() + { + return $this->container['threat_level']; + } + + /** + * Sets threat_level + * + * @param string $threat_level Threat level of the URL; possible values are High, Medium, Low and None + * + * @return $this + */ + public function setThreatLevel($threat_level) + { + $this->container['threat_level'] = $threat_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/ValidateUrlResponseSyntaxOnly.php b/lib/Model/ValidateUrlResponseSyntaxOnly.php index 6facaf1..386563a 100644 --- a/lib/Model/ValidateUrlResponseSyntaxOnly.php +++ b/lib/Model/ValidateUrlResponseSyntaxOnly.php @@ -59,7 +59,8 @@ class ValidateUrlResponseSyntaxOnly implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'valid_url' => 'bool', - 'well_formed_url' => 'string' + 'well_formed_url' => 'string', + 'top_level_domain_name' => 'string' ]; /** @@ -69,7 +70,8 @@ class ValidateUrlResponseSyntaxOnly implements ModelInterface, ArrayAccess */ protected static $swaggerFormats = [ 'valid_url' => null, - 'well_formed_url' => null + 'well_formed_url' => null, + 'top_level_domain_name' => null ]; /** @@ -100,7 +102,8 @@ public static function swaggerFormats() */ protected static $attributeMap = [ 'valid_url' => 'ValidURL', - 'well_formed_url' => 'WellFormedURL' + 'well_formed_url' => 'WellFormedURL', + 'top_level_domain_name' => 'TopLevelDomainName' ]; /** @@ -110,7 +113,8 @@ public static function swaggerFormats() */ protected static $setters = [ 'valid_url' => 'setValidUrl', - 'well_formed_url' => 'setWellFormedUrl' + 'well_formed_url' => 'setWellFormedUrl', + 'top_level_domain_name' => 'setTopLevelDomainName' ]; /** @@ -120,7 +124,8 @@ public static function swaggerFormats() */ protected static $getters = [ 'valid_url' => 'getValidUrl', - 'well_formed_url' => 'getWellFormedUrl' + 'well_formed_url' => 'getWellFormedUrl', + 'top_level_domain_name' => 'getTopLevelDomainName' ]; /** @@ -185,6 +190,7 @@ public function __construct(array $data = null) { $this->container['valid_url'] = isset($data['valid_url']) ? $data['valid_url'] : null; $this->container['well_formed_url'] = isset($data['well_formed_url']) ? $data['well_formed_url'] : null; + $this->container['top_level_domain_name'] = isset($data['top_level_domain_name']) ? $data['top_level_domain_name'] : null; } /** @@ -259,6 +265,30 @@ public function setWellFormedUrl($well_formed_url) return $this; } + + /** + * Gets top_level_domain_name + * + * @return string + */ + public function getTopLevelDomainName() + { + return $this->container['top_level_domain_name']; + } + + /** + * Sets top_level_domain_name + * + * @param string $top_level_domain_name The top-level domain name of the URL, e.g. mydomain.com + * + * @return $this + */ + public function setTopLevelDomainName($top_level_domain_name) + { + $this->container['top_level_domain_name'] = $top_level_domain_name; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/packageconfig.json b/packageconfig.json index f24660c..a728d37 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,5 +1,5 @@ { - "artifactVersion": "1.7.0", + "artifactVersion": "1.7.1", "gitUserId": "Cloudmersive", "gitRepoId": "Cloudmersive.APIClient.PHP.Validate", "composerVendorName": "cloudmersive", diff --git a/test/Api/DomainApiTest.php b/test/Api/DomainApiTest.php index 86e6d96..2ced777 100644 --- a/test/Api/DomainApiTest.php +++ b/test/Api/DomainApiTest.php @@ -81,6 +81,16 @@ public function testDomainCheck() { } + /** + * Test case for domainGetTopLevelDomainFromUrl + * + * Get top-level domain name from URL. + * + */ + public function testDomainGetTopLevelDomainFromUrl() + { + } + /** * Test case for domainPost * @@ -101,6 +111,26 @@ public function testDomainQualityScore() { } + /** + * Test case for domainSsrfCheck + * + * Check a URL for SSRF threats. + * + */ + public function testDomainSsrfCheck() + { + } + + /** + * Test case for domainSsrfCheckBatch + * + * Check a URL for SSRF threats in batches. + * + */ + public function testDomainSsrfCheckBatch() + { + } + /** * Test case for domainUrlFull * diff --git a/test/Model/UrlSsrfRequestBatchTest.php b/test/Model/UrlSsrfRequestBatchTest.php new file mode 100644 index 0000000..fb083a8 --- /dev/null +++ b/test/Model/UrlSsrfRequestBatchTest.php @@ -0,0 +1,86 @@ +