From c244d408ae90844b902d0efd9bca304e115f4880 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 22:16:41 +0000 Subject: [PATCH 1/4] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelResponse.php | 173 +++++++++------- src/Batch/BatchCancelResponse/Credits.php | 52 +++-- .../{Type.php => Format.php} | 4 +- src/Batch/BatchCancelResponse/Input.php | 134 ------------ src/Batch/BatchCancelResponse/Mode.php | 2 +- src/Batch/BatchCancelResponse/Progress.php | 6 +- src/Batch/BatchCancelResponse/Results.php | 2 +- src/Batch/BatchGetResponse.php | 193 +++++++++--------- src/Batch/BatchGetResponse/Credits.php | 52 +++-- .../BatchGetResponse/{Type.php => Format.php} | 4 +- src/Batch/BatchGetResponse/Input.php | 134 ------------ src/Batch/BatchGetResponse/Mode.php | 2 +- src/Batch/BatchGetResponse/Progress.php | 6 +- src/Batch/BatchGetResponse/Results.php | 2 +- src/Batch/BatchListResponse/Data.php | 179 +++++++++------- src/Batch/BatchListResponse/Data/Credits.php | 52 +++-- .../Data/{Type.php => Format.php} | 4 +- src/Batch/BatchListResponse/Data/Input.php | 134 ------------ src/Batch/BatchListResponse/Data/Mode.php | 2 +- src/Batch/BatchListResponse/Data/Progress.php | 6 +- src/Batch/BatchListResponse/Data/Results.php | 2 +- src/Batch/CrawlControls.php | 175 ++++++++++++++++ src/Batch/CrawlControls/Source.php | 33 +++ .../CrawlControls/Source/UnionMember0.php | 87 ++++++++ .../Source/UnionMember0/Type.php | 10 + .../CrawlControls/Source/UnionMember1.php | 89 ++++++++ .../Source/UnionMember1/Type.php | 10 + src/Batch/{Error.php => Failure.php} | 22 +- src/Batch/Intake.php | 164 +++++++++++++++ .../{ErrorCount.php => PageErrorCount.php} | 12 +- src/Services/BatchRawService.php | 2 +- src/Services/BatchService.php | 2 +- 33 files changed, 1016 insertions(+), 739 deletions(-) rename src/Batch/BatchCancelResponse/{Type.php => Format.php} (58%) delete mode 100644 src/Batch/BatchCancelResponse/Input.php rename src/Batch/BatchGetResponse/{Type.php => Format.php} (58%) delete mode 100644 src/Batch/BatchGetResponse/Input.php rename src/Batch/BatchListResponse/Data/{Type.php => Format.php} (59%) delete mode 100644 src/Batch/BatchListResponse/Data/Input.php create mode 100644 src/Batch/CrawlControls.php create mode 100644 src/Batch/CrawlControls/Source.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember0.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember0/Type.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember1.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember1/Type.php rename src/Batch/{Error.php => Failure.php} (70%) create mode 100644 src/Batch/Intake.php rename src/Batch/{ErrorCount.php => PageErrorCount.php} (80%) diff --git a/.stats.yml b/.stats.yml index 33b7080..963533f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-960cb623c7ec84bf4dc0f5945cbc19eec9cca48271071f400d96066eaa55dbd6.yml -openapi_spec_hash: 84fd39e3f4dc964bf0c32d4e95da1b34 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml +openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index f0ea9e0..cc1d61f 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -5,24 +5,24 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchCancelResponse\Credits; -use ContextDev\Batch\BatchCancelResponse\Input; +use ContextDev\Batch\BatchCancelResponse\Format; use ContextDev\Batch\BatchCancelResponse\KeyMetadata; use ContextDev\Batch\BatchCancelResponse\Mode; use ContextDev\Batch\BatchCancelResponse\Progress; use ContextDev\Batch\BatchCancelResponse\Results; use ContextDev\Batch\BatchCancelResponse\Status; use ContextDev\Batch\BatchCancelResponse\Timing; -use ContextDev\Batch\BatchCancelResponse\Type; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchCancelResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchCancelResponse\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchCancelResponse\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchCancelResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchCancelResponse\Timing @@ -30,17 +30,18 @@ * * @phpstan-type BatchCancelResponseShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -56,33 +57,39 @@ final class BatchCancelResponse implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -90,13 +97,21 @@ final class BatchCancelResponse implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -120,14 +135,6 @@ final class BatchCancelResponse implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * API key usage for this request. */ @@ -141,17 +148,18 @@ final class BatchCancelResponse implements BaseModel * ``` * BatchCancelResponse::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -160,17 +168,18 @@ final class BatchCancelResponse implements BaseModel * ``` * (new BatchCancelResponse) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -183,48 +192,51 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -243,7 +255,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -256,37 +281,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -295,7 +320,7 @@ public function withInput(Input|array $input): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -308,7 +333,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -321,7 +359,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -370,19 +408,6 @@ public function withTiming(Timing|array $timing): self return $self; } - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - /** * API key usage for this request. * diff --git a/src/Batch/BatchCancelResponse/Credits.php b/src/Batch/BatchCancelResponse/Credits.php index 6484e73..4057c7e 100644 --- a/src/Batch/BatchCancelResponse/Credits.php +++ b/src/Batch/BatchCancelResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchCancelResponse/Type.php b/src/Batch/BatchCancelResponse/Format.php similarity index 58% rename from src/Batch/BatchCancelResponse/Type.php rename to src/Batch/BatchCancelResponse/Format.php index 30a60b2..761672d 100644 --- a/src/Batch/BatchCancelResponse/Type.php +++ b/src/Batch/BatchCancelResponse/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchCancelResponse/Input.php b/src/Batch/BatchCancelResponse/Input.php deleted file mode 100644 index 684dc94..0000000 --- a/src/Batch/BatchCancelResponse/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - 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 $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Mode.php b/src/Batch/BatchCancelResponse/Mode.php index c530dfa..86127d2 100644 --- a/src/Batch/BatchCancelResponse/Mode.php +++ b/src/Batch/BatchCancelResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchCancelResponse/Progress.php b/src/Batch/BatchCancelResponse/Progress.php index b180dca..7026511 100644 --- a/src/Batch/BatchCancelResponse/Progress.php +++ b/src/Batch/BatchCancelResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchCancelResponse/Results.php b/src/Batch/BatchCancelResponse/Results.php index f28b3d3..b51cf9c 100644 --- a/src/Batch/BatchCancelResponse/Results.php +++ b/src/Batch/BatchCancelResponse/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchCancelResponse\Results\File * diff --git a/src/Batch/BatchGetResponse.php b/src/Batch/BatchGetResponse.php index b38d7da..cad5708 100644 --- a/src/Batch/BatchGetResponse.php +++ b/src/Batch/BatchGetResponse.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchGetResponse\Credits; -use ContextDev\Batch\BatchGetResponse\Input; +use ContextDev\Batch\BatchGetResponse\Format; use ContextDev\Batch\BatchGetResponse\InvalidURL; use ContextDev\Batch\BatchGetResponse\KeyMetadata; use ContextDev\Batch\BatchGetResponse\Mode; @@ -13,18 +13,18 @@ use ContextDev\Batch\BatchGetResponse\Results; use ContextDev\Batch\BatchGetResponse\Status; use ContextDev\Batch\BatchGetResponse\Timing; -use ContextDev\Batch\BatchGetResponse\Type; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchGetResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchGetResponse\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake * @phpstan-import-type InvalidURLShape from \ContextDev\Batch\BatchGetResponse\InvalidURL + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchGetResponse\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchGetResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchGetResponse\Timing @@ -32,20 +32,20 @@ * * @phpstan-type BatchGetResponseShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * invalidURLs: list, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, - * webhookSecret?: string|null, * } */ final class BatchGetResponse implements BaseModel @@ -60,30 +60,36 @@ final class BatchGetResponse implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** * Rejected URLs, up to 100. These are not charged. @@ -94,7 +100,7 @@ final class BatchGetResponse implements BaseModel public array $invalidURLs; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -102,13 +108,21 @@ final class BatchGetResponse implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -132,26 +146,12 @@ final class BatchGetResponse implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * API key usage for this request. */ #[Optional('key_metadata')] public ?KeyMetadata $keyMetadata; - /** - * Webhook signing secret. Also returned by GET /batch/{batch_id}. - */ - #[Optional('webhook_secret')] - public ?string $webhookSecret; - /** * `new BatchGetResponse()` is missing required properties by the API. * @@ -159,18 +159,19 @@ final class BatchGetResponse implements BaseModel * ``` * BatchGetResponse::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * invalidURLs: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -179,18 +180,19 @@ final class BatchGetResponse implements BaseModel * ``` * (new BatchGetResponse) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withInvalidURLs(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -203,55 +205,56 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param list $invalidURLs * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, array $invalidURLs, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, KeyMetadata|array|null $keyMetadata = null, - ?string $webhookSecret = null, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['invalidURLs'] = $invalidURLs; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $webhookSecret && $self['webhookSecret'] = $webhookSecret; return $self; } @@ -268,7 +271,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -281,37 +297,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -333,7 +349,7 @@ public function withInvalidURLs(array $invalidURLs): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -346,7 +362,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -359,7 +388,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -408,19 +437,6 @@ public function withTiming(Timing|array $timing): self return $self; } - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - /** * API key usage for this request. * @@ -433,15 +449,4 @@ public function withKeyMetadata(KeyMetadata|array $keyMetadata): self return $self; } - - /** - * Webhook signing secret. Also returned by GET /batch/{batch_id}. - */ - public function withWebhookSecret(string $webhookSecret): self - { - $self = clone $this; - $self['webhookSecret'] = $webhookSecret; - - return $self; - } } diff --git a/src/Batch/BatchGetResponse/Credits.php b/src/Batch/BatchGetResponse/Credits.php index 5014503..a498842 100644 --- a/src/Batch/BatchGetResponse/Credits.php +++ b/src/Batch/BatchGetResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchGetResponse/Type.php b/src/Batch/BatchGetResponse/Format.php similarity index 58% rename from src/Batch/BatchGetResponse/Type.php rename to src/Batch/BatchGetResponse/Format.php index def0a61..efc85e5 100644 --- a/src/Batch/BatchGetResponse/Type.php +++ b/src/Batch/BatchGetResponse/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchGetResponse; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchGetResponse/Input.php b/src/Batch/BatchGetResponse/Input.php deleted file mode 100644 index 84c30d0..0000000 --- a/src/Batch/BatchGetResponse/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - 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 $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchGetResponse/Mode.php b/src/Batch/BatchGetResponse/Mode.php index 78ded37..4e90abb 100644 --- a/src/Batch/BatchGetResponse/Mode.php +++ b/src/Batch/BatchGetResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchGetResponse; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchGetResponse/Progress.php b/src/Batch/BatchGetResponse/Progress.php index 4a99983..7041e10 100644 --- a/src/Batch/BatchGetResponse/Progress.php +++ b/src/Batch/BatchGetResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchGetResponse/Results.php b/src/Batch/BatchGetResponse/Results.php index a91153c..a8b882f 100644 --- a/src/Batch/BatchGetResponse/Results.php +++ b/src/Batch/BatchGetResponse/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchGetResponse\Results\File * diff --git a/src/Batch/BatchListResponse/Data.php b/src/Batch/BatchListResponse/Data.php index 71940da..10df935 100644 --- a/src/Batch/BatchListResponse/Data.php +++ b/src/Batch/BatchListResponse/Data.php @@ -5,15 +5,16 @@ namespace ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchListResponse\Data\Credits; -use ContextDev\Batch\BatchListResponse\Data\Input; +use ContextDev\Batch\BatchListResponse\Data\Format; use ContextDev\Batch\BatchListResponse\Data\Mode; use ContextDev\Batch\BatchListResponse\Data\Progress; use ContextDev\Batch\BatchListResponse\Data\Results; use ContextDev\Batch\BatchListResponse\Data\Status; use ContextDev\Batch\BatchListResponse\Data\Timing; -use ContextDev\Batch\BatchListResponse\Data\Type; -use ContextDev\Batch\Error; -use ContextDev\Batch\ErrorCount; +use ContextDev\Batch\CrawlControls; +use ContextDev\Batch\Failure; +use ContextDev\Batch\Intake; +use ContextDev\Batch\PageErrorCount; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; @@ -21,27 +22,29 @@ /** * An asynchronous web scraping job. * + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchListResponse\Data\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchListResponse\Data\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchListResponse\Data\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchListResponse\Data\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchListResponse\Data\Timing * * @phpstan-type DataShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * } */ final class Data implements BaseModel @@ -56,33 +59,39 @@ final class Data implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -90,13 +99,21 @@ final class Data implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -120,14 +137,6 @@ final class Data implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * `new Data()` is missing required properties by the API. * @@ -135,17 +144,18 @@ final class Data implements BaseModel * ``` * Data::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -154,17 +164,18 @@ final class Data implements BaseModel * ``` * (new Data) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -177,46 +188,49 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; return $self; } @@ -233,7 +247,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -246,37 +273,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -285,7 +312,7 @@ public function withInput(Input|array $input): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -298,7 +325,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -311,7 +351,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -359,17 +399,4 @@ public function withTiming(Timing|array $timing): self return $self; } - - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } } diff --git a/src/Batch/BatchListResponse/Data/Credits.php b/src/Batch/BatchListResponse/Data/Credits.php index 285e604..cfb610d 100644 --- a/src/Batch/BatchListResponse/Data/Credits.php +++ b/src/Batch/BatchListResponse/Data/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchListResponse/Data/Type.php b/src/Batch/BatchListResponse/Data/Format.php similarity index 59% rename from src/Batch/BatchListResponse/Data/Type.php rename to src/Batch/BatchListResponse/Data/Format.php index b93f331..d9b3c5c 100644 --- a/src/Batch/BatchListResponse/Data/Type.php +++ b/src/Batch/BatchListResponse/Data/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchListResponse\Data; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchListResponse/Data/Input.php b/src/Batch/BatchListResponse/Data/Input.php deleted file mode 100644 index f9423b6..0000000 --- a/src/Batch/BatchListResponse/Data/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - 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 $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchListResponse/Data/Mode.php b/src/Batch/BatchListResponse/Data/Mode.php index d8a11a7..8734166 100644 --- a/src/Batch/BatchListResponse/Data/Mode.php +++ b/src/Batch/BatchListResponse/Data/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchListResponse\Data; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchListResponse/Data/Progress.php b/src/Batch/BatchListResponse/Data/Progress.php index 6c4464d..5f53887 100644 --- a/src/Batch/BatchListResponse/Data/Progress.php +++ b/src/Batch/BatchListResponse/Data/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchListResponse/Data/Results.php b/src/Batch/BatchListResponse/Data/Results.php index 8ebad63..2ad188f 100644 --- a/src/Batch/BatchListResponse/Data/Results.php +++ b/src/Batch/BatchListResponse/Data/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchListResponse\Data\Results\File * diff --git a/src/Batch/CrawlControls.php b/src/Batch/CrawlControls.php new file mode 100644 index 0000000..ba5e8c9 --- /dev/null +++ b/src/Batch/CrawlControls.php @@ -0,0 +1,175 @@ + */ + use SdkModel; + + /** + * Whether links to subdomains were followed. Always false for a sitemap crawl. + */ + #[Required('follow_subdomains')] + public bool $followSubdomains; + + /** + * Link depth limit. Always 0 for a sitemap crawl, which never follows links off its URLs; null when a `start_url` crawl set no limit. + */ + #[Required('max_depth')] + public ?int $maxDepth; + + /** + * The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs its sitemap actually lists, up to this many, so `input.reserved` is often lower. + */ + #[Required('max_pages')] + public int $maxPages; + + /** + * Where the crawl started. + * + * @var SourceVariants $source + */ + #[Required] + public UnionMember0|UnionMember1 $source; + + /** + * RE2 pattern URLs had to match to be crawled. Null when the crawl set none. + */ + #[Required('url_pattern')] + public ?string $urlPattern; + + /** + * `new CrawlControls()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CrawlControls::with( + * followSubdomains: ..., + * maxDepth: ..., + * maxPages: ..., + * source: ..., + * urlPattern: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CrawlControls) + * ->withFollowSubdomains(...) + * ->withMaxDepth(...) + * ->withMaxPages(...) + * ->withSource(...) + * ->withURLPattern(...) + * ``` + */ + 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 SourceShape $source + */ + public static function with( + bool $followSubdomains, + ?int $maxDepth, + int $maxPages, + UnionMember0|array|UnionMember1 $source, + ?string $urlPattern, + ): self { + $self = new self; + + $self['followSubdomains'] = $followSubdomains; + $self['maxDepth'] = $maxDepth; + $self['maxPages'] = $maxPages; + $self['source'] = $source; + $self['urlPattern'] = $urlPattern; + + return $self; + } + + /** + * Whether links to subdomains were followed. Always false for a sitemap crawl. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Link depth limit. Always 0 for a sitemap crawl, which never follows links off its URLs; null when a `start_url` crawl set no limit. + */ + public function withMaxDepth(?int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs its sitemap actually lists, up to this many, so `input.reserved` is often lower. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * Where the crawl started. + * + * @param SourceShape $source + */ + public function withSource(UnionMember0|array|UnionMember1 $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } + + /** + * RE2 pattern URLs had to match to be crawled. Null when the crawl set none. + */ + public function withURLPattern(?string $urlPattern): self + { + $self = clone $this; + $self['urlPattern'] = $urlPattern; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source.php b/src/Batch/CrawlControls/Source.php new file mode 100644 index 0000000..83d9e9d --- /dev/null +++ b/src/Batch/CrawlControls/Source.php @@ -0,0 +1,33 @@ +|array + */ + public static function variants(): array + { + return [UnionMember0::class, UnionMember1::class]; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember0.php b/src/Batch/CrawlControls/Source/UnionMember0.php new file mode 100644 index 0000000..80e86a2 --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember0.php @@ -0,0 +1,87 @@ +, url: string} + */ +final class UnionMember0 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Page the crawl started from. + */ + #[Required] + public string $url; + + /** + * `new UnionMember0()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UnionMember0::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UnionMember0)->withType(...)->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 Type|value-of $type + */ + public static function with(Type|string $type, string $url): self + { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Page the crawl started from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember0/Type.php b/src/Batch/CrawlControls/Source/UnionMember0/Type.php new file mode 100644 index 0000000..f8fa57a --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember0/Type.php @@ -0,0 +1,10 @@ + + * } + */ +final class UnionMember1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Domain whose sitemap supplied the pages. + */ + #[Required] + public string $domain; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new UnionMember1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UnionMember1::with(domain: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UnionMember1)->withDomain(...)->withType(...) + * ``` + */ + 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 + */ + public static function with(string $domain, Type|string $type): self + { + $self = new self; + + $self['domain'] = $domain; + $self['type'] = $type; + + return $self; + } + + /** + * Domain whose sitemap supplied the pages. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember1/Type.php b/src/Batch/CrawlControls/Source/UnionMember1/Type.php new file mode 100644 index 0000000..5514933 --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember1/Type.php @@ -0,0 +1,10 @@ + */ + /** @use SdkModel */ use SdkModel; /** - * Batch error code. + * Why the batch itself stopped. */ #[Required] public string $code; /** - * Batch error message. + * Human-readable explanation. */ #[Required] public string $message; /** - * `new Error()` is missing required properties by the API. + * `new Failure()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Error::with(code: ..., message: ...) + * Failure::with(code: ..., message: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Error)->withCode(...)->withMessage(...) + * (new Failure)->withCode(...)->withMessage(...) * ``` */ public function __construct() @@ -65,7 +65,7 @@ public static function with(string $code, string $message): self } /** - * Batch error code. + * Why the batch itself stopped. */ public function withCode(string $code): self { @@ -76,7 +76,7 @@ public function withCode(string $code): self } /** - * Batch error message. + * Human-readable explanation. */ public function withMessage(string $message): self { diff --git a/src/Batch/Intake.php b/src/Batch/Intake.php new file mode 100644 index 0000000..838d25f --- /dev/null +++ b/src/Batch/Intake.php @@ -0,0 +1,164 @@ + */ + use SdkModel; + + /** + * URLs dropped before reserving because another entry resolved to the same page. Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than once. + */ + #[Required] + public int $duplicates; + + /** + * URLs from your list rejected as unusable; the same ones are itemised in `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable page is rejected outright with a 400 rather than accepted with an empty list. + */ + #[Required] + public ?int $invalid; + + /** + * Pages credits were reserved for. Everything else — progress, the refund, the completion percentage — is measured against this. + */ + #[Required] + public int $reserved; + + /** + * Whether `reserved` is an upper bound the batch may finish under. True only for a crawl that follows links, whose reachable page count is unknowable until it runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact page count. + */ + #[Required('reserved_is_ceiling')] + public bool $reservedIsCeiling; + + /** + * URLs in the list you sent, before validation and de-duplication. Null for a crawl, which is given a source rather than a list. + */ + #[Required] + public ?int $submitted; + + /** + * `new Intake()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Intake::with( + * duplicates: ..., + * invalid: ..., + * reserved: ..., + * reservedIsCeiling: ..., + * submitted: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Intake) + * ->withDuplicates(...) + * ->withInvalid(...) + * ->withReserved(...) + * ->withReservedIsCeiling(...) + * ->withSubmitted(...) + * ``` + */ + 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 $duplicates, + ?int $invalid, + int $reserved, + bool $reservedIsCeiling, + ?int $submitted, + ): self { + $self = new self; + + $self['duplicates'] = $duplicates; + $self['invalid'] = $invalid; + $self['reserved'] = $reserved; + $self['reservedIsCeiling'] = $reservedIsCeiling; + $self['submitted'] = $submitted; + + return $self; + } + + /** + * URLs dropped before reserving because another entry resolved to the same page. Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than once. + */ + public function withDuplicates(int $duplicates): self + { + $self = clone $this; + $self['duplicates'] = $duplicates; + + return $self; + } + + /** + * URLs from your list rejected as unusable; the same ones are itemised in `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable page is rejected outright with a 400 rather than accepted with an empty list. + */ + public function withInvalid(?int $invalid): self + { + $self = clone $this; + $self['invalid'] = $invalid; + + return $self; + } + + /** + * Pages credits were reserved for. Everything else — progress, the refund, the completion percentage — is measured against this. + */ + public function withReserved(int $reserved): self + { + $self = clone $this; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * Whether `reserved` is an upper bound the batch may finish under. True only for a crawl that follows links, whose reachable page count is unknowable until it runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact page count. + */ + public function withReservedIsCeiling(bool $reservedIsCeiling): self + { + $self = clone $this; + $self['reservedIsCeiling'] = $reservedIsCeiling; + + return $self; + } + + /** + * URLs in the list you sent, before validation and de-duplication. Null for a crawl, which is given a source rather than a list. + */ + public function withSubmitted(?int $submitted): self + { + $self = clone $this; + $self['submitted'] = $submitted; + + return $self; + } +} diff --git a/src/Batch/ErrorCount.php b/src/Batch/PageErrorCount.php similarity index 80% rename from src/Batch/ErrorCount.php rename to src/Batch/PageErrorCount.php index 3f34bb8..00af3a1 100644 --- a/src/Batch/ErrorCount.php +++ b/src/Batch/PageErrorCount.php @@ -11,11 +11,11 @@ /** * Page failures sharing one error code. * - * @phpstan-type ErrorCountShape = array{code: string, count: int} + * @phpstan-type PageErrorCountShape = array{code: string, count: int} */ -final class ErrorCount implements BaseModel +final class PageErrorCount implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; /** @@ -31,17 +31,17 @@ final class ErrorCount implements BaseModel public int $count; /** - * `new ErrorCount()` is missing required properties by the API. + * `new PageErrorCount()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ErrorCount::with(code: ..., count: ...) + * PageErrorCount::with(code: ..., count: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ErrorCount)->withCode(...)->withCount(...) + * (new PageErrorCount)->withCode(...)->withCount(...) * ``` */ public function __construct() diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index e3aa5f0..b77f2ba 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -37,7 +37,7 @@ public function __construct(private Client $client) {} /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. + * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index 386c228..cf5b9e0 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. + * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions From 76e2e1ac2a08536679a582f8cd5807a1eab8349a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 22:45:49 +0000 Subject: [PATCH 2/4] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelResponse.php | 86 ++++----------- src/Batch/BatchCancelResponse/Credits.php | 50 ++------- src/Batch/BatchCancelResponse/Format.php | 2 +- src/Batch/BatchCancelResponse/Mode.php | 2 +- src/Batch/BatchCancelResponse/Progress.php | 14 +-- src/Batch/BatchCancelResponse/Results.php | 99 ----------------- .../BatchCancelResponse/Results/File.php | 104 ------------------ src/Batch/BatchCancelResponse/Status.php | 12 +- src/Batch/BatchCancelResponse/Timing.php | 39 ++----- 10 files changed, 47 insertions(+), 365 deletions(-) delete mode 100644 src/Batch/BatchCancelResponse/Results.php delete mode 100644 src/Batch/BatchCancelResponse/Results/File.php diff --git a/.stats.yml b/.stats.yml index 963533f..06846fb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml -openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml +openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index cc1d61f..9b72a46 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -9,7 +9,6 @@ use ContextDev\Batch\BatchCancelResponse\KeyMetadata; use ContextDev\Batch\BatchCancelResponse\Mode; use ContextDev\Batch\BatchCancelResponse\Progress; -use ContextDev\Batch\BatchCancelResponse\Results; use ContextDev\Batch\BatchCancelResponse\Status; use ContextDev\Batch\BatchCancelResponse\Timing; use ContextDev\Core\Attributes\Optional; @@ -20,11 +19,9 @@ /** * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchCancelResponse\Credits - * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchCancelResponse\Progress - * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchCancelResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchCancelResponse\Timing * @phpstan-import-type KeyMetadataShape from \ContextDev\Batch\BatchCancelResponse\KeyMetadata * @@ -32,13 +29,11 @@ * id: string, * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * failure: null|Failure|FailureShape, * format: Format|value-of, * input: Intake|IntakeShape, * mode: Mode|value-of, * pageErrors: list, * progress: Progress|ProgressShape, - * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, @@ -51,7 +46,7 @@ final class BatchCancelResponse implements BaseModel use SdkModel; /** - * Batch ID used to retrieve or cancel the job. + * Batch ID. */ #[Required] public string $id; @@ -63,19 +58,13 @@ final class BatchCancelResponse implements BaseModel public ?CrawlControls $crawl; /** - * What this batch has done to your credit balance. + * What this batch cost so far. */ #[Required] public Credits $credits; /** - * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. - */ - #[Required] - public ?Failure $failure; - - /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. * * @var value-of $format */ @@ -89,7 +78,7 @@ final class BatchCancelResponse implements BaseModel public Intake $input; /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. * * @var value-of $mode */ @@ -97,7 +86,7 @@ final class BatchCancelResponse implements BaseModel public string $mode; /** - * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * Page failures so far, grouped by error code and sorted by count. * * @var list $pageErrors */ @@ -105,19 +94,13 @@ final class BatchCancelResponse implements BaseModel public array $pageErrors; /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. */ #[Required] public Progress $progress; /** - * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. - */ - #[Required] - public ?Results $results; - - /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. * * @var value-of $status */ @@ -132,6 +115,9 @@ final class BatchCancelResponse implements BaseModel #[Required(list: 'string')] public array $tags; + /** + * There is no finish time yet — the batch is still winding down. + */ #[Required] public Timing $timing; @@ -150,13 +136,11 @@ final class BatchCancelResponse implements BaseModel * id: ..., * crawl: ..., * credits: ..., - * failure: ..., * format: ..., * input: ..., * mode: ..., * pageErrors: ..., * progress: ..., - * results: ..., * status: ..., * tags: ..., * timing: ..., @@ -170,13 +154,11 @@ final class BatchCancelResponse implements BaseModel * ->withID(...) * ->withCrawl(...) * ->withCredits(...) - * ->withFailure(...) * ->withFormat(...) * ->withInput(...) * ->withMode(...) * ->withPageErrors(...) * ->withProgress(...) - * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) @@ -194,13 +176,11 @@ public function __construct() * * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Failure|FailureShape|null $failure * @param Format|value-of $format * @param Intake|IntakeShape $input * @param Mode|value-of $mode * @param list $pageErrors * @param Progress|ProgressShape $progress - * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing @@ -210,13 +190,11 @@ public static function with( string $id, CrawlControls|array|null $crawl, Credits|array $credits, - Failure|array|null $failure, Format|string $format, Intake|array $input, Mode|string $mode, array $pageErrors, Progress|array $progress, - Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, @@ -227,13 +205,11 @@ public static function with( $self['id'] = $id; $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['failure'] = $failure; $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; - $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; @@ -244,7 +220,7 @@ public static function with( } /** - * Batch ID used to retrieve or cancel the job. + * Batch ID. */ public function withID(string $id): self { @@ -268,7 +244,7 @@ public function withCrawl(CrawlControls|array|null $crawl): self } /** - * What this batch has done to your credit balance. + * What this batch cost so far. * * @param Credits|CreditsShape $credits */ @@ -281,20 +257,7 @@ public function withCredits(Credits|array $credits): self } /** - * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. - * - * @param Failure|FailureShape|null $failure - */ - public function withFailure(Failure|array|null $failure): self - { - $self = clone $this; - $self['failure'] = $failure; - - return $self; - } - - /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. * * @param Format|value-of $format */ @@ -320,7 +283,7 @@ public function withInput(Intake|array $input): self } /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. * * @param Mode|value-of $mode */ @@ -333,7 +296,7 @@ public function withMode(Mode|string $mode): self } /** - * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * Page failures so far, grouped by error code and sorted by count. * * @param list $pageErrors */ @@ -346,7 +309,7 @@ public function withPageErrors(array $pageErrors): self } /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. * * @param Progress|ProgressShape $progress */ @@ -359,20 +322,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. - * - * @param Results|ResultsShape|null $results - */ - public function withResults(Results|array|null $results): self - { - $self = clone $this; - $self['results'] = $results; - - return $self; - } - - /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. * * @param Status|value-of $status */ @@ -398,6 +348,8 @@ public function withTags(array $tags): self } /** + * There is no finish time yet — the batch is still winding down. + * * @param Timing|TimingShape $timing */ public function withTiming(Timing|array $timing): self diff --git a/src/Batch/BatchCancelResponse/Credits.php b/src/Batch/BatchCancelResponse/Credits.php index 4057c7e..9d9349c 100644 --- a/src/Batch/BatchCancelResponse/Credits.php +++ b/src/Batch/BatchCancelResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * What this batch has done to your credit balance. + * What this batch cost so far. * - * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} + * @phpstan-type CreditsShape = array{reserved: int} */ final class Credits implements BaseModel { @@ -19,19 +19,7 @@ final class Credits implements BaseModel use SdkModel; /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. - */ - #[Required] - public int $net; - - /** - * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. - */ - #[Required] - public int $refunded; - - /** - * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + * Credits debited at submission. The unspent remainder is refunded once the batch settles — read `credits.refunded` from GET /batch/{batch_id} then. */ #[Required] public int $reserved; @@ -41,13 +29,13 @@ final class Credits implements BaseModel * * To enforce required parameters use * ``` - * Credits::with(net: ..., refunded: ..., reserved: ...) + * Credits::with(reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) + * (new Credits)->withReserved(...) * ``` */ public function __construct() @@ -60,41 +48,17 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $net, int $refunded, int $reserved): self + public static function with(int $reserved): self { $self = new self; - $self['net'] = $net; - $self['refunded'] = $refunded; $self['reserved'] = $reserved; return $self; } /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. - */ - public function withNet(int $net): self - { - $self = clone $this; - $self['net'] = $net; - - return $self; - } - - /** - * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. - */ - public function withRefunded(int $refunded): self - { - $self = clone $this; - $self['refunded'] = $refunded; - - return $self; - } - - /** - * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + * Credits debited at submission. The unspent remainder is refunded once the batch settles — read `credits.refunded` from GET /batch/{batch_id} then. */ public function withReserved(int $reserved): self { diff --git a/src/Batch/BatchCancelResponse/Format.php b/src/Batch/BatchCancelResponse/Format.php index 761672d..43755fa 100644 --- a/src/Batch/BatchCancelResponse/Format.php +++ b/src/Batch/BatchCancelResponse/Format.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. */ enum Format: string { diff --git a/src/Batch/BatchCancelResponse/Mode.php b/src/Batch/BatchCancelResponse/Mode.php index 86127d2..87b5eb6 100644 --- a/src/Batch/BatchCancelResponse/Mode.php +++ b/src/Batch/BatchCancelResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. */ enum Mode: string { diff --git a/src/Batch/BatchCancelResponse/Progress.php b/src/Batch/BatchCancelResponse/Progress.php index 7026511..49d71b8 100644 --- a/src/Batch/BatchCancelResponse/Progress.php +++ b/src/Batch/BatchCancelResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -19,19 +19,19 @@ final class Progress implements BaseModel use SdkModel; /** - * Pages that could not be scraped. + * Pages that could not be scraped before the request landed. */ #[Required] public int $failed; /** - * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. + * Reserved pages that will now be skipped, and refunded when the batch settles. */ #[Required] public int $pending; /** - * Pages scraped successfully. + * Pages scraped successfully before the request landed. */ #[Required] public int $succeeded; @@ -72,7 +72,7 @@ public static function with(int $failed, int $pending, int $succeeded): self } /** - * Pages that could not be scraped. + * Pages that could not be scraped before the request landed. */ public function withFailed(int $failed): self { @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. + * Reserved pages that will now be skipped, and refunded when the batch settles. */ public function withPending(int $pending): self { @@ -94,7 +94,7 @@ public function withPending(int $pending): self } /** - * Pages scraped successfully. + * Pages scraped successfully before the request landed. */ public function withSucceeded(int $succeeded): self { diff --git a/src/Batch/BatchCancelResponse/Results.php b/src/Batch/BatchCancelResponse/Results.php deleted file mode 100644 index b51cf9c..0000000 --- a/src/Batch/BatchCancelResponse/Results.php +++ /dev/null @@ -1,99 +0,0 @@ - - * } - */ -final class Results implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * When the download URLs expire. - */ - #[Required('expires_at')] - public string $expiresAt; - - /** - * Result files. Order is not guaranteed. - * - * @var list $files - */ - #[Required(list: File::class)] - public array $files; - - /** - * `new Results()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Results::with(expiresAt: ..., files: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Results)->withExpiresAt(...)->withFiles(...) - * ``` - */ - 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 $files - */ - public static function with(string $expiresAt, array $files): self - { - $self = new self; - - $self['expiresAt'] = $expiresAt; - $self['files'] = $files; - - return $self; - } - - /** - * When the download URLs expire. - */ - public function withExpiresAt(string $expiresAt): self - { - $self = clone $this; - $self['expiresAt'] = $expiresAt; - - return $self; - } - - /** - * Result files. Order is not guaranteed. - * - * @param list $files - */ - public function withFiles(array $files): self - { - $self = clone $this; - $self['files'] = $files; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Results/File.php b/src/Batch/BatchCancelResponse/Results/File.php deleted file mode 100644 index 0867a93..0000000 --- a/src/Batch/BatchCancelResponse/Results/File.php +++ /dev/null @@ -1,104 +0,0 @@ - */ - use SdkModel; - - /** - * Compressed file size in bytes. - */ - #[Required] - public int $bytes; - - /** - * Results in this file. - */ - #[Required] - public int $items; - - /** - * Temporary URL for a gzipped NDJSON file. - */ - #[Required] - public string $url; - - /** - * `new File()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * File::with(bytes: ..., items: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new File)->withBytes(...)->withItems(...)->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(int $bytes, int $items, string $url): self - { - $self = new self; - - $self['bytes'] = $bytes; - $self['items'] = $items; - $self['url'] = $url; - - return $self; - } - - /** - * Compressed file size in bytes. - */ - public function withBytes(int $bytes): self - { - $self = clone $this; - $self['bytes'] = $bytes; - - return $self; - } - - /** - * Results in this file. - */ - public function withItems(int $items): self - { - $self = clone $this; - $self['items'] = $items; - - return $self; - } - - /** - * Temporary URL for a gzipped NDJSON file. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Status.php b/src/Batch/BatchCancelResponse/Status.php index 01a1e5a..0f838b1 100644 --- a/src/Batch/BatchCancelResponse/Status.php +++ b/src/Batch/BatchCancelResponse/Status.php @@ -5,19 +5,9 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. */ enum Status: string { - case QUEUED = 'queued'; - - case RUNNING = 'running'; - case CANCELLING = 'cancelling'; - - case COMPLETED = 'completed'; - - case CANCELLED = 'cancelled'; - - case FAILED = 'failed'; } diff --git a/src/Batch/BatchCancelResponse/Timing.php b/src/Batch/BatchCancelResponse/Timing.php index 1e20804..ac27536 100644 --- a/src/Batch/BatchCancelResponse/Timing.php +++ b/src/Batch/BatchCancelResponse/Timing.php @@ -9,21 +9,15 @@ use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type TimingShape = array{ - * completedAt: string|null, createdAt: string, startedAt: string|null - * } + * There is no finish time yet — the batch is still winding down. + * + * @phpstan-type TimingShape = array{createdAt: string, startedAt: string|null} */ final class Timing implements BaseModel { /** @use SdkModel */ use SdkModel; - /** - * When processing finished. Null while active. - */ - #[Required('completed_at')] - public ?string $completedAt; - /** * When the batch was created. */ @@ -31,7 +25,7 @@ final class Timing implements BaseModel public string $createdAt; /** - * When processing started. Null while queued. + * When processing started. Null if it was cancelled while still queued. */ #[Required('started_at')] public ?string $startedAt; @@ -41,13 +35,13 @@ final class Timing implements BaseModel * * To enforce required parameters use * ``` - * Timing::with(completedAt: ..., createdAt: ..., startedAt: ...) + * Timing::with(createdAt: ..., startedAt: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Timing)->withCompletedAt(...)->withCreatedAt(...)->withStartedAt(...) + * (new Timing)->withCreatedAt(...)->withStartedAt(...) * ``` */ public function __construct() @@ -60,31 +54,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - ?string $completedAt, - string $createdAt, - ?string $startedAt - ): self { + public static function with(string $createdAt, ?string $startedAt): self + { $self = new self; - $self['completedAt'] = $completedAt; $self['createdAt'] = $createdAt; $self['startedAt'] = $startedAt; return $self; } - /** - * When processing finished. Null while active. - */ - public function withCompletedAt(?string $completedAt): self - { - $self = clone $this; - $self['completedAt'] = $completedAt; - - return $self; - } - /** * When the batch was created. */ @@ -97,7 +76,7 @@ public function withCreatedAt(string $createdAt): self } /** - * When processing started. Null while queued. + * When processing started. Null if it was cancelled while still queued. */ public function withStartedAt(?string $startedAt): self { From 1d8541856e8aab69cf19e207dbb8984aea0bf686 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 00:42:57 +0000 Subject: [PATCH 3/4] feat(api): api update --- .stats.yml | 4 ++-- src/Batch/BatchGetResultsParams.php | 2 +- src/ServiceContracts/WebContract.php | 8 ++++---- src/Services/BatchRawService.php | 4 ++-- src/Services/BatchService.php | 4 ++-- src/Services/WebService.php | 8 ++++---- src/Web/WebScreenshotParams.php | 4 ++-- src/Web/WebScreenshotParams/Country.php | 2 +- src/Web/WebWebCrawlMdParams.php | 4 ++-- src/Web/WebWebCrawlMdParams/Country.php | 2 +- src/Web/WebWebScrapeHTMLParams.php | 4 ++-- src/Web/WebWebScrapeHTMLParams/Country.php | 2 +- src/Web/WebWebScrapeMdParams.php | 4 ++-- src/Web/WebWebScrapeMdParams/Country.php | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index 06846fb..3b484e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml -openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-758c3a2fbd5b7be61c8e6e0ad2e6a5ec30695747bb675960d888c497647d13d7.yml +openapi_spec_hash: 00002d90bde02f67e174368ae470c597 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchGetResultsParams.php b/src/Batch/BatchGetResultsParams.php index 074f707..ca82a53 100644 --- a/src/Batch/BatchGetResultsParams.php +++ b/src/Batch/BatchGetResultsParams.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @see ContextDev\Services\BatchService::getResults() * diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 42edb5d..575855f 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -163,7 +163,7 @@ public function extractStyleguide( * @api * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -233,7 +233,7 @@ public function search( * @api * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -289,7 +289,7 @@ public function webCrawlMd( * * @param string $url Full URL to scrape (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=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 IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML @@ -361,7 +361,7 @@ public function webScrapeImages( * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=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 IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index b77f2ba..c2088aa 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -37,7 +37,7 @@ public function __construct(private Client $client) {} /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. + * Check progress, and get download links once the batch finishes. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions @@ -128,7 +128,7 @@ public function cancel( /** * @api * - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @param string $batchID ID of the batch to retrieve or cancel * @param array{cursor?: string, limit?: int}|BatchGetResultsParams $params diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index cf5b9e0..4e6cbe6 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. + * Check progress, and get download links once the batch finishes. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions @@ -121,7 +121,7 @@ public function cancel( /** * @api * - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @param string $batchID ID of the batch to retrieve or cancel * @param string $cursor next_cursor from the previous page diff --git a/src/Services/WebService.php b/src/Services/WebService.php index a4a1799..30d0899 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -259,7 +259,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -377,7 +377,7 @@ public function search( * Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages. * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -466,7 +466,7 @@ public function webCrawlMd( * * @param string $url Full URL to scrape (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=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 IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML @@ -599,7 +599,7 @@ public function webScrapeImages( * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=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 IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index bf56e01..0ed6482 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -58,7 +58,7 @@ final class WebScreenshotParams implements BaseModel public ?string $colorScheme; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -216,7 +216,7 @@ public function withColorScheme(ColorScheme|string $colorScheme): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebScreenshotParams/Country.php b/src/Web/WebScreenshotParams/Country.php index 9715cfc..05fbffd 100644 --- a/src/Web/WebScreenshotParams/Country.php +++ b/src/Web/WebScreenshotParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebScreenshotParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index 89a59a0..316c3e5 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -57,7 +57,7 @@ final class WebWebCrawlMdParams implements BaseModel public string $url; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -280,7 +280,7 @@ public function withURL(string $url): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebCrawlMdParams/Country.php b/src/Web/WebWebCrawlMdParams/Country.php index e3c0594..e372d75 100644 --- a/src/Web/WebWebCrawlMdParams/Country.php +++ b/src/Web/WebWebCrawlMdParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebCrawlMdParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index de09678..d58f4e2 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -72,7 +72,7 @@ final class WebWebScrapeHTMLParams implements BaseModel public ?array $actions; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -267,7 +267,7 @@ public function withActions(?array $actions): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebScrapeHTMLParams/Country.php b/src/Web/WebWebScrapeHTMLParams/Country.php index 5588f0a..f8b1c6c 100644 --- a/src/Web/WebWebScrapeHTMLParams/Country.php +++ b/src/Web/WebWebScrapeHTMLParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 63fb55c..8c65497 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -97,7 +97,7 @@ final class WebWebScrapeMdParams implements BaseModel public ?array $actions; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -325,7 +325,7 @@ public function withActions(?array $actions): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebScrapeMdParams/Country.php b/src/Web/WebWebScrapeMdParams/Country.php index 9700534..91fa2f0 100644 --- a/src/Web/WebWebScrapeMdParams/Country.php +++ b/src/Web/WebWebScrapeMdParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeMdParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { From 0ddb1a4285f8e058ea624d7ecc89068c9c0fb290 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 00:43:19 +0000 Subject: [PATCH 4/4] release: 2.7.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ README.md | 2 +- src/Version.php | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 511dd51..d1328ca 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.6.0" + ".": "2.7.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8486fec..1ece4e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 2.7.0 (2026-08-01) + +Full Changelog: [v2.6.0...v2.7.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.6.0...v2.7.0) + +### Features + +* **api:** api update ([1d85418](https://github.com/context-dot-dev/context-php-sdk/commit/1d8541856e8aab69cf19e207dbb8984aea0bf686)) +* **api:** api update ([76e2e1a](https://github.com/context-dot-dev/context-php-sdk/commit/76e2e1ac2a08536679a582f8cd5807a1eab8349a)) +* **api:** api update ([c244d40](https://github.com/context-dot-dev/context-php-sdk/commit/c244d408ae90844b902d0efd9bca304e115f4880)) + ## 2.6.0 (2026-07-31) Full Changelog: [v2.5.0...v2.6.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.5.0...v2.6.0) diff --git a/README.md b/README.md index 2f5e06f..ecf5ee4 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.6.0" +composer require "context-dev/context-dev-php 2.7.0" ``` diff --git a/src/Version.php b/src/Version.php index f690bfb..5d54e5f 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.6.0'; +const VERSION = '2.7.0'; // x-release-please-end