Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.9.0"
".": "2.10.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 40
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml
openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-01745494602c4845bf7cf84a8f7449d8e53546eb096e3aa6949b89b452c5c90e.yml
openapi_spec_hash: dd4856e9595fab7a4aaa32a040c3060c
config_hash: 920678668dd2da6f8966fbf1b8fde4e2
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 2.10.0 (2026-08-14)

Full Changelog: [v2.9.0...v2.10.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.9.0...v2.10.0)

### Features

* **api:** api update ([9c6bfd1](https://github.com/context-dot-dev/context-php-sdk/commit/9c6bfd1c14cdb0394a17f4d26c005c902b365a1e))
* **api:** api update ([0e1448d](https://github.com/context-dot-dev/context-php-sdk/commit/0e1448d609afec7df8d16031c39922d6b8cc5cba))
* **api:** api update ([2f3a923](https://github.com/context-dot-dev/context-php-sdk/commit/2f3a923880a205a86d61f10d2aad236496f56144))


### Chores

* **internal:** codegen related update ([a1ec0f0](https://github.com/context-dot-dev/context-php-sdk/commit/a1ec0f0938eef801f1d08821904a5c2dba617583))

## 2.9.0 (2026-08-07)

Full Changelog: [v2.8.0...v2.9.0](https://github.com/context-dot-dev/context-php-sdk/compare/v2.8.0...v2.9.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte
<!-- x-release-please-start-version -->

```
composer require "context-dev/context-dev-php 2.9.0"
composer require "context-dev/context-dev-php 2.10.0"
```

<!-- x-release-please-end -->
Expand Down
4 changes: 2 additions & 2 deletions src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class ScrapedPage implements BaseModel
public string $url;

/**
* Raw page HTML. Present on html batches.
* Page HTML. Present on html batches, and on markdown batches submitted with `options.includeHTML`.
*/
#[Optional]
public ?string $html;
Expand Down Expand Up @@ -215,7 +215,7 @@ public function withURL(string $url): self
}

/**
* Raw page HTML. Present on html batches.
* Page HTML. Present on html batches, and on markdown batches submitted with `options.includeHTML`.
*/
public function withHTML(string $html): self
{
Expand Down
27 changes: 27 additions & 0 deletions src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\AdditionalMeta;
use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Alternate;
use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Heading;
use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\OpenGraph;
use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter;
use ContextDev\Core\Attributes\Optional;
Expand All @@ -22,6 +23,7 @@
* @phpstan-import-type TwitterVariants from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter
* @phpstan-import-type AdditionalMetaShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\AdditionalMeta
* @phpstan-import-type AlternateShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Alternate
* @phpstan-import-type HeadingShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Heading
* @phpstan-import-type OpenGraphShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\OpenGraph
* @phpstan-import-type TwitterShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter
*
Expand All @@ -34,6 +36,7 @@
* canonicalURL?: string|null,
* description?: string|null,
* favicon?: string|null,
* headings?: list<Heading|HeadingShape>|null,
* image?: string|null,
* jsonLd?: list<array<string,mixed>>|null,
* keywords?: list<string>|null,
Expand Down Expand Up @@ -104,6 +107,14 @@ final class Metadata implements BaseModel
#[Optional]
public ?string $favicon;

/**
* Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none.
*
* @var list<Heading>|null $headings
*/
#[Optional(list: Heading::class)]
public ?array $headings;

/**
* Primary resolved preview image from Open Graph, Twitter, or image metadata.
*/
Expand Down Expand Up @@ -204,6 +215,7 @@ public function __construct()
*
* @param array<string,AdditionalMetaShape>|null $additionalMeta
* @param list<Alternate|AlternateShape>|null $alternates
* @param list<Heading|HeadingShape>|null $headings
* @param list<array<string,mixed>>|null $jsonLd
* @param list<string>|null $keywords
* @param array<string,OpenGraphShape>|null $openGraph
Expand All @@ -218,6 +230,7 @@ public static function with(
?string $canonicalURL = null,
?string $description = null,
?string $favicon = null,
?array $headings = null,
?string $image = null,
?array $jsonLd = null,
?array $keywords = null,
Expand All @@ -241,6 +254,7 @@ public static function with(
null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL;
null !== $description && $self['description'] = $description;
null !== $favicon && $self['favicon'] = $favicon;
null !== $headings && $self['headings'] = $headings;
null !== $image && $self['image'] = $image;
null !== $jsonLd && $self['jsonLd'] = $jsonLd;
null !== $keywords && $self['keywords'] = $keywords;
Expand Down Expand Up @@ -348,6 +362,19 @@ public function withFavicon(string $favicon): self
return $self;
}

/**
* Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none.
*
* @param list<Heading|HeadingShape> $headings
*/
public function withHeadings(array $headings): self
{
$self = clone $this;
$self['headings'] = $headings;

return $self;
}

/**
* Primary resolved preview image from Open Graph, Twitter, or image metadata.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

declare(strict_types=1);

namespace ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata;

use ContextDev\Core\Attributes\Required;
use ContextDev\Core\Concerns\SdkModel;
use ContextDev\Core\Contracts\BaseModel;

/**
* @phpstan-type HeadingShape = array{level: int, text: string}
*/
final class Heading implements BaseModel
{
/** @use SdkModel<HeadingShape> */
use SdkModel;

/**
* Heading level, 1–6 (from h1–h6).
*/
#[Required]
public int $level;

/**
* Heading text with whitespace collapsed, truncated to 1000 characters.
*/
#[Required]
public string $text;

/**
* `new Heading()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Heading::with(level: ..., text: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Heading)->withLevel(...)->withText(...)
* ```
*/
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 $level, string $text): self
{
$self = new self;

$self['level'] = $level;
$self['text'] = $text;

return $self;
}

/**
* Heading level, 1–6 (from h1–h6).
*/
public function withLevel(int $level): self
{
$self = clone $this;
$self['level'] = $level;

return $self;
}

/**
* Heading text with whitespace collapsed, truncated to 1000 characters.
*/
public function withText(string $text): self
{
$self = clone $this;
$self['text'] = $text;

return $self;
}
}
43 changes: 10 additions & 33 deletions src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@

namespace ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options;

use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr;
use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr\UnionMember1;
use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse;
use ContextDev\Core\Attributes\Optional;
use ContextDev\Core\Concerns\SdkModel;
use ContextDev\Core\Contracts\BaseModel;

/**
* PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
*
* @phpstan-import-type OcrVariants from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr
* @phpstan-import-type ShouldParseVariants from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse
* @phpstan-import-type OcrShape from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr
* @phpstan-import-type ShouldParseShape from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse
*
* @phpstan-type PdfShape = array{
* end?: int|null,
* ocr?: OcrShape|null,
* shouldParse?: ShouldParseShape|null,
* start?: int|null,
* end?: int|null, ocr?: bool|null, shouldParse?: bool|null, start?: int|null
* }
*/
final class Pdf implements BaseModel
Expand All @@ -39,19 +28,15 @@ final class Pdf implements BaseModel

/**
* When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.
*
* @var OcrVariants|null $ocr
*/
#[Optional(union: Ocr::class)]
public bool|string|null $ocr;
#[Optional]
public ?bool $ocr;

/**
* When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.
*
* @var ShouldParseVariants|null $shouldParse
*/
#[Optional(union: ShouldParse::class)]
public bool|string|null $shouldParse;
#[Optional]
public ?bool $shouldParse;

/**
* First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Expand All @@ -68,14 +53,11 @@ public function __construct()
* Construct an instance from the required parameters.
*
* You must use named parameters to construct any parameters with a default value.
*
* @param OcrShape|null $ocr
* @param ShouldParseShape|null $shouldParse
*/
public static function with(
?int $end = null,
bool|UnionMember1|string|null $ocr = null,
bool|ShouldParse\UnionMember1|string|null $shouldParse = null,
?bool $ocr = null,
?bool $shouldParse = null,
?int $start = null,
): self {
$self = new self;
Expand All @@ -101,10 +83,8 @@ public function withEnd(int $end): self

/**
* When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs.
*
* @param OcrShape $ocr
*/
public function withOcr(bool|UnionMember1|string $ocr): self
public function withOcr(bool $ocr): self
{
$self = clone $this;
$self['ocr'] = $ocr;
Expand All @@ -114,12 +94,9 @@ public function withOcr(bool|UnionMember1|string $ocr): self

/**
* When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned.
*
* @param ShouldParseShape $shouldParse
*/
public function withShouldParse(
bool|ShouldParse\UnionMember1|string $shouldParse,
): self {
public function withShouldParse(bool $shouldParse): self
{
$self = clone $this;
$self['shouldParse'] = $shouldParse;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading