diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0746cbe..e6eadb4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.12.0" + ".": "2.13.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ad6cd80..9aabd7d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2c3f4e4b357ca78c019a3aacd006e2bb8b332d4172a300ee6c46c076a216ed3f.yml -openapi_spec_hash: b89be415cf6ee594b521885a9deb25ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-dc61df29e1b6282f9df685fadd65f3683afe352deccae94d0c080092e0eae4b3.yml +openapi_spec_hash: 258caa98cd0de5f7149f6937d071c912 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5429142..f651bcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 2.13.0 (2026-08-27) + +Full Changelog: [v2.12.0...v2.13.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.12.0...v2.13.0) + +### Features + +* **api:** api update ([171e0a4](https://github.com/context-dot-dev/context-php-sdk/commit/171e0a46709a9ca96179d7ccd149b3c949ba3e32)) +* **api:** api update ([8254251](https://github.com/context-dot-dev/context-php-sdk/commit/8254251acb0d5a1c933ae6978ab2710cf1163b8a)) + ## 2.12.0 (2026-08-23) Full Changelog: [v2.11.0...v2.12.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.11.0...v2.12.0) diff --git a/README.md b/README.md index be5e105..5577a7c 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 2.12.0" +composer require "context-dev/context-dev-php 2.13.0" ``` @@ -32,7 +32,7 @@ $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); $brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); -var_dump($brand->brand); +var_dump($brand->cache_metadata); ``` ### Value Objects diff --git a/src/AI/AIExtractProductResponse.php b/src/AI/AIExtractProductResponse.php index 07f9605..e99b990 100644 --- a/src/AI/AIExtractProductResponse.php +++ b/src/AI/AIExtractProductResponse.php @@ -4,18 +4,22 @@ namespace ContextDev\AI; +use ContextDev\AI\AIExtractProductResponse\CacheMetadata; use ContextDev\AI\AIExtractProductResponse\KeyMetadata; use ContextDev\AI\AIExtractProductResponse\Platform; use ContextDev\AI\AIExtractProductResponse\Product; use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CacheMetadataShape from \ContextDev\AI\AIExtractProductResponse\CacheMetadata * @phpstan-import-type KeyMetadataShape from \ContextDev\AI\AIExtractProductResponse\KeyMetadata * @phpstan-import-type ProductShape from \ContextDev\AI\AIExtractProductResponse\Product * * @phpstan-type AIExtractProductResponseShape = array{ + * cacheMetadata: CacheMetadata|CacheMetadataShape, * isProductPage?: bool|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * platform?: null|Platform|value-of, @@ -27,6 +31,12 @@ final class AIExtractProductResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Whether the given URL is a product detail page. */ @@ -53,6 +63,20 @@ final class AIExtractProductResponse implements BaseModel #[Optional(nullable: true)] public ?Product $product; + /** + * `new AIExtractProductResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -63,11 +87,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param Platform|value-of|null $platform * @param Product|ProductShape|null $product */ public static function with( + CacheMetadata|array $cacheMetadata, ?bool $isProductPage = null, KeyMetadata|array|null $keyMetadata = null, Platform|string|null $platform = null, @@ -75,6 +101,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $isProductPage && $self['isProductPage'] = $isProductPage; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $platform && $self['platform'] = $platform; @@ -83,6 +111,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Whether the given URL is a product detail page. */ diff --git a/src/AI/AIExtractProductResponse/CacheMetadata.php b/src/AI/AIExtractProductResponse/CacheMetadata.php new file mode 100644 index 0000000..5ceeffa --- /dev/null +++ b/src/AI/AIExtractProductResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse/CacheMetadata/Status.php b/src/AI/AIExtractProductResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..c487aef --- /dev/null +++ b/src/AI/AIExtractProductResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +|null, * } @@ -24,6 +28,12 @@ final class AIExtractProductsResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * 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. */ @@ -38,6 +48,20 @@ final class AIExtractProductsResponse implements BaseModel #[Optional(list: Product::class)] public ?array $products; + /** + * `new AIExtractProductsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductsResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductsResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -48,21 +72,38 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param list|null $products */ public static function with( + CacheMetadata|array $cacheMetadata, KeyMetadata|array|null $keyMetadata = null, - ?array $products = null + ?array $products = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $products && $self['products'] = $products; return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + 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. * diff --git a/src/AI/AIExtractProductsResponse/CacheMetadata.php b/src/AI/AIExtractProductsResponse/CacheMetadata.php new file mode 100644 index 0000000..3bee8ec --- /dev/null +++ b/src/AI/AIExtractProductsResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php b/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..50901c3 --- /dev/null +++ b/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +withCacheMetadata(...) * ->withFinalURL(...) * ->withHTTPStatus(...) * ->withMetadata(...) @@ -125,10 +137,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param array|null $meta */ public static function with( + CacheMetadata|array $cacheMetadata, string $finalURL, ?int $httpStatus, Metadata|array $metadata, @@ -141,6 +155,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['finalURL'] = $finalURL; $self['httpStatus'] = $httpStatus; $self['metadata'] = $metadata; @@ -155,6 +170,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * URL the content was read from, after redirects. */ diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php new file mode 100644 index 0000000..643a136 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php new file mode 100644 index 0000000..ae97dbe --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +withID(...) + * ->withCacheMetadata(...) * ->withCrawl(...) * ->withCreatedAt(...) * ->withCredits(...) @@ -169,6 +180,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits * @param Format|value-of $format @@ -181,6 +193,7 @@ public function __construct() */ public static function with( string $id, + CacheMetadata|array $cacheMetadata, CrawlControls|array|null $crawl, string $createdAt, Credits|array $credits, @@ -196,6 +209,7 @@ public static function with( $self = new self; $self['id'] = $id; + $self['cacheMetadata'] = $cacheMetadata; $self['crawl'] = $crawl; $self['createdAt'] = $createdAt; $self['credits'] = $credits; @@ -223,6 +237,19 @@ public function withID(string $id): self return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. * diff --git a/src/Batch/BatchSubmitResponse/CacheMetadata.php b/src/Batch/BatchSubmitResponse/CacheMetadata.php new file mode 100644 index 0000000..92da327 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/CacheMetadata.php @@ -0,0 +1,103 @@ +, + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required( + enum: Status::class + )] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with( + int $ageMs, + Status|string $status, + ): self { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php b/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..68d3c53 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Detailed brand information. */ @@ -50,6 +60,20 @@ final class BrandGetResponse implements BaseModel #[Optional] public ?string $status; + /** + * `new BrandGetResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandGetResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandGetResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -60,10 +84,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Brand|BrandShape|null $brand * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Brand|array|null $brand = null, ?int $code = null, KeyMetadata|array|null $keyMetadata = null, @@ -71,6 +97,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $brand && $self['brand'] = $brand; null !== $code && $self['code'] = $code; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -79,6 +107,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Detailed brand information. * diff --git a/src/Brand/BrandGetResponse/Brand.php b/src/Brand/BrandGetResponse/Brand.php index a540ecf..6acb0b9 100644 --- a/src/Brand/BrandGetResponse/Brand.php +++ b/src/Brand/BrandGetResponse/Brand.php @@ -121,7 +121,7 @@ final class Brand implements BaseModel public ?Links $links; /** - * An array of logos associated with the brand. + * An array of logos associated with the brand. When a similarly shaped SVG variant exists, it is returned ahead of its raster equivalent; otherwise relevance order is preserved. * * @var list|null $logos */ @@ -354,7 +354,7 @@ public function withLinks(Links|array $links): self } /** - * An array of logos associated with the brand. + * An array of logos associated with the brand. When a similarly shaped SVG variant exists, it is returned ahead of its raster equivalent; otherwise relevance order is preserved. * * @param list $logos */ diff --git a/src/Brand/BrandGetResponse/CacheMetadata.php b/src/Brand/BrandGetResponse/CacheMetadata.php new file mode 100644 index 0000000..b7a530a --- /dev/null +++ b/src/Brand/BrandGetResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/CacheMetadata/Status.php b/src/Brand/BrandGetResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..e36f6c0 --- /dev/null +++ b/src/Brand/BrandGetResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Simplified brand information. */ @@ -50,6 +60,20 @@ final class BrandGetSimplifiedResponse implements BaseModel #[Optional] public ?string $status; + /** + * `new BrandGetSimplifiedResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandGetSimplifiedResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandGetSimplifiedResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -60,10 +84,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Brand|BrandShape|null $brand * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Brand|array|null $brand = null, ?int $code = null, KeyMetadata|array|null $keyMetadata = null, @@ -71,6 +97,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $brand && $self['brand'] = $brand; null !== $code && $self['code'] = $code; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -79,6 +107,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Simplified brand information. * diff --git a/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php new file mode 100644 index 0000000..28b3b3c --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..83d0d10 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, @@ -31,6 +34,12 @@ final class WebExtractFontsResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code, e.g., 200. */ @@ -76,13 +85,16 @@ final class WebExtractFontsResponse implements BaseModel * * To enforce required parameters use * ``` - * WebExtractFontsResponse::with(code: ..., domain: ..., fonts: ..., status: ...) + * WebExtractFontsResponse::with( + * cacheMetadata: ..., code: ..., domain: ..., fonts: ..., status: ... + * ) * ``` * * Otherwise ensure the following setters are called * * ``` * (new WebExtractFontsResponse) + * ->withCacheMetadata(...) * ->withCode(...) * ->withDomain(...) * ->withFonts(...) @@ -99,11 +111,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $fonts * @param array|null $fontLinks * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, int $code, string $domain, array $fonts, @@ -113,6 +127,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['code'] = $code; $self['domain'] = $domain; $self['fonts'] = $fonts; @@ -124,6 +139,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code, e.g., 200. */ diff --git a/src/Web/WebExtractFontsResponse/CacheMetadata.php b/src/Web/WebExtractFontsResponse/CacheMetadata.php new file mode 100644 index 0000000..9fdceac --- /dev/null +++ b/src/Web/WebExtractFontsResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php b/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..da36777 --- /dev/null +++ b/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * metadata: Metadata|MetadataShape, * status: string, @@ -29,6 +32,12 @@ final class WebExtractResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Extracted data matching the request schema. * @@ -72,7 +81,12 @@ final class WebExtractResponse implements BaseModel * To enforce required parameters use * ``` * WebExtractResponse::with( - * data: ..., metadata: ..., status: ..., url: ..., urlsAnalyzed: ... + * cacheMetadata: ..., + * data: ..., + * metadata: ..., + * status: ..., + * url: ..., + * urlsAnalyzed: ..., * ) * ``` * @@ -80,6 +94,7 @@ final class WebExtractResponse implements BaseModel * * ``` * (new WebExtractResponse) + * ->withCacheMetadata(...) * ->withData(...) * ->withMetadata(...) * ->withStatus(...) @@ -97,12 +112,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param array $data * @param Metadata|MetadataShape $metadata * @param list $urlsAnalyzed * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, array $data, Metadata|array $metadata, string $status, @@ -112,6 +129,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['data'] = $data; $self['metadata'] = $metadata; $self['status'] = $status; @@ -123,6 +141,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Extracted data matching the request schema. * diff --git a/src/Web/WebExtractResponse/CacheMetadata.php b/src/Web/WebExtractResponse/CacheMetadata.php new file mode 100644 index 0000000..f176b3f --- /dev/null +++ b/src/Web/WebExtractResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/CacheMetadata/Status.php b/src/Web/WebExtractResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..3e0c37c --- /dev/null +++ b/src/Web/WebExtractResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code. */ @@ -57,6 +67,20 @@ final class WebExtractStyleguideResponse implements BaseModel #[Optional] public ?Styleguide $styleguide; + /** + * `new WebExtractStyleguideResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractStyleguideResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractStyleguideResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -67,10 +91,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param Styleguide|StyleguideShape|null $styleguide */ public static function with( + CacheMetadata|array $cacheMetadata, ?int $code = null, ?string $domain = null, KeyMetadata|array|null $keyMetadata = null, @@ -79,6 +105,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $code && $self['code'] = $code; null !== $domain && $self['domain'] = $domain; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -88,6 +116,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code. */ diff --git a/src/Web/WebExtractStyleguideResponse/CacheMetadata.php b/src/Web/WebExtractStyleguideResponse/CacheMetadata.php new file mode 100644 index 0000000..7b8ef61 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php b/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..f37c97d --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code. */ @@ -79,6 +89,20 @@ final class WebScreenshotResponse implements BaseModel #[Optional] public ?int $width; + /** + * `new WebScreenshotResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScreenshotResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScreenshotResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -89,10 +113,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param ScreenshotType|value-of|null $screenshotType */ public static function with( + CacheMetadata|array $cacheMetadata, ?int $code = null, ?string $domain = null, ?int $height = null, @@ -104,6 +130,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $code && $self['code'] = $code; null !== $domain && $self['domain'] = $domain; null !== $height && $self['height'] = $height; @@ -116,6 +144,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code. */ diff --git a/src/Web/WebScreenshotResponse/CacheMetadata.php b/src/Web/WebScreenshotResponse/CacheMetadata.php new file mode 100644 index 0000000..77d24e6 --- /dev/null +++ b/src/Web/WebScreenshotResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebScreenshotResponse/CacheMetadata/Status.php b/src/Web/WebScreenshotResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..943957e --- /dev/null +++ b/src/Web/WebScreenshotResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -26,6 +29,12 @@ final class WebSearchResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Echo of the original query (useful when fanout was enabled). */ @@ -47,13 +56,16 @@ final class WebSearchResponse implements BaseModel * * To enforce required parameters use * ``` - * WebSearchResponse::with(query: ..., results: ...) + * WebSearchResponse::with(cacheMetadata: ..., query: ..., results: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new WebSearchResponse)->withQuery(...)->withResults(...) + * (new WebSearchResponse) + * ->withCacheMetadata(...) + * ->withQuery(...) + * ->withResults(...) * ``` */ public function __construct() @@ -66,16 +78,19 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $results * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, string $query, array $results, - KeyMetadata|array|null $keyMetadata = null + KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['query'] = $query; $self['results'] = $results; @@ -84,6 +99,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Echo of the original query (useful when fanout was enabled). */ diff --git a/src/Web/WebSearchResponse/CacheMetadata.php b/src/Web/WebSearchResponse/CacheMetadata.php new file mode 100644 index 0000000..3641688 --- /dev/null +++ b/src/Web/WebSearchResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/CacheMetadata/Status.php b/src/Web/WebSearchResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..5461240 --- /dev/null +++ b/src/Web/WebSearchResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -28,6 +31,12 @@ final class WebWebCrawlMdResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + #[Required] public Metadata $metadata; @@ -46,13 +55,16 @@ final class WebWebCrawlMdResponse implements BaseModel * * To enforce required parameters use * ``` - * WebWebCrawlMdResponse::with(metadata: ..., results: ...) + * WebWebCrawlMdResponse::with(cacheMetadata: ..., metadata: ..., results: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new WebWebCrawlMdResponse)->withMetadata(...)->withResults(...) + * (new WebWebCrawlMdResponse) + * ->withCacheMetadata(...) + * ->withMetadata(...) + * ->withResults(...) * ``` */ public function __construct() @@ -65,17 +77,20 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param list $results * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Metadata|array $metadata, array $results, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['metadata'] = $metadata; $self['results'] = $results; @@ -84,6 +99,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * @param Metadata|MetadataShape $metadata */ diff --git a/src/Web/WebWebCrawlMdResponse/CacheMetadata.php b/src/Web/WebWebCrawlMdResponse/CacheMetadata.php new file mode 100644 index 0000000..232a6fa --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php b/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..599211b --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. */ @@ -92,7 +101,12 @@ final class WebWebScrapeHTMLResponse implements BaseModel * To enforce required parameters use * ``` * WebWebScrapeHTMLResponse::with( - * html: ..., metadata: ..., success: ..., type: ..., url: ... + * cacheMetadata: ..., + * html: ..., + * metadata: ..., + * success: ..., + * type: ..., + * url: ..., * ) * ``` * @@ -100,6 +114,7 @@ final class WebWebScrapeHTMLResponse implements BaseModel * * ``` * (new WebWebScrapeHTMLResponse) + * ->withCacheMetadata(...) * ->withHTML(...) * ->withMetadata(...) * ->withSuccess(...) @@ -117,12 +132,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param Type|value-of $type * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, string $html, Metadata|array $metadata, bool $success, @@ -134,6 +151,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['html'] = $html; $self['metadata'] = $metadata; $self['success'] = $success; @@ -147,6 +165,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. */ diff --git a/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php new file mode 100644 index 0000000..e38e194 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..bdfe8f9 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * success: bool, * url: string, @@ -30,6 +33,12 @@ final class WebWebScrapeImagesResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Images found on the page. * @@ -69,13 +78,16 @@ final class WebWebScrapeImagesResponse implements BaseModel * * To enforce required parameters use * ``` - * WebWebScrapeImagesResponse::with(images: ..., success: ..., url: ...) + * WebWebScrapeImagesResponse::with( + * cacheMetadata: ..., images: ..., success: ..., url: ... + * ) * ``` * * Otherwise ensure the following setters are called * * ``` * (new WebWebScrapeImagesResponse) + * ->withCacheMetadata(...) * ->withImages(...) * ->withSuccess(...) * ->withURL(...) @@ -91,11 +103,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $images * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, array $images, bool $success, string $url, @@ -104,6 +118,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['images'] = $images; $self['success'] = $success; $self['url'] = $url; @@ -114,6 +129,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Images found on the page. * diff --git a/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php b/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php new file mode 100644 index 0000000..5f5c039 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..5eeff11 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. */ @@ -96,7 +105,12 @@ final class WebWebScrapeMdResponse implements BaseModel * To enforce required parameters use * ``` * WebWebScrapeMdResponse::with( - * contentLength: ..., markdown: ..., metadata: ..., success: ..., url: ... + * cacheMetadata: ..., + * contentLength: ..., + * markdown: ..., + * metadata: ..., + * success: ..., + * url: ..., * ) * ``` * @@ -104,6 +118,7 @@ final class WebWebScrapeMdResponse implements BaseModel * * ``` * (new WebWebScrapeMdResponse) + * ->withCacheMetadata(...) * ->withContentLength(...) * ->withMarkdown(...) * ->withMetadata(...) @@ -121,11 +136,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, int $contentLength, string $markdown, Metadata|array $metadata, @@ -138,6 +155,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['contentLength'] = $contentLength; $self['markdown'] = $markdown; $self['metadata'] = $metadata; @@ -152,6 +170,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. */ diff --git a/src/Web/WebWebScrapeMdResponse/CacheMetadata.php b/src/Web/WebWebScrapeMdResponse/CacheMetadata.php new file mode 100644 index 0000000..1798491 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + 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 $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php new file mode 100644 index 0000000..412bd26 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +