Skip to content

Commit 925ed2c

Browse files
feat(api): api update
1 parent f32255d commit 925ed2c

12 files changed

Lines changed: 78 additions & 182 deletions

‎.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-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml
3-
openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-cdff38301573d05fdad8416847402472ff6cb1ce75a9de9f99e8673ddec7c4a6.yml
3+
openapi_spec_hash: 387fe6f53599abb0341764e00bcd0b26
44
config_hash: 2bea1743c84d63bd61f8501a6ea63065

‎api.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ from context.dev.types import (
150150

151151
Methods:
152152

153-
- <code title="get /batch/{batch_id}">client.batch.<a href="./src/context/dev/resources/batch.py">retrieve</a>(batch_id, \*\*<a href="src/context/dev/types/batch_retrieve_params.py">params</a>) -> <a href="./src/context/dev/types/batch_retrieve_response.py">BatchRetrieveResponse</a></code>
153+
- <code title="get /batch/{batch_id}">client.batch.<a href="./src/context/dev/resources/batch.py">retrieve</a>(batch_id) -> <a href="./src/context/dev/types/batch_retrieve_response.py">BatchRetrieveResponse</a></code>
154154
- <code title="get /batch/list">client.batch.<a href="./src/context/dev/resources/batch.py">list</a>(\*\*<a href="src/context/dev/types/batch_list_params.py">params</a>) -> <a href="./src/context/dev/types/batch_list_response.py">BatchListResponse</a></code>
155-
- <code title="post /batch/{batch_id}/cancel">client.batch.<a href="./src/context/dev/resources/batch.py">cancel</a>(batch_id, \*\*<a href="src/context/dev/types/batch_cancel_params.py">params</a>) -> <a href="./src/context/dev/types/batch_cancel_response.py">BatchCancelResponse</a></code>
155+
- <code title="post /batch/{batch_id}/cancel">client.batch.<a href="./src/context/dev/resources/batch.py">cancel</a>(batch_id) -> <a href="./src/context/dev/types/batch_cancel_response.py">BatchCancelResponse</a></code>
156156
- <code title="get /batch/{batch_id}/results">client.batch.<a href="./src/context/dev/resources/batch.py">get_results</a>(batch_id, \*\*<a href="src/context/dev/types/batch_get_results_params.py">params</a>) -> <a href="./src/context/dev/types/batch_get_results_response.py">BatchGetResultsResponse</a></code>
157157
- <code title="post /people/retrieve">client.batch.<a href="./src/context/dev/resources/batch.py">submit</a>(\*\*<a href="src/context/dev/types/batch_submit_params.py">params</a>) -> <a href="./src/context/dev/types/batch_submit_response.py">BatchSubmitResponse</a></code>

‎src/context/dev/resources/batch.py‎

Lines changed: 29 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66

77
import httpx
88

9-
from ..types import (
10-
batch_list_params,
11-
batch_cancel_params,
12-
batch_submit_params,
13-
batch_retrieve_params,
14-
batch_get_results_params,
15-
)
9+
from ..types import batch_list_params, batch_submit_params, batch_get_results_params
1610
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
1711
from .._utils import path_template, maybe_transform, async_maybe_transform
1812
from .._compat import cached_property
@@ -57,7 +51,6 @@ def retrieve(
5751
self,
5852
batch_id: str,
5953
*,
60-
tags: SequenceNotStr[str] | Omit = omit,
6154
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6255
# The extra values given here take precedence over values defined on the client or passed to this method.
6356
extra_headers: Headers | None = None,
@@ -74,10 +67,6 @@ def retrieve(
7467
Args:
7568
batch_id: ID of the batch to retrieve or cancel.
7669
77-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
78-
recorded on the request's usage log and can be used to filter usage on the
79-
dashboard usage page. Up to 20 tags, each 1-50 characters.
80-
8170
extra_headers: Send extra headers
8271
8372
extra_query: Add additional query parameters to the request
@@ -91,11 +80,7 @@ def retrieve(
9180
return self._get(
9281
path_template("/batch/{batch_id}", batch_id=batch_id),
9382
options=make_request_options(
94-
extra_headers=extra_headers,
95-
extra_query=extra_query,
96-
extra_body=extra_body,
97-
timeout=timeout,
98-
query=maybe_transform({"tags": tags}, batch_retrieve_params.BatchRetrieveParams),
83+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
9984
),
10085
cast_to=BatchRetrieveResponse,
10186
)
@@ -105,8 +90,10 @@ def list(
10590
*,
10691
cursor: str | Omit = omit,
10792
limit: int | Omit = omit,
93+
q: str | Omit = omit,
94+
search_type: Literal["exact", "prefix"] | Omit = omit,
10895
status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"] | Omit = omit,
109-
tags: SequenceNotStr[str] | Omit = omit,
96+
tags: str | Omit = omit,
11097
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
11198
# The extra values given here take precedence over values defined on the client or passed to this method.
11299
extra_headers: Headers | None = None,
@@ -124,11 +111,15 @@ def list(
124111
125112
limit: Batches per page. Defaults to 25.
126113
114+
q: Free-text search term, matched against the batch id, crawl source (start URL or
115+
sitemap domain), and tags.
116+
117+
search_type: `prefix` for as-you-type prefix matching (default), `exact` for full-token
118+
matching.
119+
127120
status: Filter by status.
128121
129-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
130-
recorded on the request's usage log and can be used to filter usage on the
131-
dashboard usage page. Up to 20 tags, each 1-50 characters.
122+
tags: Comma-separated list of tags to filter by (matches batches having any of them).
132123
133124
extra_headers: Send extra headers
134125
@@ -149,6 +140,8 @@ def list(
149140
{
150141
"cursor": cursor,
151142
"limit": limit,
143+
"q": q,
144+
"search_type": search_type,
152145
"status": status,
153146
"tags": tags,
154147
},
@@ -162,7 +155,6 @@ def cancel(
162155
self,
163156
batch_id: str,
164157
*,
165-
tags: SequenceNotStr[str] | Omit = omit,
166158
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
167159
# The extra values given here take precedence over values defined on the client or passed to this method.
168160
extra_headers: Headers | None = None,
@@ -178,10 +170,6 @@ def cancel(
178170
Args:
179171
batch_id: ID of the batch to retrieve or cancel.
180172
181-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
182-
recorded on the request's usage log and can be used to filter usage on the
183-
dashboard usage page. Up to 20 tags, each 1-50 characters.
184-
185173
extra_headers: Send extra headers
186174
187175
extra_query: Add additional query parameters to the request
@@ -195,11 +183,7 @@ def cancel(
195183
return self._post(
196184
path_template("/batch/{batch_id}/cancel", batch_id=batch_id),
197185
options=make_request_options(
198-
extra_headers=extra_headers,
199-
extra_query=extra_query,
200-
extra_body=extra_body,
201-
timeout=timeout,
202-
query=maybe_transform({"tags": tags}, batch_cancel_params.BatchCancelParams),
186+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
203187
),
204188
cast_to=BatchCancelResponse,
205189
)
@@ -210,7 +194,6 @@ def get_results(
210194
*,
211195
cursor: str | Omit = omit,
212196
limit: int | Omit = omit,
213-
tags: SequenceNotStr[str] | Omit = omit,
214197
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
215198
# The extra values given here take precedence over values defined on the client or passed to this method.
216199
extra_headers: Headers | None = None,
@@ -231,10 +214,6 @@ def get_results(
231214
limit: Records per page. Defaults to 25. A page can close early so its payload stays
232215
under ~8 MB; rely on next_cursor rather than counting records.
233216
234-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
235-
recorded on the request's usage log and can be used to filter usage on the
236-
dashboard usage page. Up to 20 tags, each 1-50 characters.
237-
238217
extra_headers: Send extra headers
239218
240219
extra_query: Add additional query parameters to the request
@@ -256,7 +235,6 @@ def get_results(
256235
{
257236
"cursor": cursor,
258237
"limit": limit,
259-
"tags": tags,
260238
},
261239
batch_get_results_params.BatchGetResultsParams,
262240
),
@@ -338,7 +316,6 @@ async def retrieve(
338316
self,
339317
batch_id: str,
340318
*,
341-
tags: SequenceNotStr[str] | Omit = omit,
342319
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
343320
# The extra values given here take precedence over values defined on the client or passed to this method.
344321
extra_headers: Headers | None = None,
@@ -355,10 +332,6 @@ async def retrieve(
355332
Args:
356333
batch_id: ID of the batch to retrieve or cancel.
357334
358-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
359-
recorded on the request's usage log and can be used to filter usage on the
360-
dashboard usage page. Up to 20 tags, each 1-50 characters.
361-
362335
extra_headers: Send extra headers
363336
364337
extra_query: Add additional query parameters to the request
@@ -372,11 +345,7 @@ async def retrieve(
372345
return await self._get(
373346
path_template("/batch/{batch_id}", batch_id=batch_id),
374347
options=make_request_options(
375-
extra_headers=extra_headers,
376-
extra_query=extra_query,
377-
extra_body=extra_body,
378-
timeout=timeout,
379-
query=await async_maybe_transform({"tags": tags}, batch_retrieve_params.BatchRetrieveParams),
348+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
380349
),
381350
cast_to=BatchRetrieveResponse,
382351
)
@@ -386,8 +355,10 @@ async def list(
386355
*,
387356
cursor: str | Omit = omit,
388357
limit: int | Omit = omit,
358+
q: str | Omit = omit,
359+
search_type: Literal["exact", "prefix"] | Omit = omit,
389360
status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"] | Omit = omit,
390-
tags: SequenceNotStr[str] | Omit = omit,
361+
tags: str | Omit = omit,
391362
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
392363
# The extra values given here take precedence over values defined on the client or passed to this method.
393364
extra_headers: Headers | None = None,
@@ -405,11 +376,15 @@ async def list(
405376
406377
limit: Batches per page. Defaults to 25.
407378
379+
q: Free-text search term, matched against the batch id, crawl source (start URL or
380+
sitemap domain), and tags.
381+
382+
search_type: `prefix` for as-you-type prefix matching (default), `exact` for full-token
383+
matching.
384+
408385
status: Filter by status.
409386
410-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
411-
recorded on the request's usage log and can be used to filter usage on the
412-
dashboard usage page. Up to 20 tags, each 1-50 characters.
387+
tags: Comma-separated list of tags to filter by (matches batches having any of them).
413388
414389
extra_headers: Send extra headers
415390
@@ -430,6 +405,8 @@ async def list(
430405
{
431406
"cursor": cursor,
432407
"limit": limit,
408+
"q": q,
409+
"search_type": search_type,
433410
"status": status,
434411
"tags": tags,
435412
},
@@ -443,7 +420,6 @@ async def cancel(
443420
self,
444421
batch_id: str,
445422
*,
446-
tags: SequenceNotStr[str] | Omit = omit,
447423
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
448424
# The extra values given here take precedence over values defined on the client or passed to this method.
449425
extra_headers: Headers | None = None,
@@ -459,10 +435,6 @@ async def cancel(
459435
Args:
460436
batch_id: ID of the batch to retrieve or cancel.
461437
462-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
463-
recorded on the request's usage log and can be used to filter usage on the
464-
dashboard usage page. Up to 20 tags, each 1-50 characters.
465-
466438
extra_headers: Send extra headers
467439
468440
extra_query: Add additional query parameters to the request
@@ -476,11 +448,7 @@ async def cancel(
476448
return await self._post(
477449
path_template("/batch/{batch_id}/cancel", batch_id=batch_id),
478450
options=make_request_options(
479-
extra_headers=extra_headers,
480-
extra_query=extra_query,
481-
extra_body=extra_body,
482-
timeout=timeout,
483-
query=await async_maybe_transform({"tags": tags}, batch_cancel_params.BatchCancelParams),
451+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
484452
),
485453
cast_to=BatchCancelResponse,
486454
)
@@ -491,7 +459,6 @@ async def get_results(
491459
*,
492460
cursor: str | Omit = omit,
493461
limit: int | Omit = omit,
494-
tags: SequenceNotStr[str] | Omit = omit,
495462
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
496463
# The extra values given here take precedence over values defined on the client or passed to this method.
497464
extra_headers: Headers | None = None,
@@ -512,10 +479,6 @@ async def get_results(
512479
limit: Records per page. Defaults to 25. A page can close early so its payload stays
513480
under ~8 MB; rely on next_cursor rather than counting records.
514481
515-
tags: Optional comma-separated caller-defined tags for tracking this request. Tags are
516-
recorded on the request's usage log and can be used to filter usage on the
517-
dashboard usage page. Up to 20 tags, each 1-50 characters.
518-
519482
extra_headers: Send extra headers
520483
521484
extra_query: Add additional query parameters to the request
@@ -537,7 +500,6 @@ async def get_results(
537500
{
538501
"cursor": cursor,
539502
"limit": limit,
540-
"tags": tags,
541503
},
542504
batch_get_results_params.BatchGetResultsParams,
543505
),

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from .batch_list_params import BatchListParams as BatchListParams
77
from .web_search_params import WebSearchParams as WebSearchParams
88
from .web_extract_params import WebExtractParams as WebExtractParams
9-
from .batch_cancel_params import BatchCancelParams as BatchCancelParams
109
from .batch_list_response import BatchListResponse as BatchListResponse
1110
from .batch_submit_params import BatchSubmitParams as BatchSubmitParams
1211
from .monitor_list_params import MonitorListParams as MonitorListParams
@@ -15,7 +14,6 @@
1514
from .monitor_run_response import MonitorRunResponse as MonitorRunResponse
1615
from .web_extract_response import WebExtractResponse as WebExtractResponse
1716
from .batch_cancel_response import BatchCancelResponse as BatchCancelResponse
18-
from .batch_retrieve_params import BatchRetrieveParams as BatchRetrieveParams
1917
from .batch_submit_response import BatchSubmitResponse as BatchSubmitResponse
2018
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
2119
from .monitor_create_params import MonitorCreateParams as MonitorCreateParams

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

Lines changed: 0 additions & 18 deletions
This file was deleted.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ class BatchCancelResponse(BaseModel):
147147
status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"]
148148
"""Current state. `completed`, `cancelled`, and `failed` are final."""
149149

150+
tags: List[str]
151+
"""Tags stored on the batch at submission."""
152+
150153
timing: Timing
151154

152155
type: Literal["markdown", "html"]

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from typing_extensions import TypedDict
66

7-
from .._types import SequenceNotStr
8-
97
__all__ = ["BatchGetResultsParams"]
108

119

@@ -19,10 +17,3 @@ class BatchGetResultsParams(TypedDict, total=False):
1917
Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on
2018
next_cursor rather than counting records.
2119
"""
22-
23-
tags: SequenceNotStr[str]
24-
"""Optional comma-separated caller-defined tags for tracking this request.
25-
26-
Tags are recorded on the request's usage log and can be used to filter usage on
27-
the dashboard usage page. Up to 20 tags, each 1-50 characters.
28-
"""

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from typing_extensions import Literal, TypedDict
66

7-
from .._types import SequenceNotStr
8-
97
__all__ = ["BatchListParams"]
108

119

@@ -16,12 +14,20 @@ class BatchListParams(TypedDict, total=False):
1614
limit: int
1715
"""Batches per page. Defaults to 25."""
1816

17+
q: str
18+
"""
19+
Free-text search term, matched against the batch id, crawl source (start URL or
20+
sitemap domain), and tags.
21+
"""
22+
23+
search_type: Literal["exact", "prefix"]
24+
"""
25+
`prefix` for as-you-type prefix matching (default), `exact` for full-token
26+
matching.
27+
"""
28+
1929
status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"]
2030
"""Filter by status."""
2131

22-
tags: SequenceNotStr[str]
23-
"""Optional comma-separated caller-defined tags for tracking this request.
24-
25-
Tags are recorded on the request's usage log and can be used to filter usage on
26-
the dashboard usage page. Up to 20 tags, each 1-50 characters.
27-
"""
32+
tags: str
33+
"""Comma-separated list of tags to filter by (matches batches having any of them)."""

0 commit comments

Comments
 (0)