From a4b958c1034f8136bd708b1a20065c123416e06f Mon Sep 17 00:00:00 2001 From: Cloudmersive <35204726+Cloudmersive@users.noreply.github.com> Date: Fri, 16 Apr 2021 22:55:00 -0700 Subject: [PATCH] 1.4.0 --- README.md | 4 +- composer.json | 2 +- docs/Api/DomainApi.md | 56 +++++ docs/Model/IsAdminPathResponse.md | 11 + lib/Api/DomainApi.php | 262 +++++++++++++++++++ lib/Configuration.php | 4 +- lib/Model/IsAdminPathResponse.php | 333 +++++++++++++++++++++++++ packageconfig.json | 2 +- test/Api/DomainApiTest.php | 10 + test/Model/IsAdminPathResponseTest.php | 93 +++++++ 10 files changed, 772 insertions(+), 5 deletions(-) create mode 100644 docs/Model/IsAdminPathResponse.md create mode 100644 lib/Model/IsAdminPathResponse.php create mode 100644 test/Model/IsAdminPathResponseTest.php diff --git a/README.md b/README.md index 8011e96..767f85d 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.5 +- Package version: 1.7.6 ## Requirements @@ -106,6 +106,7 @@ Class | Method | HTTP request | Description *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* | [**domainIsAdminPath**](docs/Api/DomainApi.md#domainisadminpath) | **POST** /validate/domain/url/is-admin-path | Check if path is a high-risk server administration path *DomainApi* | [**domainPhishingCheck**](docs/Api/DomainApi.md#domainphishingcheck) | **POST** /validate/domain/url/phishing-threat-check | Check a URL for Phishing threats *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 @@ -170,6 +171,7 @@ Class | Method | HTTP request | Description - [IPIntelligenceResponse](docs/Model/IPIntelligenceResponse.md) - [IPReverseDNSLookupResponse](docs/Model/IPReverseDNSLookupResponse.md) - [IPThreatResponse](docs/Model/IPThreatResponse.md) + - [IsAdminPathResponse](docs/Model/IsAdminPathResponse.md) - [LastNameValidationRequest](docs/Model/LastNameValidationRequest.md) - [LastNameValidationResponse](docs/Model/LastNameValidationResponse.md) - [LeadEnrichmentRequest](docs/Model/LeadEnrichmentRequest.md) diff --git a/composer.json b/composer.json index b62e190..366426b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "cloudmersive/cloudmersive_validate_api_client", - "version": "1.7.5", + "version": "1.7.6", "description": "", "keywords": [ "swagger", diff --git a/docs/Api/DomainApi.md b/docs/Api/DomainApi.md index 7f808d5..e3ca40d 100644 --- a/docs/Api/DomainApi.md +++ b/docs/Api/DomainApi.md @@ -6,6 +6,7 @@ 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 +[**domainIsAdminPath**](DomainApi.md#domainIsAdminPath) | **POST** /validate/domain/url/is-admin-path | Check if path is a high-risk server administration path [**domainPhishingCheck**](DomainApi.md#domainPhishingCheck) | **POST** /validate/domain/url/phishing-threat-check | Check a URL for Phishing threats [**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 @@ -126,6 +127,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) +# **domainIsAdminPath** +> \Swagger\Client\Model\IsAdminPathResponse domainIsAdminPath($value) + +Check if path is a high-risk server administration path + +Check if the input URL or relative path is a server Administration Path, and therefore a risk for remote access. + +### 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 +); +$value = "value_example"; // string | URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. + +try { + $result = $apiInstance->domainIsAdminPath($value); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DomainApi->domainIsAdminPath: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **value** | **string**| URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. | + +### Return type + +[**\Swagger\Client\Model\IsAdminPathResponse**](../Model/IsAdminPathResponse.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) + # **domainPhishingCheck** > \Swagger\Client\Model\PhishingCheckResponse domainPhishingCheck($request) diff --git a/docs/Model/IsAdminPathResponse.md b/docs/Model/IsAdminPathResponse.md new file mode 100644 index 0000000..8e087bd --- /dev/null +++ b/docs/Model/IsAdminPathResponse.md @@ -0,0 +1,11 @@ +# IsAdminPathResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is_admin_path_node** | **bool** | True if the input IP address is an Admin Path, and false otherwise | [optional] +**successful** | **bool** | True if the operation was successful, false otherwise | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lib/Api/DomainApi.php b/lib/Api/DomainApi.php index dc592c6..c614ef3 100644 --- a/lib/Api/DomainApi.php +++ b/lib/Api/DomainApi.php @@ -606,6 +606,268 @@ protected function domainGetTopLevelDomainFromUrlRequest($request) ); } + /** + * Operation domainIsAdminPath + * + * Check if path is a high-risk server administration path + * + * @param string $value URL or relative path to check, e.g. \"/admin/login\". 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\IsAdminPathResponse + */ + public function domainIsAdminPath($value) + { + list($response) = $this->domainIsAdminPathWithHttpInfo($value); + return $response; + } + + /** + * Operation domainIsAdminPathWithHttpInfo + * + * Check if path is a high-risk server administration path + * + * @param string $value URL or relative path to check, e.g. \"/admin/login\". 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\IsAdminPathResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function domainIsAdminPathWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\IsAdminPathResponse'; + $request = $this->domainIsAdminPathRequest($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\IsAdminPathResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation domainIsAdminPathAsync + * + * Check if path is a high-risk server administration path + * + * @param string $value URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainIsAdminPathAsync($value) + { + return $this->domainIsAdminPathAsyncWithHttpInfo($value) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation domainIsAdminPathAsyncWithHttpInfo + * + * Check if path is a high-risk server administration path + * + * @param string $value URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function domainIsAdminPathAsyncWithHttpInfo($value) + { + $returnType = '\Swagger\Client\Model\IsAdminPathResponse'; + $request = $this->domainIsAdminPathRequest($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 'domainIsAdminPath' + * + * @param string $value URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function domainIsAdminPathRequest($value) + { + // verify the required parameter 'value' is set + if ($value === null) { + throw new \InvalidArgumentException( + 'Missing the required parameter $value when calling domainIsAdminPath' + ); + } + + $resourcePath = '/validate/domain/url/is-admin-path'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($value)) { + $_tempBody = $value; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json', 'text/json', 'application/xml', 'text/xml'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json', 'text/json', 'application/xml', 'text/xml'], + ['application/json', 'text/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('Apikey'); + if ($apiKey !== null) { + $headers['Apikey'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation domainPhishingCheck * diff --git a/lib/Configuration.php b/lib/Configuration.php index 9aa203a..d67213b 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -88,7 +88,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/1.7.5/php'; + protected $userAgent = 'Swagger-Codegen/1.7.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.7.5' . PHP_EOL; + $report .= ' SDK Package Version: 1.7.6' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/IsAdminPathResponse.php b/lib/Model/IsAdminPathResponse.php new file mode 100644 index 0000000..8501f77 --- /dev/null +++ b/lib/Model/IsAdminPathResponse.php @@ -0,0 +1,333 @@ + 'bool', + 'successful' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $swaggerFormats = [ + 'is_admin_path_node' => null, + 'successful' => 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 = [ + 'is_admin_path_node' => 'IsAdminPathNode', + 'successful' => 'Successful' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is_admin_path_node' => 'setIsAdminPathNode', + 'successful' => 'setSuccessful' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is_admin_path_node' => 'getIsAdminPathNode', + 'successful' => 'getSuccessful' + ]; + + /** + * 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['is_admin_path_node'] = isset($data['is_admin_path_node']) ? $data['is_admin_path_node'] : null; + $this->container['successful'] = isset($data['successful']) ? $data['successful'] : 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 is_admin_path_node + * + * @return bool + */ + public function getIsAdminPathNode() + { + return $this->container['is_admin_path_node']; + } + + /** + * Sets is_admin_path_node + * + * @param bool $is_admin_path_node True if the input IP address is an Admin Path, and false otherwise + * + * @return $this + */ + public function setIsAdminPathNode($is_admin_path_node) + { + $this->container['is_admin_path_node'] = $is_admin_path_node; + + return $this; + } + + /** + * 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; + } + /** + * 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 b1e9b83..beeab1f 100644 --- a/packageconfig.json +++ b/packageconfig.json @@ -1,5 +1,5 @@ { - "artifactVersion": "1.7.5", + "artifactVersion": "1.7.6", "gitUserId": "Cloudmersive", "gitRepoId": "Cloudmersive.APIClient.PHP.Validate", "composerVendorName": "cloudmersive", diff --git a/test/Api/DomainApiTest.php b/test/Api/DomainApiTest.php index 1d21d3a..2b482d8 100644 --- a/test/Api/DomainApiTest.php +++ b/test/Api/DomainApiTest.php @@ -91,6 +91,16 @@ public function testDomainGetTopLevelDomainFromUrl() { } + /** + * Test case for domainIsAdminPath + * + * Check if path is a high-risk server administration path. + * + */ + public function testDomainIsAdminPath() + { + } + /** * Test case for domainPhishingCheck * diff --git a/test/Model/IsAdminPathResponseTest.php b/test/Model/IsAdminPathResponseTest.php new file mode 100644 index 0000000..f690d8c --- /dev/null +++ b/test/Model/IsAdminPathResponseTest.php @@ -0,0 +1,93 @@ +