Skip to content

Commit 3688eab

Browse files
feat(api): api update
1 parent 63b8964 commit 3688eab

2 files changed

Lines changed: 24 additions & 79 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 37
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml
3-
openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml
3+
openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc
44
config_hash: 2bea1743c84d63bd61f8501a6ea63065

‎src/context/dev/types/batch_cancel_response.py‎

Lines changed: 22 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,45 @@
44
from typing_extensions import Literal
55

66
from .intake import Intake
7-
from .failure import Failure
87
from .._models import BaseModel
98
from .crawl_controls import CrawlControls
109
from .page_error_count import PageErrorCount
1110

12-
__all__ = ["BatchCancelResponse", "Credits", "Progress", "Results", "ResultsFile", "Timing", "KeyMetadata"]
11+
__all__ = ["BatchCancelResponse", "Credits", "Progress", "Timing", "KeyMetadata"]
1312

1413

1514
class Credits(BaseModel):
16-
"""What this batch has done to your credit balance."""
17-
18-
net: int
19-
"""`reserved` minus `refunded` — what the batch has cost so far.
20-
21-
Equal to `reserved` until the batch settles.
22-
"""
23-
24-
refunded: int
25-
"""Credits returned for pages that did not succeed.
26-
27-
Stays 0 until the batch reaches a final status, then settles in one movement.
28-
"""
15+
"""What this batch cost so far."""
2916

3017
reserved: int
31-
"""Credits debited from your balance the moment the batch was accepted.
18+
"""Credits debited at submission.
3219
33-
This is a charge, not a forecast — the whole amount leaves the balance up front.
20+
The unspent remainder is refunded once the batch settles — read
21+
`credits.refunded` from GET /batch/{batch_id} then.
3422
"""
3523

3624

3725
class Progress(BaseModel):
38-
"""Pages attempted so far. Use `status` to check completion."""
26+
"""How far the batch got before cancellation."""
3927

4028
failed: int
41-
"""Pages that could not be scraped."""
29+
"""Pages that could not be scraped before the request landed."""
4230

4331
pending: int
44-
"""Reserved pages not yet attempted.
45-
46-
A cancelled batch keeps reporting the URLs it never reached; a crawl whose
47-
`input.reserved_is_ceiling` is true reports 0 once final, because its unspent
48-
budget was never real pages.
49-
"""
32+
"""Reserved pages that will now be skipped, and refunded when the batch settles."""
5033

5134
succeeded: int
52-
"""Pages scraped successfully."""
53-
54-
55-
class ResultsFile(BaseModel):
56-
bytes: int
57-
"""Compressed file size in bytes."""
58-
59-
items: int
60-
"""Results in this file."""
61-
62-
url: str
63-
"""Temporary URL for a gzipped NDJSON file."""
64-
65-
66-
class Results(BaseModel):
67-
"""
68-
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.
69-
"""
70-
71-
expires_at: str
72-
"""When the download URLs expire."""
73-
74-
files: List[ResultsFile]
75-
"""Result files. Order is not guaranteed."""
35+
"""Pages scraped successfully before the request landed."""
7636

7737

7838
class Timing(BaseModel):
79-
completed_at: Optional[str] = None
80-
"""When processing finished. Null while active."""
39+
"""There is no finish time yet — the batch is still winding down."""
8140

8241
created_at: str
8342
"""When the batch was created."""
8443

8544
started_at: Optional[str] = None
86-
"""When processing started. Null while queued."""
45+
"""When processing started. Null if it was cancelled while still queued."""
8746

8847

8948
class KeyMetadata(BaseModel):
@@ -98,7 +57,7 @@ class KeyMetadata(BaseModel):
9857

9958
class BatchCancelResponse(BaseModel):
10059
id: str
101-
"""Batch ID used to retrieve or cancel the job."""
60+
"""Batch ID."""
10261

10362
crawl: Optional[CrawlControls] = None
10463
"""
@@ -107,48 +66,34 @@ class BatchCancelResponse(BaseModel):
10766
"""
10867

10968
credits: Credits
110-
"""What this batch has done to your credit balance."""
111-
112-
failure: Optional[Failure] = None
113-
"""
114-
A failure of the batch as a whole, distinct from the per-page failures in
115-
`page_errors`.
116-
"""
69+
"""What this batch cost so far."""
11770

11871
format: Literal["markdown", "html"]
119-
"""What each page is returned as.
120-
121-
Matches `input.data.format` on the submit request.
122-
"""
72+
"""What each page is returned as."""
12373

12474
input: Intake
12575
"""What submission took in, and what it charged for."""
12676

12777
mode: Literal["scrape", "crawl"]
128-
"""How pages were selected. Matches `input.mode` on the submit request."""
78+
"""How pages were selected."""
12979

13080
page_errors: List[PageErrorCount]
131-
"""Individual page failures grouped by error code, sorted by count.
132-
133-
Unrelated to `failure`, which is the batch itself failing.
134-
"""
81+
"""Page failures so far, grouped by error code and sorted by count."""
13582

13683
progress: Progress
137-
"""Pages attempted so far. Use `status` to check completion."""
84+
"""How far the batch got before cancellation."""
13885

139-
results: Optional[Results] = None
140-
"""
141-
Download links, available once the batch reaches a final status and null before
142-
then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
143-
"""
86+
status: Literal["cancelling"]
87+
"""Always `cancelling`.
14488
145-
status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"]
146-
"""Current state. `completed`, `cancelled`, and `failed` are final."""
89+
Work already in flight finishes; the batch reaches `cancelled` shortly after.
90+
"""
14791

14892
tags: List[str]
14993
"""Tags stored on the batch at submission."""
15094

15195
timing: Timing
96+
"""There is no finish time yet — the batch is still winding down."""
15297

15398
key_metadata: Optional[KeyMetadata] = None
15499
"""API key usage for this request."""

0 commit comments

Comments
 (0)