Skip to content

Commit 4acd4a2

Browse files
author
stlc-bot
committed
feat(parse): support WARC archives in parsing and scraping (#2761)
Stainless-Generated-From: df1664d847cbdd4102fb4489031f2173048c2853
1 parent 928123d commit 4acd4a2

7 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎src/Client.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function __construct(
131131
'Accept' => 'application/json',
132132
'User-Agent' => sprintf('context.dev/PHP %s', VERSION),
133133
'X-Stainless-Lang' => 'php',
134-
'X-Stainless-Package-Version' => '2.48.0',
134+
'X-Stainless-Package-Version' => '2.49.0',
135135
'X-Stainless-Arch' => Util::machtype(),
136136
'X-Stainless-OS' => Util::ostype(),
137137
'X-Stainless-Runtime' => php_sapi_name(),

‎src/Parse/ParseHandleParams.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use ContextDev\Parse\ParseHandleParams\Zdr;
1414

1515
/**
16-
* Convert uploaded file bytes into Markdown and optional HTML.
16+
* Convert uploaded file bytes into Markdown and optional HTML. WARC and WARC.GZ archives combine HTTP response, resource, and conversion records in archive order. Revisit and segmented records are skipped. Decoded WARC content is limited to 50 MiB.
1717
*
1818
* @see ContextDev\Services\ParseService::handle()
1919
*
@@ -46,7 +46,7 @@ final class ParseHandleParams implements BaseModel
4646
public ?string $client;
4747

4848
/**
49-
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.
49+
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.
5050
*
5151
* @var value-of<Extension>|null $extension
5252
*/
@@ -168,7 +168,7 @@ public function withClient(string $client): self
168168
}
169169

170170
/**
171-
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.
171+
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.
172172
*
173173
* @param Extension|value-of<Extension> $extension
174174
*/

‎src/Parse/ParseHandleParams/Extension.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
namespace ContextDev\Parse\ParseHandleParams;
66

77
/**
8-
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.
8+
* Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.
99
*/
1010
enum Extension: string
1111
{
12+
case WARC = 'warc';
13+
14+
case WARC_GZ = 'warc.gz';
15+
1216
case TXT = 'txt';
1317

1418
case TEXT = 'text';

‎src/Parse/ParseHandleResponse/Type.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010
enum Type: string
1111
{
12+
case WARC = 'warc';
13+
1214
case HTML = 'html';
1315

1416
case XML = 'xml';

‎src/ServiceContracts/ParseContract.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface ParseContract
2323
*
2424
* @param string|FileParam $body Body param
2525
* @param string $client query param: Optional client identifier used for usage attribution
26-
* @param Extension|value-of<Extension> $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt
26+
* @param Extension|value-of<Extension> $extension Query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.
2727
* @param bool $includeImages Query param: Include image references in Markdown output
2828
* @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output
2929
* @param bool $includeNumberedPages query param: Start each PDF page in the Markdown with a `<!-- page N -->` line, where N is the original 1-based page number

‎src/Services/ParseRawService.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(private Client $client) {}
3131
/**
3232
* @api
3333
*
34-
* Convert uploaded file bytes into Markdown and optional HTML.
34+
* Convert uploaded file bytes into Markdown and optional HTML. WARC and WARC.GZ archives combine HTTP response, resource, and conversion records in archive order. Revisit and segmented records are skipped. Decoded WARC content is limited to 50 MiB.
3535
*
3636
* @param string|FileParam $body Body param
3737
* @param array{

‎src/Services/ParseService.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public function __construct(private Client $client)
3737
/**
3838
* @api
3939
*
40-
* Convert uploaded file bytes into Markdown and optional HTML.
40+
* Convert uploaded file bytes into Markdown and optional HTML. WARC and WARC.GZ archives combine HTTP response, resource, and conversion records in archive order. Revisit and segmented records are skipped. Decoded WARC content is limited to 50 MiB.
4141
*
4242
* @param string|FileParam $body Body param
4343
* @param string $client query param: Optional client identifier used for usage attribution
44-
* @param Extension|value-of<Extension> $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt
44+
* @param Extension|value-of<Extension> $extension Query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, txt, warc, or warc.gz.
4545
* @param bool $includeImages Query param: Include image references in Markdown output
4646
* @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output
4747
* @param bool $includeNumberedPages query param: Start each PDF page in the Markdown with a `<!-- page N -->` line, where N is the original 1-based page number

0 commit comments

Comments
 (0)