diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2601677..d0ab664 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.0" + ".": "1.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 99ba378..e34b116 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-2460611c25145e2ca049b14c32be0f9ac9f4ded0b95154d29a83b4a6c1453f3e.yml -openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4903d5902cec6a80f42b9adaa9cf0defa9805ff22d7ae96970d209a4f867e195.yml +openapi_spec_hash: 1097891c23530dfe0155f23170daf973 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1476645..2b03d82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.0 (2026-06-25) + +Full Changelog: [v1.1.0...v1.2.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.1.0...v1.2.0) + +### Features + +* **api:** api update ([e984607](https://github.com/context-dot-dev/context-php-sdk/commit/e984607de54b77c8cd7991636bc1c5d95ca42e1e)) + ## 1.1.0 (2026-06-22) Full Changelog: [v1.0.0...v1.1.0](https://github.com/context-dot-dev/context-php-sdk/compare/v1.0.0...v1.1.0) diff --git a/README.md b/README.md index 8a0625d..ee10b94 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.1.0" +composer require "context-dev/context-dev-php 1.2.0" ``` diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 0fa57c1..b6b0288 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -139,6 +139,7 @@ public function extractStyleguide( * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int $maxAgeMs Return a cached screenshot if a prior screenshot 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 capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @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 Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -153,6 +154,7 @@ public function screenshot( HandleCookiePopup|string $handleCookiePopup = 'false', int $maxAgeMs = 86400000, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 8e98d66..c6f0459 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -221,6 +221,7 @@ public function extractStyleguide( * handleCookiePopup?: HandleCookiePopup|value-of, * maxAgeMs?: int, * page?: Page|value-of, + * scrollOffset?: int, * timeoutMs?: int, * viewport?: Viewport|ViewportShape, * waitForMs?: int, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index cdf405e..224efa2 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -229,6 +229,7 @@ public function extractStyleguide( * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int $maxAgeMs Return a cached screenshot if a prior screenshot 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 capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @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 Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -243,6 +244,7 @@ public function screenshot( HandleCookiePopup|string $handleCookiePopup = 'false', int $maxAgeMs = 86400000, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, @@ -256,6 +258,7 @@ public function screenshot( 'handleCookiePopup' => $handleCookiePopup, 'maxAgeMs' => $maxAgeMs, 'page' => $page, + 'scrollOffset' => $scrollOffset, 'timeoutMs' => $timeoutMs, 'viewport' => $viewport, 'waitForMs' => $waitForMs, diff --git a/src/Version.php b/src/Version.php index 6d157e5..664fee6 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '1.1.0'; +const VERSION = '1.2.0'; // x-release-please-end diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 8f9f586..56d3b65 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -27,6 +27,7 @@ * handleCookiePopup?: null|HandleCookiePopup|value-of, * maxAgeMs?: int|null, * page?: null|Page|value-of, + * scrollOffset?: int|null, * timeoutMs?: int|null, * viewport?: null|Viewport|ViewportShape, * waitForMs?: int|null, @@ -80,6 +81,12 @@ final class WebScreenshotParams implements BaseModel #[Optional(enum: Page::class)] public ?string $page; + /** + * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + */ + #[Optional] + public ?int $scrollOffset; + /** * 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). */ @@ -120,6 +127,7 @@ public static function with( HandleCookiePopup|string|null $handleCookiePopup = null, ?int $maxAgeMs = null, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array|null $viewport = null, ?int $waitForMs = null, @@ -132,6 +140,7 @@ public static function with( null !== $handleCookiePopup && $self['handleCookiePopup'] = $handleCookiePopup; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $page && $self['page'] = $page; + null !== $scrollOffset && $self['scrollOffset'] = $scrollOffset; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $viewport && $self['viewport'] = $viewport; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -213,6 +222,17 @@ public function withPage(Page|string $page): self return $self; } + /** + * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + */ + public function withScrollOffset(int $scrollOffset): self + { + $self = clone $this; + $self['scrollOffset'] = $scrollOffset; + + 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). */