diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ff..65f558e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "2.0.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5bb2078..f52f430 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-021b48afe1d6e3f54c4ebe3d0da4beb3fb8b69a6d384a4aeadbc5bab7f967603.yml -openapi_spec_hash: 2aa5b59d78c708b094acf29cc0d9a68a -config_hash: c7b0cdaba3b9797b77efd89e1754d803 +configured_endpoints: 29 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7dbd739a81e6aaf7fc7ef1858606e7d572d309af55082a66431d9292e655e66f.yml +openapi_spec_hash: a6374d5d718a7bd9d3d54fb657e2bd9d +config_hash: ff35e224e809656528c44163aa41bebd diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0ab2d..8122751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 2.0.0 (2026-07-06) + +Full Changelog: [v1.3.0...v2.0.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.3.0...v2.0.0) + +### Features + +* **api:** api update ([a109b94](https://github.com/context-dot-dev/context-php-sdk/commit/a109b94c372f554a6f9d6c669dd01fc3afe37c85)) +* **api:** api update ([fc46359](https://github.com/context-dot-dev/context-php-sdk/commit/fc4635910c2035f4edffb817e4a7259b82e1c39c)) +* **api:** api update ([b6570c0](https://github.com/context-dot-dev/context-php-sdk/commit/b6570c0cad69d665d2cce99f57c2b85fb6ff408e)) +* **api:** api update ([61d8ed4](https://github.com/context-dot-dev/context-php-sdk/commit/61d8ed4cb6be1d1c2caad265f97987b5e93f620d)) +* **api:** api update ([16b3c1e](https://github.com/context-dot-dev/context-php-sdk/commit/16b3c1efb31c9d1da12ab3a2a5e65f4bfcd74247)) +* **api:** api update ([b96c262](https://github.com/context-dot-dev/context-php-sdk/commit/b96c26218eb833e9227dee9551ee9eb2b94b9abd)) +* **api:** api update ([4589097](https://github.com/context-dot-dev/context-php-sdk/commit/45890973be2637f7e69fb82cc5b5e52840420ca1)) +* **api:** api update ([b635a05](https://github.com/context-dot-dev/context-php-sdk/commit/b635a0588edc056550fbf1ddce2a239f4b4b29b2)) +* **api:** api update ([f7a3ee5](https://github.com/context-dot-dev/context-php-sdk/commit/f7a3ee5f797c5bd286293a69db0b50cd402d56fe)) +* **api:** manual updates ([33c37e5](https://github.com/context-dot-dev/context-php-sdk/commit/33c37e56e87ef187161361879db3cc25c12e663e)) +* **api:** manual updates ([d3c55dc](https://github.com/context-dot-dev/context-php-sdk/commit/d3c55dc909d9431595788c4e140a608e7cea5c5d)) +* **api:** manual updates ([d1b85dd](https://github.com/context-dot-dev/context-php-sdk/commit/d1b85ddef694ea143f27b352a9bca54f77b07512)) + ## 1.3.0 (2026-06-27) Full Changelog: [v1.2.0...v1.3.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.2.0...v1.3.0) diff --git a/README.md b/README.md index bf4e14c..817bc6b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 1.3.0" +composer require "context-dev/context-dev-php 2.0.0" ``` @@ -30,7 +30,7 @@ use ContextDev\Client; $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); -$brand = $client->brand->retrieve(domain: 'REPLACE_ME'); +$brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); var_dump($brand->brand); ``` @@ -54,7 +54,7 @@ use ContextDev\Core\Exceptions\RateLimitException; use ContextDev\Core\Exceptions\APIStatusException; try { - $brand = $client->brand->retrieve(domain: 'REPLACE_ME'); + $brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); @@ -100,7 +100,7 @@ $client = new Client(requestOptions: ['maxRetries' => 0]); // Or, configure per-request: $result = $client->brand->retrieve( - domain: 'REPLACE_ME', requestOptions: ['maxRetries' => 5] + domain: 'REPLACE_ME', type: 'by_domain', requestOptions: ['maxRetries' => 5] ); ``` @@ -119,6 +119,7 @@ Note: the `extra*` parameters of the same name overrides the documented paramete $brand = $client->brand->retrieve( domain: 'REPLACE_ME', + type: 'by_domain', requestOptions: [ 'extraQueryParams' => ['my_query_parameter' => 'value'], 'extraBodyParams' => ['my_body_parameter' => 'value'], diff --git a/src/AI/AIAIQueryParams.php b/src/AI/AIAIQueryParams.php deleted file mode 100644 index 16a3684..0000000 --- a/src/AI/AIAIQueryParams.php +++ /dev/null @@ -1,153 +0,0 @@ -, - * domain: string, - * specificPages?: null|SpecificPages|SpecificPagesShape, - * timeoutMs?: int|null, - * } - */ -final class AIAIQueryParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Array of data points to extract from the website. - * - * @var list $dataToExtract - */ - #[Required('data_to_extract', list: DataToExtract::class)] - public array $dataToExtract; - - /** - * The domain name to analyze. - */ - #[Required] - public string $domain; - - /** - * Optional object specifying which pages to analyze. - */ - #[Optional('specific_pages')] - public ?SpecificPages $specificPages; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional('timeoutMS')] - public ?int $timeoutMs; - - /** - * `new AIAIQueryParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * AIAIQueryParams::with(dataToExtract: ..., domain: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new AIAIQueryParams)->withDataToExtract(...)->withDomain(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list $dataToExtract - * @param SpecificPages|SpecificPagesShape|null $specificPages - */ - public static function with( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['dataToExtract'] = $dataToExtract; - $self['domain'] = $domain; - - null !== $specificPages && $self['specificPages'] = $specificPages; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Array of data points to extract from the website. - * - * @param list $dataToExtract - */ - public function withDataToExtract(array $dataToExtract): self - { - $self = clone $this; - $self['dataToExtract'] = $dataToExtract; - - return $self; - } - - /** - * The domain name to analyze. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Optional object specifying which pages to analyze. - * - * @param SpecificPages|SpecificPagesShape $specificPages - */ - public function withSpecificPages(SpecificPages|array $specificPages): self - { - $self = clone $this; - $self['specificPages'] = $specificPages; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/AI/AIAIQueryParams/DataToExtract.php b/src/AI/AIAIQueryParams/DataToExtract.php deleted file mode 100644 index 1678796..0000000 --- a/src/AI/AIAIQueryParams/DataToExtract.php +++ /dev/null @@ -1,203 +0,0 @@ -, - * datapointListType?: null|DatapointListType|value-of, - * datapointObjectSchema?: array>|null, - * } - */ -final class DataToExtract implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Description of what to extract. - */ - #[Required('datapoint_description')] - public string $datapointDescription; - - /** - * Example of the expected value. - */ - #[Required('datapoint_example')] - public string $datapointExample; - - /** - * Name of the data point to extract. - */ - #[Required('datapoint_name')] - public string $datapointName; - - /** - * Type of the data point. - * - * @var value-of $datapointType - */ - #[Required('datapoint_type', enum: DatapointType::class)] - public string $datapointType; - - /** - * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. - * - * @var value-of|null $datapointListType - */ - #[Optional('datapoint_list_type', enum: DatapointListType::class)] - public ?string $datapointListType; - - /** - * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. - * - * @var array>|null $datapointObjectSchema - */ - #[Optional('datapoint_object_schema', map: DatapointObjectSchema::class)] - public ?array $datapointObjectSchema; - - /** - * `new DataToExtract()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * DataToExtract::with( - * datapointDescription: ..., - * datapointExample: ..., - * datapointName: ..., - * datapointType: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new DataToExtract) - * ->withDatapointDescription(...) - * ->withDatapointExample(...) - * ->withDatapointName(...) - * ->withDatapointType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param DatapointType|value-of $datapointType - * @param DatapointListType|value-of|null $datapointListType - * @param array>|null $datapointObjectSchema - */ - public static function with( - string $datapointDescription, - string $datapointExample, - string $datapointName, - DatapointType|string $datapointType, - DatapointListType|string|null $datapointListType = null, - ?array $datapointObjectSchema = null, - ): self { - $self = new self; - - $self['datapointDescription'] = $datapointDescription; - $self['datapointExample'] = $datapointExample; - $self['datapointName'] = $datapointName; - $self['datapointType'] = $datapointType; - - null !== $datapointListType && $self['datapointListType'] = $datapointListType; - null !== $datapointObjectSchema && $self['datapointObjectSchema'] = $datapointObjectSchema; - - return $self; - } - - /** - * Description of what to extract. - */ - public function withDatapointDescription(string $datapointDescription): self - { - $self = clone $this; - $self['datapointDescription'] = $datapointDescription; - - return $self; - } - - /** - * Example of the expected value. - */ - public function withDatapointExample(string $datapointExample): self - { - $self = clone $this; - $self['datapointExample'] = $datapointExample; - - return $self; - } - - /** - * Name of the data point to extract. - */ - public function withDatapointName(string $datapointName): self - { - $self = clone $this; - $self['datapointName'] = $datapointName; - - return $self; - } - - /** - * Type of the data point. - * - * @param DatapointType|value-of $datapointType - */ - public function withDatapointType(DatapointType|string $datapointType): self - { - $self = clone $this; - $self['datapointType'] = $datapointType; - - return $self; - } - - /** - * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. - * - * @param DatapointListType|value-of $datapointListType - */ - public function withDatapointListType( - DatapointListType|string $datapointListType - ): self { - $self = clone $this; - $self['datapointListType'] = $datapointListType; - - return $self; - } - - /** - * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. - * - * @param array> $datapointObjectSchema - */ - public function withDatapointObjectSchema( - array $datapointObjectSchema - ): self { - $self = clone $this; - $self['datapointObjectSchema'] = $datapointObjectSchema; - - return $self; - } -} diff --git a/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php b/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php deleted file mode 100644 index 940605f..0000000 --- a/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php +++ /dev/null @@ -1,27 +0,0 @@ - */ - use SdkModel; - - /** - * Whether to analyze the about us page. - */ - #[Optional('about_us')] - public ?bool $aboutUs; - - /** - * Whether to analyze the blog. - */ - #[Optional] - public ?bool $blog; - - /** - * Whether to analyze the careers page. - */ - #[Optional] - public ?bool $careers; - - /** - * Whether to analyze the contact us page. - */ - #[Optional('contact_us')] - public ?bool $contactUs; - - /** - * Whether to analyze the FAQ page. - */ - #[Optional] - public ?bool $faq; - - /** - * Whether to analyze the home page. - */ - #[Optional('home_page')] - public ?bool $homePage; - - /** - * Whether to analyze the pricing page. - */ - #[Optional] - public ?bool $pricing; - - /** - * Whether to analyze the privacy policy page. - */ - #[Optional('privacy_policy')] - public ?bool $privacyPolicy; - - /** - * Whether to analyze the terms and conditions page. - */ - #[Optional('terms_and_conditions')] - public ?bool $termsAndConditions; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?bool $aboutUs = null, - ?bool $blog = null, - ?bool $careers = null, - ?bool $contactUs = null, - ?bool $faq = null, - ?bool $homePage = null, - ?bool $pricing = null, - ?bool $privacyPolicy = null, - ?bool $termsAndConditions = null, - ): self { - $self = new self; - - null !== $aboutUs && $self['aboutUs'] = $aboutUs; - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contactUs && $self['contactUs'] = $contactUs; - null !== $faq && $self['faq'] = $faq; - null !== $homePage && $self['homePage'] = $homePage; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacyPolicy && $self['privacyPolicy'] = $privacyPolicy; - null !== $termsAndConditions && $self['termsAndConditions'] = $termsAndConditions; - - return $self; - } - - /** - * Whether to analyze the about us page. - */ - public function withAboutUs(bool $aboutUs): self - { - $self = clone $this; - $self['aboutUs'] = $aboutUs; - - return $self; - } - - /** - * Whether to analyze the blog. - */ - public function withBlog(bool $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * Whether to analyze the careers page. - */ - public function withCareers(bool $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * Whether to analyze the contact us page. - */ - public function withContactUs(bool $contactUs): self - { - $self = clone $this; - $self['contactUs'] = $contactUs; - - return $self; - } - - /** - * Whether to analyze the FAQ page. - */ - public function withFaq(bool $faq): self - { - $self = clone $this; - $self['faq'] = $faq; - - return $self; - } - - /** - * Whether to analyze the home page. - */ - public function withHomePage(bool $homePage): self - { - $self = clone $this; - $self['homePage'] = $homePage; - - return $self; - } - - /** - * Whether to analyze the pricing page. - */ - public function withPricing(bool $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * Whether to analyze the privacy policy page. - */ - public function withPrivacyPolicy(bool $privacyPolicy): self - { - $self = clone $this; - $self['privacyPolicy'] = $privacyPolicy; - - return $self; - } - - /** - * Whether to analyze the terms and conditions page. - */ - public function withTermsAndConditions(bool $termsAndConditions): self - { - $self = clone $this; - $self['termsAndConditions'] = $termsAndConditions; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse.php b/src/AI/AIAIQueryResponse.php deleted file mode 100644 index 0ef34b1..0000000 --- a/src/AI/AIAIQueryResponse.php +++ /dev/null @@ -1,156 +0,0 @@ -|null, - * domain?: string|null, - * keyMetadata?: null|KeyMetadata|KeyMetadataShape, - * status?: string|null, - * urlsAnalyzed?: list|null, - * } - */ -final class AIAIQueryResponse implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of extracted data points. - * - * @var list|null $dataExtracted - */ - #[Optional('data_extracted', list: DataExtracted::class)] - public ?array $dataExtracted; - - /** - * The domain that was analyzed. - */ - #[Optional] - public ?string $domain; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - /** - * List of URLs that were analyzed. - * - * @var list|null $urlsAnalyzed - */ - #[Optional('urls_analyzed', list: 'string')] - public ?array $urlsAnalyzed; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $dataExtracted - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - * @param list|null $urlsAnalyzed - */ - public static function with( - ?array $dataExtracted = null, - ?string $domain = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ?array $urlsAnalyzed = null, - ): self { - $self = new self; - - null !== $dataExtracted && $self['dataExtracted'] = $dataExtracted; - null !== $domain && $self['domain'] = $domain; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - null !== $urlsAnalyzed && $self['urlsAnalyzed'] = $urlsAnalyzed; - - return $self; - } - - /** - * Array of extracted data points. - * - * @param list $dataExtracted - */ - public function withDataExtracted(array $dataExtracted): self - { - $self = clone $this; - $self['dataExtracted'] = $dataExtracted; - - return $self; - } - - /** - * The domain that was analyzed. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * List of URLs that were analyzed. - * - * @param list $urlsAnalyzed - */ - public function withURLsAnalyzed(array $urlsAnalyzed): self - { - $self = clone $this; - $self['urlsAnalyzed'] = $urlsAnalyzed; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse/DataExtracted.php b/src/AI/AIAIQueryResponse/DataExtracted.php deleted file mode 100644 index f99ac9a..0000000 --- a/src/AI/AIAIQueryResponse/DataExtracted.php +++ /dev/null @@ -1,87 +0,0 @@ - */ - use SdkModel; - - /** - * Name of the extracted data point. - */ - #[Optional('datapoint_name')] - public ?string $datapointName; - - /** - * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. - * - * @var DatapointValueVariants|null $datapointValue - */ - #[Optional('datapoint_value', union: DatapointValue::class)] - public string|float|bool|array|null $datapointValue; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param DatapointValueShape|null $datapointValue - */ - public static function with( - ?string $datapointName = null, - string|float|bool|array|null $datapointValue = null - ): self { - $self = new self; - - null !== $datapointName && $self['datapointName'] = $datapointName; - null !== $datapointValue && $self['datapointValue'] = $datapointValue; - - return $self; - } - - /** - * Name of the extracted data point. - */ - public function withDatapointName(string $datapointName): self - { - $self = clone $this; - $self['datapointName'] = $datapointName; - - return $self; - } - - /** - * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. - * - * @param DatapointValueShape $datapointValue - */ - public function withDatapointValue( - string|float|bool|array $datapointValue - ): self { - $self = clone $this; - $self['datapointValue'] = $datapointValue; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php b/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php deleted file mode 100644 index e312347..0000000 --- a/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php +++ /dev/null @@ -1,36 +0,0 @@ -|list|list - * @phpstan-type DatapointValueShape = DatapointValueVariants - */ -final class DatapointValue implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return [ - 'string', - 'float', - 'bool', - new ListOf('string'), - new ListOf('float'), - new ListOf('mixed'), - ]; - } -} diff --git a/src/AI/AIAIQueryResponse/KeyMetadata.php b/src/AI/AIAIQueryResponse/KeyMetadata.php deleted file mode 100644 index e4568c2..0000000 --- a/src/AI/AIAIQueryResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse.php b/src/Brand/BrandGetByEmailResponse.php deleted file mode 100644 index 4169cab..0000000 --- a/src/Brand/BrandGetByEmailResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand.php b/src/Brand/BrandGetByEmailResponse/Brand.php deleted file mode 100644 index 3d95272..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Address.php b/src/Brand/BrandGetByEmailResponse/Brand/Address.php deleted file mode 100644 index 4d2134e..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php deleted file mode 100644 index 1d48570..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php deleted file mode 100644 index c958a53..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 002ac65..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Color.php deleted file mode 100644 index 9a5543c..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries.php deleted file mode 100644 index a0dd9d3..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php deleted file mode 100644 index 9718fbd..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 6f4810d..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo.php deleted file mode 100644 index 5247070..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php deleted file mode 100644 index 1d224b0..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php deleted file mode 100644 index a46d7d5..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php deleted file mode 100644 index 255db91..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php deleted file mode 100644 index bd6c1e4..0000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/KeyMetadata.php b/src/Brand/BrandGetByEmailResponse/KeyMetadata.php deleted file mode 100644 index 88c559b..0000000 --- a/src/Brand/BrandGetByEmailResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse.php b/src/Brand/BrandGetByIsinResponse.php deleted file mode 100644 index d1d1c37..0000000 --- a/src/Brand/BrandGetByIsinResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand.php b/src/Brand/BrandGetByIsinResponse/Brand.php deleted file mode 100644 index 75c7a32..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Address.php b/src/Brand/BrandGetByIsinResponse/Brand/Address.php deleted file mode 100644 index a580c48..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php deleted file mode 100644 index 3719734..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php deleted file mode 100644 index 26128b4..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 02c7875..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Color.php deleted file mode 100644 index e97ab2f..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries.php deleted file mode 100644 index 27c08ef..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php deleted file mode 100644 index 76030ba..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 9b037e7..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo.php deleted file mode 100644 index fcfd7d5..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php deleted file mode 100644 index f883356..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php deleted file mode 100644 index 27ca4f9..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php deleted file mode 100644 index 00fea71..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php deleted file mode 100644 index 3f648be..0000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/KeyMetadata.php b/src/Brand/BrandGetByIsinResponse/KeyMetadata.php deleted file mode 100644 index bcb2029..0000000 --- a/src/Brand/BrandGetByIsinResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse.php b/src/Brand/BrandGetByNameResponse.php deleted file mode 100644 index 5967139..0000000 --- a/src/Brand/BrandGetByNameResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand.php b/src/Brand/BrandGetByNameResponse/Brand.php deleted file mode 100644 index 1a6700b..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Address.php b/src/Brand/BrandGetByNameResponse/Brand/Address.php deleted file mode 100644 index f8064df..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php deleted file mode 100644 index 8bedea8..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php deleted file mode 100644 index 1932047..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 95cc16c..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Color.php deleted file mode 100644 index 56b5adc..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries.php b/src/Brand/BrandGetByNameResponse/Brand/Industries.php deleted file mode 100644 index af0cb0b..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php deleted file mode 100644 index 54d6c9d..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index df8802b..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo.php b/src/Brand/BrandGetByNameResponse/Brand/Logo.php deleted file mode 100644 index 56d3855..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php deleted file mode 100644 index e99a36e..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php deleted file mode 100644 index 5371498..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php deleted file mode 100644 index 8161b3c..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php deleted file mode 100644 index f349881..0000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/KeyMetadata.php b/src/Brand/BrandGetByNameResponse/KeyMetadata.php deleted file mode 100644 index caf12ba..0000000 --- a/src/Brand/BrandGetByNameResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse.php b/src/Brand/BrandGetByTickerResponse.php deleted file mode 100644 index afe72bf..0000000 --- a/src/Brand/BrandGetByTickerResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand.php b/src/Brand/BrandGetByTickerResponse/Brand.php deleted file mode 100644 index b121f01..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Address.php b/src/Brand/BrandGetByTickerResponse/Brand/Address.php deleted file mode 100644 index 325d1c3..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php deleted file mode 100644 index 2be87f3..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php deleted file mode 100644 index efc6227..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index faeac3d..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Color.php deleted file mode 100644 index dcef6d9..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries.php deleted file mode 100644 index 3fe79fe..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php deleted file mode 100644 index dcc42aa..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 6a96999..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo.php deleted file mode 100644 index d28ac0d..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php deleted file mode 100644 index 7137713..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php deleted file mode 100644 index a7d34ad..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php deleted file mode 100644 index 1a0a414..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php deleted file mode 100644 index cb308fd..0000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/KeyMetadata.php b/src/Brand/BrandGetByTickerResponse/KeyMetadata.php deleted file mode 100644 index f3396e9..0000000 --- a/src/Brand/BrandGetByTickerResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionParams.php b/src/Brand/BrandIdentifyFromTransactionParams.php deleted file mode 100644 index 5de9c69..0000000 --- a/src/Brand/BrandIdentifyFromTransactionParams.php +++ /dev/null @@ -1,252 +0,0 @@ -, - * forceLanguage?: null|ForceLanguage|value-of, - * highConfidenceOnly?: bool|null, - * maxSpeed?: bool|null, - * mcc?: string|null, - * phone?: float|null, - * timeoutMs?: int|null, - * } - */ -final class BrandIdentifyFromTransactionParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Transaction information to identify the brand. - */ - #[Required] - public string $transactionInfo; - - /** - * Optional city name to prioritize when searching for the brand. - */ - #[Optional] - public ?string $city; - - /** - * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * - * @var value-of|null $countryGl - */ - #[Optional(enum: CountryGl::class)] - public ?string $countryGl; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. - */ - #[Optional] - public ?bool $highConfidenceOnly; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional Merchant Category Code (MCC) to help identify the business category/industry. - */ - #[Optional] - public ?string $mcc; - - /** - * Optional phone number from the transaction to help verify brand match. - */ - #[Optional] - public ?float $phone; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandIdentifyFromTransactionParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandIdentifyFromTransactionParams::with(transactionInfo: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandIdentifyFromTransactionParams)->withTransactionInfo(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param CountryGl|value-of|null $countryGl - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $transactionInfo, - ?string $city = null, - CountryGl|string|null $countryGl = null, - ForceLanguage|string|null $forceLanguage = null, - ?bool $highConfidenceOnly = null, - ?bool $maxSpeed = null, - ?string $mcc = null, - ?float $phone = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['transactionInfo'] = $transactionInfo; - - null !== $city && $self['city'] = $city; - null !== $countryGl && $self['countryGl'] = $countryGl; - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $highConfidenceOnly && $self['highConfidenceOnly'] = $highConfidenceOnly; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $mcc && $self['mcc'] = $mcc; - null !== $phone && $self['phone'] = $phone; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Transaction information to identify the brand. - */ - public function withTransactionInfo(string $transactionInfo): self - { - $self = clone $this; - $self['transactionInfo'] = $transactionInfo; - - return $self; - } - - /** - * Optional city name to prioritize when searching for the brand. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * - * @param CountryGl|value-of $countryGl - */ - public function withCountryGl(CountryGl|string $countryGl): self - { - $self = clone $this; - $self['countryGl'] = $countryGl; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. - */ - public function withHighConfidenceOnly(bool $highConfidenceOnly): self - { - $self = clone $this; - $self['highConfidenceOnly'] = $highConfidenceOnly; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional Merchant Category Code (MCC) to help identify the business category/industry. - */ - public function withMcc(string $mcc): self - { - $self = clone $this; - $self['mcc'] = $mcc; - - return $self; - } - - /** - * Optional phone number from the transaction to help verify brand match. - */ - public function withPhone(float $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php b/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php deleted file mode 100644 index 9fdec22..0000000 --- a/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php +++ /dev/null @@ -1,489 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php deleted file mode 100644 index 6110e28..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php deleted file mode 100644 index bc937d0..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php deleted file mode 100644 index 46c8abb..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class, - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php deleted file mode 100644 index c0c8f82..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 311b6d3..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php deleted file mode 100644 index 249a414..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php deleted file mode 100644 index b0519ad..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php deleted file mode 100644 index cb9dd0d..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index fd1a839..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php deleted file mode 100644 index 3ad972b..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class, - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php deleted file mode 100644 index d998e68..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php deleted file mode 100644 index 2757467..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php deleted file mode 100644 index 8aa9e3c..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php deleted file mode 100644 index 9ca6332..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php b/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php deleted file mode 100644 index f1edefc..0000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByEmailParams.php b/src/Brand/BrandRetrieveByEmailParams.php deleted file mode 100644 index 23e596f..0000000 --- a/src/Brand/BrandRetrieveByEmailParams.php +++ /dev/null @@ -1,166 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByEmailParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - #[Required] - public string $email; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByEmailParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByEmailParams::with(email: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByEmailParams)->withEmail(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $email, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['email'] = $email; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php b/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php deleted file mode 100644 index 6ebc151..0000000 --- a/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByIsinParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - */ - #[Required] - public string $isin; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByIsinParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByIsinParams::with(isin: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByIsinParams)->withIsin(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $isin, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['isin'] = $isin; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - */ - public function withIsin(string $isin): self - { - $self = clone $this; - $self['isin'] = $isin; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php b/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php deleted file mode 100644 index 59bbdf5..0000000 --- a/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -, - * forceLanguage?: null|ForceLanguage|value-of, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByNameParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - */ - #[Required] - public string $name; - - /** - * Optional country code hint (GL parameter) to specify the country for the company name. - * - * @var value-of|null $countryGl - */ - #[Optional(enum: CountryGl::class)] - public ?string $countryGl; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByNameParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByNameParams::with(name: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByNameParams)->withName(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param CountryGl|value-of|null $countryGl - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $name, - CountryGl|string|null $countryGl = null, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['name'] = $name; - - null !== $countryGl && $self['countryGl'] = $countryGl; - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Optional country code hint (GL parameter) to specify the country for the company name. - * - * @param CountryGl|value-of $countryGl - */ - public function withCountryGl(CountryGl|string $countryGl): self - { - $self = clone $this; - $self['countryGl'] = $countryGl; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByNameParams/CountryGl.php b/src/Brand/BrandRetrieveByNameParams/CountryGl.php deleted file mode 100644 index 290fad4..0000000 --- a/src/Brand/BrandRetrieveByNameParams/CountryGl.php +++ /dev/null @@ -1,489 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * tickerExchange?: null|TickerExchange|value-of, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByTickerParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - */ - #[Required] - public string $ticker; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * - * @var value-of|null $tickerExchange - */ - #[Optional(enum: TickerExchange::class)] - public ?string $tickerExchange; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByTickerParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByTickerParams::with(ticker: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByTickerParams)->withTicker(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - * @param TickerExchange|value-of|null $tickerExchange - */ - public static function with( - string $ticker, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['ticker'] = $ticker; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * - * @param TickerExchange|value-of $tickerExchange - */ - public function withTickerExchange( - TickerExchange|string $tickerExchange - ): self { - $self = clone $this; - $self['tickerExchange'] = $tickerExchange; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php b/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php deleted file mode 100644 index 7449533..0000000 --- a/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -, * forceLanguage?: null|ForceLanguage|value-of, * maxAgeMs?: int|null, * maxSpeed?: bool|null, * timeoutMs?: int|null, + * name: string, + * countryGl?: string|null, + * email: string, + * ticker: string, + * tickerExchange?: string|null, + * transactionInfo: string, + * city?: string|null, + * highConfidenceOnly?: bool|null, + * mcc?: int|null, + * phone?: float|null, * } */ final class BrandRetrieveParams implements BaseModel @@ -31,17 +43,21 @@ final class BrandRetrieveParams implements BaseModel use SdkParams; /** - * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + * Domain name to retrieve brand data for (e.g., 'stripe.com'). */ #[Required] public string $domain; /** - * Optional parameter to force the language of the retrieved brand data. + * Discriminator for transaction-based brand retrieval. * - * @var value-of|null $forceLanguage + * @var value-of $type */ - #[Optional(enum: ForceLanguage::class)] + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of|null $forceLanguage */ + #[Optional('force_language', enum: ForceLanguage::class)] public ?string $forceLanguage; /** @@ -51,7 +67,7 @@ final class BrandRetrieveParams implements BaseModel public ?int $maxAgeMs; /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. */ #[Optional] public ?bool $maxSpeed; @@ -59,21 +75,94 @@ final class BrandRetrieveParams implements BaseModel /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ - #[Optional] + #[Optional('timeoutMS')] public ?int $timeoutMs; + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc'). + */ + #[Required] + public string $name; + + /** + * Optional country code hint (GL parameter) to specify the country when identifying a transaction. + */ + #[Optional('country_gl')] + public ?string $countryGl; + + /** + * Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + */ + #[Required] + public string $email; + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + */ + #[Required] + public string $ticker; + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + */ + #[Optional('ticker_exchange')] + public ?string $tickerExchange; + + /** + * Transaction information to identify the brand. + */ + #[Required('transaction_info')] + public string $transactionInfo; + + /** + * Optional city name to prioritize when searching for the brand. + */ + #[Optional] + public ?string $city; + + /** + * When set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence. + */ + #[Optional('high_confidence_only')] + public ?bool $highConfidenceOnly; + + /** + * Optional Merchant Category Code (MCC) to help identify the business category or industry. + */ + #[Optional] + public ?int $mcc; + + /** + * Optional phone number from the transaction to help verify brand match. + */ + #[Optional] + public ?float $phone; + /** * `new BrandRetrieveParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * BrandRetrieveParams::with(domain: ...) + * BrandRetrieveParams::with( + * domain: ..., + * type: ..., + * name: ..., + * email: ..., + * ticker: ..., + * transactionInfo: ..., + * ) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new BrandRetrieveParams)->withDomain(...) + * (new BrandRetrieveParams) + * ->withDomain(...) + * ->withType(...) + * ->withName(...) + * ->withEmail(...) + * ->withTicker(...) + * ->withTransactionInfo(...) * ``` */ public function __construct() @@ -86,29 +175,52 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Type|value-of $type * @param ForceLanguage|value-of|null $forceLanguage */ public static function with( string $domain, + Type|string $type, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, + ?string $countryGl = null, + ?string $tickerExchange = null, + ?string $city = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, + ?float $phone = null, ): self { $self = new self; $self['domain'] = $domain; + $self['type'] = $type; + $self['name'] = $name; + $self['email'] = $email; + $self['ticker'] = $ticker; + $self['transactionInfo'] = $transactionInfo; null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $countryGl && $self['countryGl'] = $countryGl; + null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; + null !== $city && $self['city'] = $city; + null !== $highConfidenceOnly && $self['highConfidenceOnly'] = $highConfidenceOnly; + null !== $mcc && $self['mcc'] = $mcc; + null !== $phone && $self['phone'] = $phone; return $self; } /** - * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + * Domain name to retrieve brand data for (e.g., 'stripe.com'). */ public function withDomain(string $domain): self { @@ -119,8 +231,19 @@ public function withDomain(string $domain): self } /** - * Optional parameter to force the language of the retrieved brand data. + * Discriminator for transaction-based brand retrieval. * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** * @param ForceLanguage|value-of $forceLanguage */ public function withForceLanguage(ForceLanguage|string $forceLanguage): self @@ -143,7 +266,7 @@ public function withMaxAgeMs(int $maxAgeMs): self } /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. */ public function withMaxSpeed(bool $maxSpeed): self { @@ -163,4 +286,114 @@ public function withTimeoutMs(int $timeoutMs): self return $self; } + + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc'). + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Optional country code hint (GL parameter) to specify the country when identifying a transaction. + */ + public function withCountryGl(string $countryGl): self + { + $self = clone $this; + $self['countryGl'] = $countryGl; + + return $self; + } + + /** + * Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + */ + public function withTickerExchange(string $tickerExchange): self + { + $self = clone $this; + $self['tickerExchange'] = $tickerExchange; + + return $self; + } + + /** + * Transaction information to identify the brand. + */ + public function withTransactionInfo(string $transactionInfo): self + { + $self = clone $this; + $self['transactionInfo'] = $transactionInfo; + + return $self; + } + + /** + * Optional city name to prioritize when searching for the brand. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * When set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence. + */ + public function withHighConfidenceOnly(bool $highConfidenceOnly): self + { + $self = clone $this; + $self['highConfidenceOnly'] = $highConfidenceOnly; + + return $self; + } + + /** + * Optional Merchant Category Code (MCC) to help identify the business category or industry. + */ + public function withMcc(int $mcc): self + { + $self = clone $this; + $self['mcc'] = $mcc; + + return $self; + } + + /** + * Optional phone number from the transaction to help verify brand match. + */ + public function withPhone(float $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } } diff --git a/src/Brand/BrandRetrieveParams/ForceLanguage.php b/src/Brand/BrandRetrieveParams/ForceLanguage.php index 41a3aee..82478ee 100644 --- a/src/Brand/BrandRetrieveParams/ForceLanguage.php +++ b/src/Brand/BrandRetrieveParams/ForceLanguage.php @@ -4,9 +4,6 @@ namespace ContextDev\Brand\BrandRetrieveParams; -/** - * Optional parameter to force the language of the retrieved brand data. - */ enum ForceLanguage: string { case AFRIKAANS = 'afrikaans'; diff --git a/src/Brand/BrandRetrieveParams/Type.php b/src/Brand/BrandRetrieveParams/Type.php new file mode 100644 index 0000000..00a6ff9 --- /dev/null +++ b/src/Brand/BrandRetrieveParams/Type.php @@ -0,0 +1,13 @@ +brand = new BrandService($this); $this->industry = new IndustryService($this); $this->utility = new UtilityService($this); + $this->monitors = new MonitorsService($this); } /** @return array */ diff --git a/src/Monitors/MonitorCreateParams.php b/src/Monitors/MonitorCreateParams.php new file mode 100644 index 0000000..292b75b --- /dev/null +++ b/src/Monitors/MonitorCreateParams.php @@ -0,0 +1,240 @@ +, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorCreateParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorCreateParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorCreateParams::with( + * changeDetection: ..., name: ..., schedule: ..., target: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorCreateParams) + * ->withChangeDetection(...) + * ->withName(...) + * ->withSchedule(...) + * ->withTarget(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param TargetShape $target + * @param Mode|value-of|null $mode + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + string $name, + Schedule|array $schedule, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['changeDetection'] = $changeDetection; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['target'] = $target; + + null !== $mode && $self['mode'] = $mode; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection.php new file mode 100644 index 0000000..c3d29e8 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..d69644b --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..8297408 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Mode.php b/src/Monitors/MonitorCreateParams/Mode.php new file mode 100644 index 0000000..5188b04 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Mode.php @@ -0,0 +1,13 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Schedule/Type.php b/src/Monitors/MonitorCreateParams/Schedule/Type.php new file mode 100644 index 0000000..19fc369 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..0590362 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..c5908ac --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..92e7c01 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Webhook.php b/src/Monitors/MonitorCreateParams/Webhook.php new file mode 100644 index 0000000..93cd9ff --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Webhook.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorDeleteResponse.php b/src/Monitors/MonitorDeleteResponse.php new file mode 100644 index 0000000..b8ec288 --- /dev/null +++ b/src/Monitors/MonitorDeleteResponse.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + #[Required] + public bool $deleted; + + /** + * `new MonitorDeleteResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorDeleteResponse::with(id: ..., deleted: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorDeleteResponse)->withID(...)->withDeleted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $id, bool $deleted): self + { + $self = new self; + + $self['id'] = $id; + $self['deleted'] = $deleted; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withDeleted(bool $deleted): self + { + $self = clone $this; + $self['deleted'] = $deleted; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php new file mode 100644 index 0000000..44f7b82 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -0,0 +1,508 @@ +, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * runID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * addedURLs?: list|null, + * afterTextExcerpt?: string|null, + * beforeTextExcerpt?: string|null, + * confidence?: float|null, + * diff?: string|null, + * evidence?: list|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * matchedURLs?: list|null, + * query?: string|null, + * removedURLCount?: int|null, + * removedURLs?: list|null, + * tags?: list|null, + * } + */ +final class MonitorGetChangeResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * The run that detected this change. + */ + #[Required('run_id')] + public string $runID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $addedURLs + */ + #[Optional('added_urls', list: 'string')] + public ?array $addedURLs; + + #[Optional('after_text_excerpt')] + public ?string $afterTextExcerpt; + + #[Optional('before_text_excerpt')] + public ?string $beforeTextExcerpt; + + #[Optional] + public ?float $confidence; + + /** + * Text diff between the previous and current page baseline (page targets). + */ + #[Optional] + public ?string $diff; + + /** @var list|null $evidence */ + #[Optional(list: Evidence::class)] + public ?array $evidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $matchedURLs + */ + #[Optional('matched_urls', list: 'string')] + public ?array $matchedURLs; + + #[Optional] + public ?string $query; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $removedURLs + */ + #[Optional('removed_urls', list: 'string')] + public ?array $removedURLs; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorGetChangeResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetChangeResponse::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * runID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetChangeResponse) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withRunID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param list|null $addedURLs + * @param list|null $evidence + * @param Importance|value-of|null $importance + * @param list|null $matchedURLs + * @param list|null $removedURLs + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $runID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?array $addedURLs = null, + ?string $afterTextExcerpt = null, + ?string $beforeTextExcerpt = null, + ?float $confidence = null, + ?string $diff = null, + ?array $evidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?array $matchedURLs = null, + ?string $query = null, + ?int $removedURLCount = null, + ?array $removedURLs = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['runID'] = $runID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $addedURLs && $self['addedURLs'] = $addedURLs; + null !== $afterTextExcerpt && $self['afterTextExcerpt'] = $afterTextExcerpt; + null !== $beforeTextExcerpt && $self['beforeTextExcerpt'] = $beforeTextExcerpt; + null !== $confidence && $self['confidence'] = $confidence; + null !== $diff && $self['diff'] = $diff; + null !== $evidence && $self['evidence'] = $evidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $matchedURLs && $self['matchedURLs'] = $matchedURLs; + null !== $query && $self['query'] = $query; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $removedURLs && $self['removedURLs'] = $removedURLs; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * The run that detected this change. + */ + public function withRunID(string $runID): self + { + $self = clone $this; + $self['runID'] = $runID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @param list $addedURLs + */ + public function withAddedURLs(array $addedURLs): self + { + $self = clone $this; + $self['addedURLs'] = $addedURLs; + + return $self; + } + + public function withAfterTextExcerpt(string $afterTextExcerpt): self + { + $self = clone $this; + $self['afterTextExcerpt'] = $afterTextExcerpt; + + return $self; + } + + public function withBeforeTextExcerpt(string $beforeTextExcerpt): self + { + $self = clone $this; + $self['beforeTextExcerpt'] = $beforeTextExcerpt; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * Text diff between the previous and current page baseline (page targets). + */ + public function withDiff(string $diff): self + { + $self = clone $this; + $self['diff'] = $diff; + + return $self; + } + + /** + * @param list $evidence + */ + public function withEvidence(array $evidence): self + { + $self = clone $this; + $self['evidence'] = $evidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @param list $matchedURLs + */ + public function withMatchedURLs(array $matchedURLs): self + { + $self = clone $this; + $self['matchedURLs'] = $matchedURLs; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @param list $removedURLs + */ + public function withRemovedURLs(array $removedURLs): self + { + $self = clone $this; + $self['removedURLs'] = $removedURLs; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php new file mode 100644 index 0000000..7b921c4 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + /** + * Snapshot of the content after the change. + */ + #[Required] + public string $after; + + /** + * Snapshot of the content before the change. + */ + #[Required] + public string $before; + + /** + * Optional URL the evidence relates to. Absent for whole-target diffs. + */ + #[Optional] + public ?string $url; + + /** + * `new Evidence()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Evidence::with(after: ..., before: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Evidence)->withAfter(...)->withBefore(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $after, + string $before, + ?string $url = null + ): self { + $self = new self; + + $self['after'] = $after; + $self['before'] = $before; + + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Snapshot of the content after the change. + */ + public function withAfter(string $after): self + { + $self = clone $this; + $self['after'] = $after; + + return $self; + } + + /** + * Snapshot of the content before the change. + */ + public function withBefore(string $before): self + { + $self = clone $this; + $self['before'] = $before; + + return $self; + } + + /** + * Optional URL the evidence relates to. Absent for whole-target diffs. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/Importance.php b/src/Monitors/MonitorGetChangeResponse/Importance.php new file mode 100644 index 0000000..61ba1c3 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/Importance.php @@ -0,0 +1,14 @@ +, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, + * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorGetResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorGetResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, + ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection.php new file mode 100644 index 0000000..35d5925 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..0aada69 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..c704604 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/LastError.php b/src/Monitors/MonitorGetResponse/LastError.php new file mode 100644 index 0000000..815218a --- /dev/null +++ b/src/Monitors/MonitorGetResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Mode.php b/src/Monitors/MonitorGetResponse/Mode.php new file mode 100644 index 0000000..d7261b4 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Mode.php @@ -0,0 +1,13 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Schedule/Type.php b/src/Monitors/MonitorGetResponse/Schedule/Type.php new file mode 100644 index 0000000..5dd76cb --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..c5d50b5 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..0689dc3 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..4ae0fca --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Webhook.php b/src/Monitors/MonitorGetResponse/Webhook.php new file mode 100644 index 0000000..a54b4a2 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Webhook.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesParams.php b/src/Monitors/MonitorListAccountChangesParams.php new file mode 100644 index 0000000..53cfc41 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesParams.php @@ -0,0 +1,175 @@ +, + * cursor?: string|null, + * limit?: int|null, + * monitorID?: string|null, + * since?: \DateTimeInterface|null, + * tag?: string|null, + * targetType?: null|TargetType|value-of, + * until?: \DateTimeInterface|null, + * } + */ +final class MonitorListAccountChangesParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** @var value-of|null $changeDetectionType */ + #[Optional(enum: ChangeDetectionType::class)] + public ?string $changeDetectionType; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + #[Optional] + public ?string $monitorID; + + #[Optional] + public ?\DateTimeInterface $since; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + /** @var value-of|null $targetType */ + #[Optional(enum: TargetType::class)] + public ?string $targetType; + + #[Optional] + public ?\DateTimeInterface $until; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of|null $changeDetectionType + * @param TargetType|value-of|null $targetType + */ + public static function with( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + ?int $limit = null, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + ): self { + $self = new self; + + null !== $changeDetectionType && $self['changeDetectionType'] = $changeDetectionType; + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $monitorID && $self['monitorID'] = $monitorID; + null !== $since && $self['since'] = $since; + null !== $tag && $self['tag'] = $tag; + null !== $targetType && $self['targetType'] = $targetType; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSince(\DateTimeInterface $since): self + { + $self = clone $this; + $self['since'] = $since; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withUntil(\DateTimeInterface $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php new file mode 100644 index 0000000..6890569 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php @@ -0,0 +1,12 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListAccountChangesResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListAccountChangesResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListAccountChangesResponse::with( + * data: ..., hasMore: ..., nextCursor: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListAccountChangesResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data.php b/src/Monitors/MonitorListAccountChangesResponse/Data.php new file mode 100644 index 0000000..9d2a560 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data.php @@ -0,0 +1,327 @@ +, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * confidence?: float|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * removedURLCount?: int|null, + * tags?: list|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + #[Optional] + public ?float $confidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param Importance|value-of|null $importance + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?float $confidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?int $removedURLCount = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $confidence && $self['confidence'] = $confidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php new file mode 100644 index 0000000..b3d95b3 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ + + * } + */ +final class MonitorListAccountRunsParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of|null $status + */ + #[Optional(enum: Status::class)] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of|null $status + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsParams/Status.php b/src/Monitors/MonitorListAccountRunsParams/Status.php new file mode 100644 index 0000000..585dc95 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsParams/Status.php @@ -0,0 +1,21 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListAccountRunsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListAccountRunsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListAccountRunsResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListAccountRunsResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php new file mode 100644 index 0000000..2128193 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -0,0 +1,337 @@ +, + * creditsCharged: int, + * monitorID: string, + * runType: RunType|value-of, + * status: Status|value-of, + * targetType: TargetType|value-of, + * changeID?: string|null, + * completedAt?: \DateTimeInterface|null, + * error?: null|Error|ErrorShape, + * skipReason?: null|SkipReason|value-of, + * startedAt?: \DateTimeInterface|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + #[Required('baseline_created')] + public bool $baselineCreated; + + #[Required('change_detected')] + public bool $changeDetected; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + #[Required('credits_charged')] + public int $creditsCharged; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * The first run after monitor creation is a baseline run. + * + * @var value-of $runType + */ + #[Required('run_type', enum: RunType::class)] + public string $runType; + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Optional('change_id', nullable: true)] + public ?string $changeID; + + #[Optional('completed_at', nullable: true)] + public ?\DateTimeInterface $completedAt; + + #[Optional(nullable: true)] + public ?Error $error; + + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @var value-of|null $skipReason + */ + #[Optional('skip_reason', enum: SkipReason::class, nullable: true)] + public ?string $skipReason; + + #[Optional('started_at', nullable: true)] + public ?\DateTimeInterface $startedAt; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * baselineCreated: ..., + * changeDetected: ..., + * changeDetectionType: ..., + * creditsCharged: ..., + * monitorID: ..., + * runType: ..., + * status: ..., + * targetType: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withBaselineCreated(...) + * ->withChangeDetected(...) + * ->withChangeDetectionType(...) + * ->withCreditsCharged(...) + * ->withMonitorID(...) + * ->withRunType(...) + * ->withStatus(...) + * ->withTargetType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param RunType|value-of $runType + * @param Status|value-of $status + * @param TargetType|value-of $targetType + * @param Error|ErrorShape|null $error + * @param SkipReason|value-of|null $skipReason + */ + public static function with( + string $id, + bool $baselineCreated, + bool $changeDetected, + ChangeDetectionType|string $changeDetectionType, + int $creditsCharged, + string $monitorID, + RunType|string $runType, + Status|string $status, + TargetType|string $targetType, + ?string $changeID = null, + ?\DateTimeInterface $completedAt = null, + Error|array|null $error = null, + SkipReason|string|null $skipReason = null, + ?\DateTimeInterface $startedAt = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['baselineCreated'] = $baselineCreated; + $self['changeDetected'] = $changeDetected; + $self['changeDetectionType'] = $changeDetectionType; + $self['creditsCharged'] = $creditsCharged; + $self['monitorID'] = $monitorID; + $self['runType'] = $runType; + $self['status'] = $status; + $self['targetType'] = $targetType; + + null !== $changeID && $self['changeID'] = $changeID; + null !== $completedAt && $self['completedAt'] = $completedAt; + null !== $error && $self['error'] = $error; + null !== $skipReason && $self['skipReason'] = $skipReason; + null !== $startedAt && $self['startedAt'] = $startedAt; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + public function withBaselineCreated(bool $baselineCreated): self + { + $self = clone $this; + $self['baselineCreated'] = $baselineCreated; + + return $self; + } + + public function withChangeDetected(bool $changeDetected): self + { + $self = clone $this; + $self['changeDetected'] = $changeDetected; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + public function withCreditsCharged(int $creditsCharged): self + { + $self = clone $this; + $self['creditsCharged'] = $creditsCharged; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * The first run after monitor creation is a baseline run. + * + * @param RunType|value-of $runType + */ + public function withRunType(RunType|string $runType): self + { + $self = clone $this; + $self['runType'] = $runType; + + return $self; + } + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withChangeID(?string $changeID): self + { + $self = clone $this; + $self['changeID'] = $changeID; + + return $self; + } + + public function withCompletedAt(?\DateTimeInterface $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @param SkipReason|value-of|null $skipReason + */ + public function withSkipReason(SkipReason|string|null $skipReason): self + { + $self = clone $this; + $self['skipReason'] = $skipReason; + + return $self; + } + + public function withStartedAt(?\DateTimeInterface $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php new file mode 100644 index 0000000..f420d6e --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php b/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php new file mode 100644 index 0000000..9062a51 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + #[Optional] + public ?\DateTimeInterface $since; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + #[Optional] + public ?\DateTimeInterface $until; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $since && $self['since'] = $since; + null !== $tag && $self['tag'] = $tag; + null !== $until && $self['until'] = $until; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + public function withSince(\DateTimeInterface $since): self + { + $self = clone $this; + $self['since'] = $since; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + public function withUntil(\DateTimeInterface $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse.php b/src/Monitors/MonitorListChangesResponse.php new file mode 100644 index 0000000..82a0db5 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse.php @@ -0,0 +1,103 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListChangesResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListChangesResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListChangesResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListChangesResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data.php b/src/Monitors/MonitorListChangesResponse/Data.php new file mode 100644 index 0000000..cf01a7a --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data.php @@ -0,0 +1,327 @@ +, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * confidence?: float|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * removedURLCount?: int|null, + * tags?: list|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + #[Optional] + public ?float $confidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param Importance|value-of|null $importance + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?float $confidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?int $removedURLCount = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $confidence && $self['confidence'] = $confidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php new file mode 100644 index 0000000..ce8548e --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ +, + * cursor?: string|null, + * limit?: int|null, + * q?: string|null, + * searchBy?: list>|null, + * searchType?: null|SearchType|value-of, + * status?: null|Status|value-of, + * tag?: string|null, + * tags?: list|null, + * targetType?: null|TargetType|value-of, + * } + */ +final class MonitorListParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** @var value-of|null $changeDetectionType */ + #[Optional(enum: ChangeDetectionType::class)] + public ?string $changeDetectionType; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** + * Free-text search term, matched against the fields named in `search_by`. + */ + #[Optional] + public ?string $q; + + /** + * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * + * @var list>|null $searchBy + */ + #[Optional(list: SearchBy::class)] + public ?array $searchBy; + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @var value-of|null $searchType + */ + #[Optional(enum: SearchType::class)] + public ?string $searchType; + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of|null $status + */ + #[Optional(enum: Status::class)] + public ?string $status; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + /** + * Comma-separated list of tags to filter by (matches monitors having any of them). + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** @var value-of|null $targetType */ + #[Optional(enum: TargetType::class)] + public ?string $targetType; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of|null $changeDetectionType + * @param list>|null $searchBy + * @param SearchType|value-of|null $searchType + * @param Status|value-of|null $status + * @param list|null $tags + * @param TargetType|value-of|null $targetType + */ + public static function with( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + ?int $limit = null, + ?string $q = null, + ?array $searchBy = null, + SearchType|string|null $searchType = null, + Status|string|null $status = null, + ?string $tag = null, + ?array $tags = null, + TargetType|string|null $targetType = null, + ): self { + $self = new self; + + null !== $changeDetectionType && $self['changeDetectionType'] = $changeDetectionType; + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $q && $self['q'] = $q; + null !== $searchBy && $self['searchBy'] = $searchBy; + null !== $searchType && $self['searchType'] = $searchType; + null !== $status && $self['status'] = $status; + null !== $tag && $self['tag'] = $tag; + null !== $tags && $self['tags'] = $tags; + null !== $targetType && $self['targetType'] = $targetType; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Free-text search term, matched against the fields named in `search_by`. + */ + public function withQ(string $q): self + { + $self = clone $this; + $self['q'] = $q; + + return $self; + } + + /** + * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * + * @param list> $searchBy + */ + public function withSearchBy(array $searchBy): self + { + $self = clone $this; + $self['searchBy'] = $searchBy; + + return $self; + } + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @param SearchType|value-of $searchType + */ + public function withSearchType(SearchType|string $searchType): self + { + $self = clone $this; + $self['searchType'] = $searchType; + + return $self; + } + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + /** + * Comma-separated list of tags to filter by (matches monitors having any of them). + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } +} diff --git a/src/Monitors/MonitorListParams/ChangeDetectionType.php b/src/Monitors/MonitorListParams/ChangeDetectionType.php new file mode 100644 index 0000000..d0e2972 --- /dev/null +++ b/src/Monitors/MonitorListParams/ChangeDetectionType.php @@ -0,0 +1,12 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListResponse)->withData(...)->withHasMore(...)->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php new file mode 100644 index 0000000..9552664 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data.php @@ -0,0 +1,390 @@ +, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, + * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, + ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection.php new file mode 100644 index 0000000..5b03923 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..c828494 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..9a6a468 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/LastError.php b/src/Monitors/MonitorListResponse/Data/LastError.php new file mode 100644 index 0000000..4cf4df7 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Mode.php b/src/Monitors/MonitorListResponse/Data/Mode.php new file mode 100644 index 0000000..8c4af84 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Mode.php @@ -0,0 +1,13 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/Schedule/Type.php new file mode 100644 index 0000000..b2b156c --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..c092e11 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..bff0489 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..04a020f --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Webhook.php b/src/Monitors/MonitorListResponse/Data/Webhook.php new file mode 100644 index 0000000..1fcacfb --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Webhook.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsParams.php b/src/Monitors/MonitorListRunsParams.php new file mode 100644 index 0000000..8b87f69 --- /dev/null +++ b/src/Monitors/MonitorListRunsParams.php @@ -0,0 +1,96 @@ + + * } + */ +final class MonitorListRunsParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of|null $status + */ + #[Optional(enum: Status::class)] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of|null $status + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsParams/Status.php b/src/Monitors/MonitorListRunsParams/Status.php new file mode 100644 index 0000000..765a444 --- /dev/null +++ b/src/Monitors/MonitorListRunsParams/Status.php @@ -0,0 +1,21 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListRunsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListRunsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListRunsResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListRunsResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data.php b/src/Monitors/MonitorListRunsResponse/Data.php new file mode 100644 index 0000000..882d163 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data.php @@ -0,0 +1,337 @@ +, + * creditsCharged: int, + * monitorID: string, + * runType: RunType|value-of, + * status: Status|value-of, + * targetType: TargetType|value-of, + * changeID?: string|null, + * completedAt?: \DateTimeInterface|null, + * error?: null|Error|ErrorShape, + * skipReason?: null|SkipReason|value-of, + * startedAt?: \DateTimeInterface|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + #[Required('baseline_created')] + public bool $baselineCreated; + + #[Required('change_detected')] + public bool $changeDetected; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + #[Required('credits_charged')] + public int $creditsCharged; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * The first run after monitor creation is a baseline run. + * + * @var value-of $runType + */ + #[Required('run_type', enum: RunType::class)] + public string $runType; + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Optional('change_id', nullable: true)] + public ?string $changeID; + + #[Optional('completed_at', nullable: true)] + public ?\DateTimeInterface $completedAt; + + #[Optional(nullable: true)] + public ?Error $error; + + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @var value-of|null $skipReason + */ + #[Optional('skip_reason', enum: SkipReason::class, nullable: true)] + public ?string $skipReason; + + #[Optional('started_at', nullable: true)] + public ?\DateTimeInterface $startedAt; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * baselineCreated: ..., + * changeDetected: ..., + * changeDetectionType: ..., + * creditsCharged: ..., + * monitorID: ..., + * runType: ..., + * status: ..., + * targetType: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withBaselineCreated(...) + * ->withChangeDetected(...) + * ->withChangeDetectionType(...) + * ->withCreditsCharged(...) + * ->withMonitorID(...) + * ->withRunType(...) + * ->withStatus(...) + * ->withTargetType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param RunType|value-of $runType + * @param Status|value-of $status + * @param TargetType|value-of $targetType + * @param Error|ErrorShape|null $error + * @param SkipReason|value-of|null $skipReason + */ + public static function with( + string $id, + bool $baselineCreated, + bool $changeDetected, + ChangeDetectionType|string $changeDetectionType, + int $creditsCharged, + string $monitorID, + RunType|string $runType, + Status|string $status, + TargetType|string $targetType, + ?string $changeID = null, + ?\DateTimeInterface $completedAt = null, + Error|array|null $error = null, + SkipReason|string|null $skipReason = null, + ?\DateTimeInterface $startedAt = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['baselineCreated'] = $baselineCreated; + $self['changeDetected'] = $changeDetected; + $self['changeDetectionType'] = $changeDetectionType; + $self['creditsCharged'] = $creditsCharged; + $self['monitorID'] = $monitorID; + $self['runType'] = $runType; + $self['status'] = $status; + $self['targetType'] = $targetType; + + null !== $changeID && $self['changeID'] = $changeID; + null !== $completedAt && $self['completedAt'] = $completedAt; + null !== $error && $self['error'] = $error; + null !== $skipReason && $self['skipReason'] = $skipReason; + null !== $startedAt && $self['startedAt'] = $startedAt; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + public function withBaselineCreated(bool $baselineCreated): self + { + $self = clone $this; + $self['baselineCreated'] = $baselineCreated; + + return $self; + } + + public function withChangeDetected(bool $changeDetected): self + { + $self = clone $this; + $self['changeDetected'] = $changeDetected; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + public function withCreditsCharged(int $creditsCharged): self + { + $self = clone $this; + $self['creditsCharged'] = $creditsCharged; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * The first run after monitor creation is a baseline run. + * + * @param RunType|value-of $runType + */ + public function withRunType(RunType|string $runType): self + { + $self = clone $this; + $self['runType'] = $runType; + + return $self; + } + + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withChangeID(?string $changeID): self + { + $self = clone $this; + $self['changeID'] = $changeID; + + return $self; + } + + public function withCompletedAt(?\DateTimeInterface $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @param SkipReason|value-of|null $skipReason + */ + public function withSkipReason(SkipReason|string|null $skipReason): self + { + $self = clone $this; + $self['skipReason'] = $skipReason; + + return $self; + } + + public function withStartedAt(?\DateTimeInterface $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php new file mode 100644 index 0000000..4fa5331 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/RunType.php b/src/Monitors/MonitorListRunsResponse/Data/RunType.php new file mode 100644 index 0000000..f6c2d82 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/RunType.php @@ -0,0 +1,15 @@ +, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, + * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorNewResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorNewResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorNewResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorNewResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, + ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection.php new file mode 100644 index 0000000..6acbb5c --- /dev/null +++ b/src/Monitors/MonitorNewResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..9f80a39 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..21c2a85 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/LastError.php b/src/Monitors/MonitorNewResponse/LastError.php new file mode 100644 index 0000000..894d68c --- /dev/null +++ b/src/Monitors/MonitorNewResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Mode.php b/src/Monitors/MonitorNewResponse/Mode.php new file mode 100644 index 0000000..668aef6 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Mode.php @@ -0,0 +1,13 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Schedule/Type.php b/src/Monitors/MonitorNewResponse/Schedule/Type.php new file mode 100644 index 0000000..61da9c9 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..d71e5bb --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..cb684a9 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..bef89b1 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Webhook.php b/src/Monitors/MonitorNewResponse/Webhook.php new file mode 100644 index 0000000..8a70091 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Webhook.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorRunResponse.php b/src/Monitors/MonitorRunResponse.php new file mode 100644 index 0000000..e90007b --- /dev/null +++ b/src/Monitors/MonitorRunResponse.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public bool $queued; + + /** + * The queued run. Poll GET /monitors/{monitor_id}/runs or use it to correlate results. + */ + #[Required('run_id')] + public string $runID; + + /** + * `new MonitorRunResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorRunResponse::with(monitorID: ..., queued: ..., runID: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorRunResponse)->withMonitorID(...)->withQueued(...)->withRunID(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $monitorID, + bool $queued, + string $runID + ): self { + $self = new self; + + $self['monitorID'] = $monitorID; + $self['queued'] = $queued; + $self['runID'] = $runID; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withQueued(bool $queued): self + { + $self = clone $this; + $self['queued'] = $queued; + + return $self; + } + + /** + * The queued run. Poll GET /monitors/{monitor_id}/runs or use it to correlate results. + */ + public function withRunID(string $runID): self + { + $self = clone $this; + $self['runID'] = $runID; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams.php b/src/Monitors/MonitorUpdateParams.php new file mode 100644 index 0000000..606b67c --- /dev/null +++ b/src/Monitors/MonitorUpdateParams.php @@ -0,0 +1,217 @@ +, + * tags?: list|null, + * target?: TargetShape|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorUpdateParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants|null $changeDetection + */ + #[Optional('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection|null $changeDetection; + + #[Optional] + public ?string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Optional] + public ?Schedule $schedule; + + /** @var value-of|null $status */ + #[Optional(enum: Status::class)] + public ?string $status; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants|null $target + */ + #[Optional(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget|null $target; + + /** + * Set to null to remove the webhook. + */ + #[Optional(nullable: true)] + public ?Webhook $webhook; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape|null $changeDetection + * @param Schedule|ScheduleShape|null $schedule + * @param Status|value-of|null $status + * @param list|null $tags + * @param TargetShape|null $target + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + null !== $changeDetection && $self['changeDetection'] = $changeDetection; + null !== $name && $self['name'] = $name; + null !== $schedule && $self['schedule'] = $schedule; + null !== $status && $self['status'] = $status; + null !== $tags && $self['tags'] = $tags; + null !== $target && $self['target'] = $target; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + /** + * Set to null to remove the webhook. + * + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection.php new file mode 100644 index 0000000..8d76be7 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..a9162ee --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..e97261c --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Schedule.php b/src/Monitors/MonitorUpdateParams/Schedule.php new file mode 100644 index 0000000..2197678 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Schedule.php @@ -0,0 +1,112 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Schedule/Type.php b/src/Monitors/MonitorUpdateParams/Schedule/Type.php new file mode 100644 index 0000000..5501da4 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..61bb6ff --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..6e4bf1e --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..d2e5441 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Webhook.php b/src/Monitors/MonitorUpdateParams/Webhook.php new file mode 100644 index 0000000..c03b5a9 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Webhook.php @@ -0,0 +1,90 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php new file mode 100644 index 0000000..0100ff2 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse.php @@ -0,0 +1,390 @@ +, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, + * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorUpdateResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorUpdateResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorUpdateResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorUpdateResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, + ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection.php new file mode 100644 index 0000000..31cb75f --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 0000000..4111fc8 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 0000000..9941171 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/LastError.php b/src/Monitors/MonitorUpdateResponse/LastError.php new file mode 100644 index 0000000..430044e --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Mode.php b/src/Monitors/MonitorUpdateResponse/Mode.php new file mode 100644 index 0000000..4c0a73c --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Mode.php @@ -0,0 +1,13 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/Schedule/Type.php new file mode 100644 index 0000000..43da8d7 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php new file mode 100644 index 0000000..ce54f24 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php new file mode 100644 index 0000000..80d0b6b --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php new file mode 100644 index 0000000..a02ae7f --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php @@ -0,0 +1,162 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Webhook.php b/src/Monitors/MonitorUpdateResponse/Webhook.php new file mode 100644 index 0000000..e785fec --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Webhook.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/ServiceContracts/AIContract.php b/src/ServiceContracts/AIContract.php index ecd7de9..8746515 100644 --- a/src/ServiceContracts/AIContract.php +++ b/src/ServiceContracts/AIContract.php @@ -4,40 +4,16 @@ namespace ContextDev\ServiceContracts; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface AIContract { - /** - * @api - * - * @param list $dataToExtract Array of data points to extract from the website - * @param string $domain The domain name to analyze - * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function aiQuery( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): AIAIQueryResponse; - /** * @api * diff --git a/src/ServiceContracts/AIRawContract.php b/src/ServiceContracts/AIRawContract.php index dc6e601..783850b 100644 --- a/src/ServiceContracts/AIRawContract.php +++ b/src/ServiceContracts/AIRawContract.php @@ -4,8 +4,6 @@ namespace ContextDev\ServiceContracts; -use ContextDev\AI\AIAIQueryParams; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductParams; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsParams; @@ -19,21 +17,6 @@ */ interface AIRawContract { - /** - * @api - * - * @param array|AIAIQueryParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function aiQuery( - array|AIAIQueryParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - /** * @api * diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index 342ac58..b68e7c3 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -4,16 +4,10 @@ namespace ContextDev\ServiceContracts; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; @@ -25,140 +19,45 @@ interface BrandContract /** * @api * - * @param string $domain Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. - * @param ForceLanguage|value-of $forceLanguage optional parameter to force the language of the retrieved brand data + * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). + * @param Type|value-of $type discriminator for transaction-based brand retrieval + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). + * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $transactionInfo transaction information to identify the brand + * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction + * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param string $city optional city name to prioritize when searching for the brand + * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence + * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param float $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $domain, + Type|string $type, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetResponse; - - /** - * @api - * - * @param string $transactionInfo Transaction information to identify the brand - * @param string $city optional city name to prioritize when searching for the brand - * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry - * @param float $phone optional phone number from the transaction to help verify brand match - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function identifyFromTransaction( - string $transactionInfo, + ?string $countryGl = null, + ?string $tickerExchange = null, ?string $city = null, - CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, - bool $highConfidenceOnly = false, - ?bool $maxSpeed = null, - ?string $mcc = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, ?float $phone = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandIdentifyFromTransactionResponse; - - /** - * @api - * - * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByEmail( - string $email, - \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, - ): BrandGetByEmailResponse; - - /** - * @api - * - * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByIsin( - string $isin, - \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByIsinResponse; - - /** - * @api - * - * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name - * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByName( - string $name, - \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByNameResponse; - - /** - * @api - * - * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByTicker( - string $ticker, - \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByTickerResponse; + ): BrandGetResponse; /** * @api diff --git a/src/ServiceContracts/BrandRawContract.php b/src/ServiceContracts/BrandRawContract.php index 42adeb4..784eff7 100644 --- a/src/ServiceContracts/BrandRawContract.php +++ b/src/ServiceContracts/BrandRawContract.php @@ -4,18 +4,8 @@ namespace ContextDev\ServiceContracts; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByEmailParams; -use ContextDev\Brand\BrandRetrieveByIsinParams; -use ContextDev\Brand\BrandRetrieveByNameParams; -use ContextDev\Brand\BrandRetrieveByTickerParams; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Core\Contracts\BaseResponse; @@ -42,81 +32,6 @@ public function retrieve( RequestOptions|array|null $requestOptions = null, ): BaseResponse; - /** - * @api - * - * @param array|BrandIdentifyFromTransactionParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function identifyFromTransaction( - array|BrandIdentifyFromTransactionParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByEmail( - array|BrandRetrieveByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByIsinParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByIsin( - array|BrandRetrieveByIsinParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByNameParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByName( - array|BrandRetrieveByNameParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByTickerParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByTicker( - array|BrandRetrieveByTickerParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - /** * @api * diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php new file mode 100644 index 0000000..516d8e3 --- /dev/null +++ b/src/ServiceContracts/MonitorsContract.php @@ -0,0 +1,243 @@ + $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param Webhook|WebhookShape|null $webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function create( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + string $name, + Schedule|array $schedule, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorNewResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorGetResponse; + + /** + * @api + * + * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected + * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param Status|value-of $status + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param TargetShape1 $target discriminated union describing what the monitor watches + * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function update( + string $monitorID, + \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection|array|\ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + \ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget|array|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorUpdateResponse; + + /** + * @api + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param string $q free-text search term, matched against the fields named in `search_by` + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * @param string $tag filter to items that have this tag + * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) + * @param TargetType|value-of $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $q = null, + ?array $searchBy = null, + SearchType|string $searchType = 'prefix', + \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, + ?string $tag = null, + ?array $tags = null, + TargetType|string|null $targetType = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorDeleteResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param string $tag filter to items that have this tag + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountChanges( + \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountChangesResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountRuns( + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountRunsResponse; + + /** + * @api + * + * @param string $tag filter to items that have this tag + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListChangesResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListRunsResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): MonitorGetChangeResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorRunResponse; +} diff --git a/src/ServiceContracts/MonitorsRawContract.php b/src/ServiceContracts/MonitorsRawContract.php new file mode 100644 index 0000000..aad01ad --- /dev/null +++ b/src/ServiceContracts/MonitorsRawContract.php @@ -0,0 +1,197 @@ +|MonitorCreateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|MonitorCreateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorUpdateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function update( + string $monitorID, + array|MonitorUpdateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|MonitorListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListAccountChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountChanges( + array|MonitorListAccountChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListAccountRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountRuns( + array|MonitorListAccountRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + array|MonitorListChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + array|MonitorListRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; +} diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index 7ffb24d..64ca1ad 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -6,10 +6,13 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface UtilityContract @@ -17,30 +20,17 @@ interface UtilityContract /** * @api * - * @param string $domain Domain name to prefetch brand data for + * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function prefetch( - string $domain, + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, + Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse; - - /** - * @api - * - * @param string $email Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function prefetchByEmail( - string $email, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): UtilityPrefetchByEmailResponse; } diff --git a/src/ServiceContracts/UtilityRawContract.php b/src/ServiceContracts/UtilityRawContract.php index 463ac4c..5297c88 100644 --- a/src/ServiceContracts/UtilityRawContract.php +++ b/src/ServiceContracts/UtilityRawContract.php @@ -7,8 +7,6 @@ use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; -use ContextDev\Utility\UtilityPrefetchByEmailParams; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchParams; use ContextDev\Utility\UtilityPrefetchResponse; @@ -31,19 +29,4 @@ public function prefetch( array|UtilityPrefetchParams $params, RequestOptions|array|null $requestOptions = null, ): BaseResponse; - - /** - * @api - * - * @param array|UtilityPrefetchByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function prefetchByEmail( - array|UtilityPrefetchByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; } diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index c067c5a..a0afdcd 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -213,6 +213,7 @@ public function search( * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -238,6 +239,7 @@ public function webCrawlMd( \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, ?int $timeoutMs = null, @@ -258,6 +260,7 @@ public function webCrawlMd( * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -276,6 +279,7 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -286,6 +290,7 @@ public function webScrapeHTML( * @api * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -297,6 +302,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, @@ -318,6 +324,7 @@ public function webScrapeImages( * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation @@ -339,6 +346,7 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, ?int $timeoutMs = null, bool $useMainContentOnly = false, diff --git a/src/Services/AIRawService.php b/src/Services/AIRawService.php index 0b6e140..cb6349e 100644 --- a/src/Services/AIRawService.php +++ b/src/Services/AIRawService.php @@ -4,10 +4,6 @@ namespace ContextDev\Services; -use ContextDev\AI\AIAIQueryParams; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductParams; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsParams; @@ -19,8 +15,6 @@ use ContextDev\ServiceContracts\AIRawContract; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class AIRawService implements AIRawContract @@ -31,42 +25,6 @@ final class AIRawService implements AIRawContract */ public function __construct(private Client $client) {} - /** - * @api - * - * Use AI to extract specific data points from a brand's website. The AI will crawl the website and extract the requested information based on the provided data points. - * - * @param array{ - * dataToExtract: list, - * domain: string, - * specificPages?: SpecificPages|SpecificPagesShape, - * timeoutMs?: int, - * }|AIAIQueryParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function aiQuery( - array|AIAIQueryParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = AIAIQueryParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'post', - path: 'brand/ai/query', - body: (object) $parsed, - options: $options, - convert: AIAIQueryResponse::class, - ); - } - /** * @api * diff --git a/src/Services/AIService.php b/src/Services/AIService.php index 187e24a..62949ac 100644 --- a/src/Services/AIService.php +++ b/src/Services/AIService.php @@ -4,9 +4,6 @@ namespace ContextDev\Services; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Client; @@ -16,8 +13,6 @@ use ContextDev\ServiceContracts\AIContract; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class AIService implements AIContract @@ -35,41 +30,6 @@ public function __construct(private Client $client) $this->raw = new AIRawService($client); } - /** - * @api - * - * Use AI to extract specific data points from a brand's website. The AI will crawl the website and extract the requested information based on the provided data points. - * - * @param list $dataToExtract Array of data points to extract from the website - * @param string $domain The domain name to analyze - * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function aiQuery( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): AIAIQueryResponse { - $params = Util::removeNulls( - [ - 'dataToExtract' => $dataToExtract, - 'domain' => $domain, - 'specificPages' => $specificPages, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->aiQuery(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - /** * @api * diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index a2aabbb..c6d80b7 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -4,22 +4,11 @@ namespace ContextDev\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByEmailParams; -use ContextDev\Brand\BrandRetrieveByIsinParams; -use ContextDev\Brand\BrandRetrieveByNameParams; -use ContextDev\Brand\BrandRetrieveByTickerParams; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; @@ -42,14 +31,25 @@ public function __construct(private Client $client) {} /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more from any domain + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. * * @param array{ * domain: string, + * type: Type|value-of, * forceLanguage?: value-of, * maxAgeMs?: int, * maxSpeed?: bool, * timeoutMs?: int, + * name: string, + * countryGl?: string, + * email: string, + * ticker: string, + * tickerExchange?: string, + * transactionInfo: string, + * city?: string, + * highConfidenceOnly?: bool, + * mcc?: int, + * phone?: float, * }|BrandRetrieveParams $params * @param RequestOpts|null $requestOptions * @@ -68,237 +68,14 @@ public function retrieve( // @phpstan-ignore-next-line return.type return $this->client->request( - method: 'get', + method: 'post', path: 'brand/retrieve', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), + body: (object) $parsed, options: $options, convert: BrandGetResponse::class, ); } - /** - * @api - * - * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. - * - * @param array{ - * transactionInfo: string, - * city?: string, - * countryGl?: value-of, - * forceLanguage?: value-of, - * highConfidenceOnly?: bool, - * maxSpeed?: bool, - * mcc?: string, - * phone?: float, - * timeoutMs?: int, - * }|BrandIdentifyFromTransactionParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function identifyFromTransaction( - array|BrandIdentifyFromTransactionParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandIdentifyFromTransactionParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/transaction_identifier', - query: Util::array_transform_keys( - $parsed, - [ - 'transactionInfo' => 'transaction_info', - 'countryGl' => 'country_gl', - 'forceLanguage' => 'force_language', - 'highConfidenceOnly' => 'high_confidence_only', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandIdentifyFromTransactionResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. - * - * @param array{ - * email: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByEmail( - array|BrandRetrieveByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByEmailParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-email', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), - options: $options, - convert: BrandGetByEmailResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using an ISIN (International Securities Identification Number). - * - * @param array{ - * isin: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByIsinParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByIsin( - array|BrandRetrieveByIsinParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByIsinParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-isin', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), - options: $options, - convert: BrandGetByIsinResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using a company name. - * - * @param array{ - * name: string, - * countryGl?: value-of, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByNameParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByName( - array|BrandRetrieveByNameParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByNameParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-name', - query: Util::array_transform_keys( - $parsed, - [ - 'countryGl' => 'country_gl', - 'forceLanguage' => 'force_language', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandGetByNameResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using a stock ticker symbol. - * - * @param array{ - * ticker: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * tickerExchange?: value-of, - * timeoutMs?: int, - * }|BrandRetrieveByTickerParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByTicker( - array|BrandRetrieveByTickerParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByTickerParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-ticker', - query: Util::array_transform_keys( - $parsed, - [ - 'forceLanguage' => 'force_language', - 'tickerExchange' => 'ticker_exchange', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandGetByTickerResponse::class, - ); - } - /** * @api * diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index f5f2944..58fa3da 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -4,16 +4,10 @@ namespace ContextDev\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; @@ -41,245 +35,70 @@ public function __construct(private Client $client) /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more from any domain + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. * - * @param string $domain Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. - * @param ForceLanguage|value-of $forceLanguage optional parameter to force the language of the retrieved brand data + * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). + * @param Type|value-of $type discriminator for transaction-based brand retrieval + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). + * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $transactionInfo transaction information to identify the brand + * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction + * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param string $city optional city name to prioritize when searching for the brand + * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence + * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param float $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $domain, + Type|string $type, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, + ?string $countryGl = null, + ?string $tickerExchange = null, + ?string $city = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, + ?float $phone = null, RequestOptions|array|null $requestOptions = null, ): BrandGetResponse { $params = Util::removeNulls( [ 'domain' => $domain, + 'type' => $type, 'forceLanguage' => $forceLanguage, 'maxAgeMs' => $maxAgeMs, 'maxSpeed' => $maxSpeed, 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. - * - * @param string $transactionInfo Transaction information to identify the brand - * @param string $city optional city name to prioritize when searching for the brand - * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry - * @param float $phone optional phone number from the transaction to help verify brand match - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function identifyFromTransaction( - string $transactionInfo, - ?string $city = null, - CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, - bool $highConfidenceOnly = false, - ?bool $maxSpeed = null, - ?string $mcc = null, - ?float $phone = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandIdentifyFromTransactionResponse { - $params = Util::removeNulls( - [ + 'name' => $name, + 'countryGl' => $countryGl, + 'email' => $email, + 'ticker' => $ticker, + 'tickerExchange' => $tickerExchange, 'transactionInfo' => $transactionInfo, 'city' => $city, - 'countryGl' => $countryGl, - 'forceLanguage' => $forceLanguage, 'highConfidenceOnly' => $highConfidenceOnly, - 'maxSpeed' => $maxSpeed, 'mcc' => $mcc, 'phone' => $phone, - 'timeoutMs' => $timeoutMs, ], ); // @phpstan-ignore-next-line argument.type - $response = $this->raw->identifyFromTransaction(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. - * - * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByEmail( - string $email, - \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByEmailResponse { - $params = Util::removeNulls( - [ - 'email' => $email, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByEmail(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using an ISIN (International Securities Identification Number). - * - * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByIsin( - string $isin, - \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByIsinResponse { - $params = Util::removeNulls( - [ - 'isin' => $isin, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByIsin(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using a company name. - * - * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name - * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByName( - string $name, - \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByNameResponse { - $params = Util::removeNulls( - [ - 'name' => $name, - 'countryGl' => $countryGl, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByName(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using a stock ticker symbol. - * - * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByTicker( - string $ticker, - \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByTickerResponse { - $params = Util::removeNulls( - [ - 'ticker' => $ticker, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'tickerExchange' => $tickerExchange, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByTicker(params: $params, requestOptions: $requestOptions); + $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php new file mode 100644 index 0000000..a0f78f9 --- /dev/null +++ b/src/Services/MonitorsRawService.php @@ -0,0 +1,441 @@ +, + * tags?: list, + * webhook?: Webhook|WebhookShape|null, + * }|MonitorCreateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|MonitorCreateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorCreateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'monitors', + body: (object) $parsed, + options: $options, + convert: MonitorNewResponse::class, + ); + } + + /** + * @api + * + * Get a monitor + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s', $monitorID], + options: $requestOptions, + convert: MonitorGetResponse::class, + ); + } + + /** + * @api + * + * Updates a monitor. If `target` or `change_detection` changes, the monitor creates a new baseline. Unsupported target/change detection combinations are rejected. + * + * @param array{ + * changeDetection?: ChangeDetectionShape1, + * name?: string, + * schedule?: MonitorUpdateParams\Schedule|ScheduleShape1, + * status?: Status|value-of, + * tags?: list, + * target?: TargetShape1, + * webhook?: MonitorUpdateParams\Webhook|WebhookShape1|null, + * }|MonitorUpdateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function update( + string $monitorID, + array|MonitorUpdateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorUpdateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'patch', + path: ['monitors/%1$s', $monitorID], + body: (object) $parsed, + options: $options, + convert: MonitorUpdateResponse::class, + ); + } + + /** + * @api + * + * Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`. + * + * @param array{ + * changeDetectionType?: ChangeDetectionType|value-of, + * cursor?: string, + * limit?: int, + * q?: string, + * searchBy?: list>, + * searchType?: SearchType|value-of, + * status?: MonitorListParams\Status|value-of, + * tag?: string, + * tags?: list, + * targetType?: TargetType|value-of, + * }|MonitorListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|MonitorListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors', + query: Util::array_transform_keys( + $parsed, + [ + 'changeDetectionType' => 'change_detection_type', + 'searchBy' => 'search_by', + 'searchType' => 'search_type', + 'targetType' => 'target_type', + ], + ), + options: $options, + convert: MonitorListResponse::class, + ); + } + + /** + * @api + * + * Delete a monitor + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['monitors/%1$s', $monitorID], + options: $requestOptions, + convert: MonitorDeleteResponse::class, + ); + } + + /** + * @api + * + * Returns an account-wide feed of detected changes across monitors. + * + * @param array{ + * changeDetectionType?: MonitorListAccountChangesParams\ChangeDetectionType|value-of, + * cursor?: string, + * limit?: int, + * monitorID?: string, + * since?: \DateTimeInterface, + * tag?: string, + * targetType?: MonitorListAccountChangesParams\TargetType|value-of, + * until?: \DateTimeInterface, + * }|MonitorListAccountChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountChanges( + array|MonitorListAccountChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListAccountChangesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/changes', + query: Util::array_transform_keys( + $parsed, + [ + 'changeDetectionType' => 'change_detection_type', + 'monitorID' => 'monitor_id', + 'targetType' => 'target_type', + ], + ), + options: $options, + convert: MonitorListAccountChangesResponse::class, + ); + } + + /** + * @api + * + * Returns an account-wide feed of monitor runs across all monitors. + * + * @param array{ + * cursor?: string, + * limit?: int, + * status?: MonitorListAccountRunsParams\Status|value-of, + * }|MonitorListAccountRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountRuns( + array|MonitorListAccountRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListAccountRunsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/runs', + query: $parsed, + options: $options, + convert: MonitorListAccountRunsResponse::class, + ); + } + + /** + * @api + * + * List changes for a monitor + * + * @param array{ + * cursor?: string, + * limit?: int, + * since?: \DateTimeInterface, + * tag?: string, + * until?: \DateTimeInterface, + * }|MonitorListChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + array|MonitorListChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListChangesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s/changes', $monitorID], + query: $parsed, + options: $options, + convert: MonitorListChangesResponse::class, + ); + } + + /** + * @api + * + * List monitor runs + * + * @param array{ + * cursor?: string, + * limit?: int, + * status?: MonitorListRunsParams\Status|value-of, + * }|MonitorListRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + array|MonitorListRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListRunsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s/runs', $monitorID], + query: $parsed, + options: $options, + convert: MonitorListRunsResponse::class, + ); + } + + /** + * @api + * + * Get a change + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/changes/%1$s', $changeID], + options: $requestOptions, + convert: MonitorGetChangeResponse::class, + ); + } + + /** + * @api + * + * Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously. + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['monitors/%1$s/run', $monitorID], + options: $requestOptions, + convert: MonitorRunResponse::class, + ); + } +} diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php new file mode 100644 index 0000000..571f0cb --- /dev/null +++ b/src/Services/MonitorsService.php @@ -0,0 +1,408 @@ +raw = new MonitorsRawService($client); + } + + /** + * @api + * + * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. + * + * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected + * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param TargetShape $target discriminated union describing what the monitor watches + * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param Webhook|WebhookShape|null $webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function create( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + string $name, + Schedule|array $schedule, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorNewResponse { + $params = Util::removeNulls( + [ + 'changeDetection' => $changeDetection, + 'name' => $name, + 'schedule' => $schedule, + 'target' => $target, + 'mode' => $mode, + 'tags' => $tags, + 'webhook' => $webhook, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->create(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Get a monitor + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorGetResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Updates a monitor. If `target` or `change_detection` changes, the monitor creates a new baseline. Unsupported target/change detection combinations are rejected. + * + * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected + * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param Status|value-of $status + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param TargetShape1 $target discriminated union describing what the monitor watches + * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function update( + string $monitorID, + \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection|array|\ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + \ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget|array|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorUpdateResponse { + $params = Util::removeNulls( + [ + 'changeDetection' => $changeDetection, + 'name' => $name, + 'schedule' => $schedule, + 'status' => $status, + 'tags' => $tags, + 'target' => $target, + 'webhook' => $webhook, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->update($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param string $q free-text search term, matched against the fields named in `search_by` + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * @param string $tag filter to items that have this tag + * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) + * @param TargetType|value-of $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $q = null, + ?array $searchBy = null, + SearchType|string $searchType = 'prefix', + \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, + ?string $tag = null, + ?array $tags = null, + TargetType|string|null $targetType = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListResponse { + $params = Util::removeNulls( + [ + 'changeDetectionType' => $changeDetectionType, + 'cursor' => $cursor, + 'limit' => $limit, + 'q' => $q, + 'searchBy' => $searchBy, + 'searchType' => $searchType, + 'status' => $status, + 'tag' => $tag, + 'tags' => $tags, + 'targetType' => $targetType, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Delete a monitor + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorDeleteResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns an account-wide feed of detected changes across monitors. + * + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param string $tag filter to items that have this tag + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountChanges( + \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountChangesResponse { + $params = Util::removeNulls( + [ + 'changeDetectionType' => $changeDetectionType, + 'cursor' => $cursor, + 'limit' => $limit, + 'monitorID' => $monitorID, + 'since' => $since, + 'tag' => $tag, + 'targetType' => $targetType, + 'until' => $until, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listAccountChanges(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns an account-wide feed of monitor runs across all monitors. + * + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountRuns( + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountRunsResponse { + $params = Util::removeNulls( + ['cursor' => $cursor, 'limit' => $limit, 'status' => $status] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listAccountRuns(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List changes for a monitor + * + * @param string $tag filter to items that have this tag + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListChangesResponse { + $params = Util::removeNulls( + [ + 'cursor' => $cursor, + 'limit' => $limit, + 'since' => $since, + 'tag' => $tag, + 'until' => $until, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listChanges($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List monitor runs + * + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListRunsResponse { + $params = Util::removeNulls( + ['cursor' => $cursor, 'limit' => $limit, 'status' => $status] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listRuns($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Get a change + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): MonitorGetChangeResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveChange($changeID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously. + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorRunResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->run($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php index fb7fc71..7030cad 100644 --- a/src/Services/UtilityRawService.php +++ b/src/Services/UtilityRawService.php @@ -9,12 +9,12 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityRawContract; -use ContextDev\Utility\UtilityPrefetchByEmailParams; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchParams; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class UtilityRawService implements UtilityRawContract @@ -28,9 +28,11 @@ public function __construct(private Client $client) {} /** * @api * - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param array{domain: string, timeoutMs?: int}|UtilityPrefetchParams $params + * @param array{ + * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int + * }|UtilityPrefetchParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -49,43 +51,10 @@ public function prefetch( // @phpstan-ignore-next-line return.type return $this->client->request( method: 'post', - path: 'brand/prefetch', + path: 'utility/prefetch', body: (object) $parsed, options: $options, convert: UtilityPrefetchResponse::class, ); } - - /** - * @api - * - * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. - * - * @param array{ - * email: string, timeoutMs?: int - * }|UtilityPrefetchByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function prefetchByEmail( - array|UtilityPrefetchByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = UtilityPrefetchByEmailParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'post', - path: 'brand/prefetch-by-email', - body: (object) $parsed, - options: $options, - convert: UtilityPrefetchByEmailResponse::class, - ); - } } diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index ff11a92..8ea4db9 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -9,10 +9,13 @@ use ContextDev\Core\Util; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityContract; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class UtilityService implements UtilityContract @@ -33,21 +36,23 @@ public function __construct(private Client $client) /** * @api * - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param string $domain Domain name to prefetch brand data for + * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function prefetch( - string $domain, + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, + Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse { $params = Util::removeNulls( - ['domain' => $domain, 'timeoutMs' => $timeoutMs] + ['identifier' => $identifier, 'type' => $type, 'timeoutMs' => $timeoutMs] ); // @phpstan-ignore-next-line argument.type @@ -55,28 +60,4 @@ public function prefetch( return $response->parse(); } - - /** - * @api - * - * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. - * - * @param string $email Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function prefetchByEmail( - string $email, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): UtilityPrefetchByEmailResponse { - $params = Util::removeNulls(['email' => $email, 'timeoutMs' => $timeoutMs]); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->prefetchByEmail(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } } diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 1464af2..94f84b7 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -321,6 +321,7 @@ public function search( * maxDepth?: int, * maxPages?: int, * pdf?: WebWebCrawlMdParams\Pdf|PdfShape1, + * settleAnimations?: bool, * shortenBase64Images?: bool, * stopAfterMs?: int, * timeoutMs?: int, @@ -367,6 +368,7 @@ public function webCrawlMd( * includeSelectors?: list, * maxAgeMs?: int, * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, + * settleAnimations?: bool, * timeoutMs?: int, * useMainContentOnly?: bool, * waitForMs?: int, @@ -403,6 +405,7 @@ public function webScrapeHTML( * * @param array{ * url: string, + * dedupe?: bool, * enrichment?: Enrichment|EnrichmentShape, * headers?: array, * maxAgeMs?: int, @@ -450,6 +453,7 @@ public function webScrapeImages( * includeSelectors?: list, * maxAgeMs?: int, * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, + * settleAnimations?: bool, * shortenBase64Images?: bool, * timeoutMs?: int, * useMainContentOnly?: bool, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index c7ad6ad..0ac922c 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -349,6 +349,7 @@ public function search( * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -374,6 +375,7 @@ public function webCrawlMd( \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, ?int $timeoutMs = null, @@ -396,6 +398,7 @@ public function webCrawlMd( 'maxDepth' => $maxDepth, 'maxPages' => $maxPages, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, 'stopAfterMs' => $stopAfterMs, 'timeoutMs' => $timeoutMs, @@ -424,6 +427,7 @@ public function webCrawlMd( * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -442,6 +446,7 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -457,6 +462,7 @@ public function webScrapeHTML( 'includeSelectors' => $includeSelectors, 'maxAgeMs' => $maxAgeMs, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, @@ -475,6 +481,7 @@ public function webScrapeHTML( * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -486,6 +493,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, @@ -496,6 +504,7 @@ public function webScrapeImages( $params = Util::removeNulls( [ 'url' => $url, + 'dedupe' => $dedupe, 'enrichment' => $enrichment, 'headers' => $headers, 'maxAgeMs' => $maxAgeMs, @@ -525,6 +534,7 @@ public function webScrapeImages( * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation @@ -546,6 +556,7 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, ?int $timeoutMs = null, bool $useMainContentOnly = false, @@ -564,6 +575,7 @@ public function webScrapeMd( 'includeSelectors' => $includeSelectors, 'maxAgeMs' => $maxAgeMs, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, diff --git a/src/Utility/UtilityPrefetchByEmailParams.php b/src/Utility/UtilityPrefetchByEmailParams.php deleted file mode 100644 index 60fc4dc..0000000 --- a/src/Utility/UtilityPrefetchByEmailParams.php +++ /dev/null @@ -1,96 +0,0 @@ - */ - use SdkModel; - use SdkParams; - - /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - #[Required] - public string $email; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional('timeoutMS')] - public ?int $timeoutMs; - - /** - * `new UtilityPrefetchByEmailParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * UtilityPrefetchByEmailParams::with(email: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new UtilityPrefetchByEmailParams)->withEmail(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $email, ?int $timeoutMs = null): self - { - $self = new self; - - $self['email'] = $email; - - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchByEmailResponse.php b/src/Utility/UtilityPrefetchByEmailResponse.php deleted file mode 100644 index cc7f237..0000000 --- a/src/Utility/UtilityPrefetchByEmailResponse.php +++ /dev/null @@ -1,124 +0,0 @@ - */ - use SdkModel; - - /** - * The domain that was queued for prefetching. - */ - #[Optional] - public ?string $domain; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Success message. - */ - #[Optional] - public ?string $message; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - ?string $domain = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $message = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $domain && $self['domain'] = $domain; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $message && $self['message'] = $message; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * The domain that was queued for prefetching. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Success message. - */ - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php b/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php deleted file mode 100644 index 9966c76..0000000 --- a/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index 80ccac2..0082269 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -9,14 +9,20 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; /** - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @see ContextDev\Services\UtilityService::prefetch() * + * @phpstan-import-type IdentifierVariants from \ContextDev\Utility\UtilityPrefetchParams\Identifier + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier + * * @phpstan-type UtilityPrefetchParamsShape = array{ - * domain: string, timeoutMs?: int|null + * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int|null * } */ final class UtilityPrefetchParams implements BaseModel @@ -26,10 +32,20 @@ final class UtilityPrefetchParams implements BaseModel use SdkParams; /** - * Domain name to prefetch brand data for. + * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * + * @var IdentifierVariants $identifier */ #[Required] - public string $domain; + public UtilityPrefetchDomainIdentifier|UtilityPrefetchEmailIdentifier $identifier; + + /** + * What to prefetch. Currently only 'brand' is supported. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -42,13 +58,13 @@ final class UtilityPrefetchParams implements BaseModel * * To enforce required parameters use * ``` - * UtilityPrefetchParams::with(domain: ...) + * UtilityPrefetchParams::with(identifier: ..., type: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new UtilityPrefetchParams)->withDomain(...) + * (new UtilityPrefetchParams)->withIdentifier(...)->withType(...) * ``` */ public function __construct() @@ -60,12 +76,19 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param IdentifierShape $identifier + * @param Type|value-of $type */ - public static function with(string $domain, ?int $timeoutMs = null): self - { + public static function with( + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, + Type|string $type, + ?int $timeoutMs = null, + ): self { $self = new self; - $self['domain'] = $domain; + $self['identifier'] = $identifier; + $self['type'] = $type; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -73,12 +96,28 @@ public static function with(string $domain, ?int $timeoutMs = null): self } /** - * Domain name to prefetch brand data for. + * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * + * @param IdentifierShape $identifier + */ + public function withIdentifier( + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, + ): self { + $self = clone $this; + $self['identifier'] = $identifier; + + return $self; + } + + /** + * What to prefetch. Currently only 'brand' is supported. + * + * @param Type|value-of $type */ - public function withDomain(string $domain): self + public function withType(Type|string $type): self { $self = clone $this; - $self['domain'] = $domain; + $self['type'] = $type; return $self; } diff --git a/src/Utility/UtilityPrefetchParams/Identifier.php b/src/Utility/UtilityPrefetchParams/Identifier.php new file mode 100644 index 0000000..1fdb5ab --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier.php @@ -0,0 +1,36 @@ +|array + */ + public static function variants(): array + { + return [ + UtilityPrefetchDomainIdentifier::class, + UtilityPrefetchEmailIdentifier::class, + ]; + } +} diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php new file mode 100644 index 0000000..615f897 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + /** + * Domain name to prefetch brand data for. + */ + #[Required] + public string $domain; + + /** + * `new UtilityPrefetchDomainIdentifier()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchDomainIdentifier::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchDomainIdentifier)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $domain): self + { + $self = new self; + + $self['domain'] = $domain; + + return $self; + } + + /** + * Domain name to prefetch brand data for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php new file mode 100644 index 0000000..44142c3 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + #[Required] + public string $email; + + /** + * `new UtilityPrefetchEmailIdentifier()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchEmailIdentifier::with(email: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchEmailIdentifier)->withEmail(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $email): self + { + $self = new self; + + $self['email'] = $email; + + return $self; + } + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchParams/Type.php b/src/Utility/UtilityPrefetchParams/Type.php new file mode 100644 index 0000000..79bdffa --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Type.php @@ -0,0 +1,13 @@ +, * } */ final class UtilityPrefetchResponse implements BaseModel @@ -48,6 +50,14 @@ final class UtilityPrefetchResponse implements BaseModel #[Optional] public ?string $status; + /** + * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + public function __construct() { $this->initialize(); @@ -59,12 +69,14 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param Type|value-of|null $type */ public static function with( ?string $domain = null, KeyMetadata|array|null $keyMetadata = null, ?string $message = null, ?string $status = null, + Type|string|null $type = null, ): self { $self = new self; @@ -72,6 +84,7 @@ public static function with( null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $message && $self['message'] = $message; null !== $status && $self['status'] = $status; + null !== $type && $self['type'] = $type; return $self; } @@ -121,4 +134,17 @@ public function withStatus(string $status): self return $self; } + + /** + * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } } diff --git a/src/Utility/UtilityPrefetchResponse/Type.php b/src/Utility/UtilityPrefetchResponse/Type.php new file mode 100644 index 0000000..b127055 --- /dev/null +++ b/src/Utility/UtilityPrefetchResponse/Type.php @@ -0,0 +1,13 @@ +withMaxCrawlDepth(...) + * ->withNumBlocked(...) * ->withNumFailed(...) * ->withNumSkipped(...) * ->withNumSucceeded(...) @@ -74,6 +83,7 @@ public function __construct() */ public static function with( int $maxCrawlDepth, + int $numBlocked, int $numFailed, int $numSkipped, int $numSucceeded, @@ -82,6 +92,7 @@ public static function with( $self = new self; $self['maxCrawlDepth'] = $maxCrawlDepth; + $self['numBlocked'] = $numBlocked; $self['numFailed'] = $numFailed; $self['numSkipped'] = $numSkipped; $self['numSucceeded'] = $numSucceeded; @@ -98,6 +109,17 @@ public function withMaxCrawlDepth(int $maxCrawlDepth): self return $self; } + /** + * Number of crawled pages excluded because they were anti-bot challenges, error pages, or parked-domain placeholders. + */ + public function withNumBlocked(int $numBlocked): self + { + $self = clone $this; + $self['numBlocked'] = $numBlocked; + + return $self; + } + public function withNumFailed(int $numFailed): self { $self = clone $this; diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index d08a8bd..d89de93 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -32,6 +32,7 @@ * maxDepth?: int|null, * maxPages?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, * stopAfterMs?: int|null, * timeoutMs?: int|null, @@ -124,6 +125,12 @@ final class WebWebCrawlMdParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Truncate base64-encoded image data in the Markdown output. */ @@ -202,6 +209,7 @@ public static function with( ?int $maxDepth = null, ?int $maxPages = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, ?int $stopAfterMs = null, ?int $timeoutMs = null, @@ -224,6 +232,7 @@ public static function with( null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -374,6 +383,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Truncate base64-encoded image data in the Markdown output. */ diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index 785afc2..a37ee58 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -28,6 +28,7 @@ * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, * waitForMs?: int|null, @@ -95,6 +96,12 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -152,6 +159,7 @@ public static function with( ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, ?int $waitForMs = null, @@ -167,6 +175,7 @@ public static function with( null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -272,6 +281,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeHTMLResponse.php b/src/Web/WebWebScrapeHTMLResponse.php index cb950aa..12aab0e 100644 --- a/src/Web/WebWebScrapeHTMLResponse.php +++ b/src/Web/WebWebScrapeHTMLResponse.php @@ -49,7 +49,7 @@ final class WebWebScrapeHTMLResponse implements BaseModel public bool $success; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. * * @var value-of $type */ @@ -160,7 +160,7 @@ public function withSuccess(bool $success): self } /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. * * @param Type|value-of $type */ diff --git a/src/Web/WebWebScrapeHTMLResponse/Type.php b/src/Web/WebWebScrapeHTMLResponse/Type.php index fab93ab..84a4f8b 100644 --- a/src/Web/WebWebScrapeHTMLResponse/Type.php +++ b/src/Web/WebWebScrapeHTMLResponse/Type.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLResponse; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. */ enum Type: string { @@ -28,4 +28,12 @@ enum Type: string case DOCX = 'docx'; case DOC = 'doc'; + + case XLSX = 'xlsx'; + + case XLS = 'xls'; + + case PPTX = 'pptx'; + + case PPT = 'ppt'; } diff --git a/src/Web/WebWebScrapeImagesParams.php b/src/Web/WebWebScrapeImagesParams.php index eb4932c..92c8710 100644 --- a/src/Web/WebWebScrapeImagesParams.php +++ b/src/Web/WebWebScrapeImagesParams.php @@ -20,6 +20,7 @@ * * @phpstan-type WebWebScrapeImagesParamsShape = array{ * url: string, + * dedupe?: bool|null, * enrichment?: null|Enrichment|EnrichmentShape, * headers?: array|null, * maxAgeMs?: int|null, @@ -39,6 +40,12 @@ final class WebWebScrapeImagesParams implements BaseModel #[Required] public string $url; + /** + * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + */ + #[Optional] + public ?bool $dedupe; + /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. */ @@ -100,6 +107,7 @@ public function __construct() */ public static function with( string $url, + ?bool $dedupe = null, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = null, @@ -110,6 +118,7 @@ public static function with( $self['url'] = $url; + null !== $dedupe && $self['dedupe'] = $dedupe; null !== $enrichment && $self['enrichment'] = $enrichment; null !== $headers && $self['headers'] = $headers; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; @@ -130,6 +139,17 @@ public function withURL(string $url): self return $self; } + /** + * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + */ + public function withDedupe(bool $dedupe): self + { + $self = clone $this; + $self['dedupe'] = $dedupe; + + return $self; + } + /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. * diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 54f2cc7..5b36e1e 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -30,6 +30,7 @@ * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, @@ -110,6 +111,12 @@ final class WebWebScrapeMdParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Shorten base64-encoded image data in the Markdown output. */ @@ -175,6 +182,7 @@ public static function with( ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, @@ -193,6 +201,7 @@ public static function with( null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; @@ -321,6 +330,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Shorten base64-encoded image data in the Markdown output. */ diff --git a/tests/ClientTest.php b/tests/ClientTest.php index a7109cb..d854fd5 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -32,7 +32,14 @@ public function testDefaultHeaders(): void requestOptions: ['transporter' => $transporter], ); - $client->brand->retrieve(domain: 'domain'); + $client->brand->retrieve( + domain: 'domain', + type: 'by_transaction', + name: 'xxx', + email: 'dev@stainless.com', + ticker: 'ticker', + transactionInfo: 'xxx', + ); $this->assertNotFalse($requested = $transporter->getRequests()[0] ?? false); diff --git a/tests/Services/AITest.php b/tests/Services/AITest.php index 9295e6c..eff078e 100644 --- a/tests/Services/AITest.php +++ b/tests/Services/AITest.php @@ -2,7 +2,6 @@ namespace Tests\Services; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Client; @@ -30,68 +29,6 @@ protected function setUp(): void $this->client = $client; } - #[Test] - public function testAIQuery(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->ai->aiQuery( - dataToExtract: [ - [ - 'datapointDescription' => 'datapoint_description', - 'datapointExample' => 'datapoint_example', - 'datapointName' => 'datapoint_name', - 'datapointType' => 'text', - ], - ], - domain: 'domain', - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(AIAIQueryResponse::class, $result); - } - - #[Test] - public function testAIQueryWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->ai->aiQuery( - dataToExtract: [ - [ - 'datapointDescription' => 'datapoint_description', - 'datapointExample' => 'datapoint_example', - 'datapointName' => 'datapoint_name', - 'datapointType' => 'text', - 'datapointListType' => 'string', - 'datapointObjectSchema' => [ - 'testimonial_text' => 'string', 'testimonial_author' => 'string', - ], - ], - ], - domain: 'domain', - specificPages: [ - 'aboutUs' => true, - 'blog' => true, - 'careers' => true, - 'contactUs' => true, - 'faq' => true, - 'homePage' => true, - 'pricing' => true, - 'privacyPolicy' => true, - 'termsAndConditions' => true, - ], - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(AIAIQueryResponse::class, $result); - } - #[Test] public function testExtractProduct(): void { diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index 8f0dadb..fdb0f1e 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -2,13 +2,8 @@ namespace Tests\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; use ContextDev\Client; use ContextDev\Core\Util; use PHPUnit\Framework\Attributes\CoversNothing; @@ -41,7 +36,14 @@ public function testRetrieve(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->brand->retrieve(domain: 'domain'); + $result = $this->client->brand->retrieve( + domain: 'domain', + type: 'by_transaction', + name: 'xxx', + email: 'dev@stainless.com', + ticker: 'ticker', + transactionInfo: 'xxx', + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(BrandGetResponse::class, $result); @@ -56,188 +58,25 @@ public function testRetrieveWithOptionalParams(): void $result = $this->client->brand->retrieve( domain: 'domain', + type: 'by_transaction', forceLanguage: 'afrikaans', - maxAgeMs: 86400000, + maxAgeMs: 0, maxSpeed: true, timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetResponse::class, $result); - } - - #[Test] - public function testIdentifyFromTransaction(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->identifyFromTransaction( - transactionInfo: 'transaction_info' - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf( - BrandIdentifyFromTransactionResponse::class, - $result - ); - } - - #[Test] - public function testIdentifyFromTransactionWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->identifyFromTransaction( - transactionInfo: 'transaction_info', + name: 'xxx', + countryGl: 'country_gl', + email: 'dev@stainless.com', + ticker: 'ticker', + tickerExchange: 'ticker_exchange', + transactionInfo: 'xxx', city: 'city', - countryGl: 'ad', - forceLanguage: 'afrikaans', highConfidenceOnly: true, - maxSpeed: true, - mcc: 'mcc', + mcc: 0, phone: 0, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf( - BrandIdentifyFromTransactionResponse::class, - $result - ); - } - - #[Test] - public function testRetrieveByEmail(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByEmail(email: 'dev@stainless.com'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); - } - - #[Test] - public function testRetrieveByEmailWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByEmail( - email: 'dev@stainless.com', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); - } - - #[Test] - public function testRetrieveByIsin(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByIsin(isin: 'SE60513A9993'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); - } - - #[Test] - public function testRetrieveByIsinWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByIsin( - isin: 'SE60513A9993', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); - } - - #[Test] - public function testRetrieveByName(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByName(name: 'xxx'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByNameResponse::class, $result); - } - - #[Test] - public function testRetrieveByNameWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByName( - name: 'xxx', - countryGl: 'ad', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByNameResponse::class, $result); - } - - #[Test] - public function testRetrieveByTicker(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByTicker(ticker: 'ticker'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); - } - - #[Test] - public function testRetrieveByTickerWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByTicker( - ticker: 'ticker', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - tickerExchange: 'AMEX', - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); + $this->assertInstanceOf(BrandGetResponse::class, $result); } #[Test] diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php new file mode 100644 index 0000000..ede6963 --- /dev/null +++ b/tests/Services/MonitorsTest.php @@ -0,0 +1,213 @@ +client = $client; + } + + #[Test] + public function testCreate(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->create( + changeDetection: ['type' => 'exact'], + name: 'Acme pricing page', + schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], + target: ['type' => 'page', 'url' => 'https://acme.com/pricing'], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorNewResponse::class, $result); + } + + #[Test] + public function testCreateWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->create( + changeDetection: ['type' => 'exact'], + name: 'Acme pricing page', + schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], + target: [ + 'type' => 'page', + 'url' => 'https://acme.com/pricing', + 'normalizeWhitespace' => true, + ], + mode: 'web', + tags: ['pricing', 'competitor'], + webhook: ['url' => 'https://example.com/webhook'], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorNewResponse::class, $result); + } + + #[Test] + public function testRetrieve(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->retrieve('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorGetResponse::class, $result); + } + + #[Test] + public function testUpdate(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->update('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorUpdateResponse::class, $result); + } + + #[Test] + public function testList(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->list(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListResponse::class, $result); + } + + #[Test] + public function testDelete(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->delete('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorDeleteResponse::class, $result); + } + + #[Test] + public function testListAccountChanges(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listAccountChanges(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListAccountChangesResponse::class, $result); + } + + #[Test] + public function testListAccountRuns(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listAccountRuns(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListAccountRunsResponse::class, $result); + } + + #[Test] + public function testListChanges(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listChanges('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListChangesResponse::class, $result); + } + + #[Test] + public function testListRuns(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listRuns('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListRunsResponse::class, $result); + } + + #[Test] + public function testRetrieveChange(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->retrieveChange('chg_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorGetChangeResponse::class, $result); + } + + #[Test] + public function testRun(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->run('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorRunResponse::class, $result); + } +} diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php index 8f236c5..f59410a 100644 --- a/tests/Services/UtilityTest.php +++ b/tests/Services/UtilityTest.php @@ -4,7 +4,6 @@ use ContextDev\Client; use ContextDev\Core\Util; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchResponse; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\Test; @@ -36,7 +35,10 @@ public function testPrefetch(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->utility->prefetch(domain: 'domain'); + $result = $this->client->utility->prefetch( + identifier: ['domain' => 'domain'], + type: 'brand' + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); @@ -50,42 +52,12 @@ public function testPrefetchWithOptionalParams(): void } $result = $this->client->utility->prefetch( - domain: 'domain', + identifier: ['domain' => 'domain'], + type: 'brand', timeoutMs: 1000 ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); } - - #[Test] - public function testPrefetchByEmail(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->utility->prefetchByEmail( - email: 'dev@stainless.com' - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); - } - - #[Test] - public function testPrefetchByEmailWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->utility->prefetchByEmail( - email: 'dev@stainless.com', - timeoutMs: 1000 - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); - } } diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 55fa08d..6c2ca76 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -240,6 +240,7 @@ public function testWebCrawlMdWithOptionalParams(): void maxDepth: 0, maxPages: 1, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, shortenBase64Images: true, stopAfterMs: 10000, timeoutMs: 1000, @@ -281,6 +282,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void includeSelectors: ['string'], maxAgeMs: 0, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, timeoutMs: 1000, useMainContentOnly: true, waitForMs: 0, @@ -312,6 +314,7 @@ public function testWebScrapeImagesWithOptionalParams(): void $result = $this->client->web->webScrapeImages( url: 'https://example.com', + dedupe: true, enrichment: [ 'classification' => true, 'hostedURL' => true, @@ -359,6 +362,7 @@ public function testWebScrapeMdWithOptionalParams(): void includeSelectors: ['string'], maxAgeMs: 0, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, shortenBase64Images: true, timeoutMs: 1000, useMainContentOnly: true,