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-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml
openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a
config_hash: 920678668dd2da6f8966fbf1b8fde4e2
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.10.0 (2026-08-08)

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 ([2f3a923](https://github.com/context-dot-dev/context-php-sdk/commit/2f3a923880a205a86d61f10d2aad236496f56144))

## 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
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;
}
}
2 changes: 1 addition & 1 deletion src/Services/WebRawService.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public function webScrapeImages(
* | HTTP status | Billed? | Meaning |
* | --- | --- | --- |
* | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
* | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
* | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
* | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
* | 404 | No | Target page returned or fingerprinted as not found |
* | 408 | No | Request timed out |
Expand Down
2 changes: 1 addition & 1 deletion src/Services/WebService.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public function webScrapeImages(
* | HTTP status | Billed? | Meaning |
* | --- | --- | --- |
* | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
* | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
* | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
* | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
* | 404 | No | Target page returned or fingerprinted as not found |
* | 408 | No | Request timed out |
Expand Down
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
namespace ContextDev;

// x-release-please-start-version
const VERSION = '2.9.0';
const VERSION = '2.10.0';
// x-release-please-end
27 changes: 27 additions & 0 deletions src/Web/WebWebCrawlMdResponse/Result/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use ContextDev\Core\Conversion\MapOf;
use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\AdditionalMeta;
use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Alternate;
use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Heading;
use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\OpenGraph;
use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter;

Expand All @@ -20,6 +21,7 @@
* @phpstan-import-type TwitterVariants from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter
* @phpstan-import-type AdditionalMetaShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\AdditionalMeta
* @phpstan-import-type AlternateShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Alternate
* @phpstan-import-type HeadingShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Heading
* @phpstan-import-type OpenGraphShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\OpenGraph
* @phpstan-import-type TwitterShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter
*
Expand All @@ -37,6 +39,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 @@ -136,6 +139,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 @@ -245,6 +256,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 @@ -264,6 +276,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 Down Expand Up @@ -291,6 +304,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 @@ -452,6 +466,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
Loading
Loading