Skip to content

Commit ccba916

Browse files
feat(api): api update
1 parent 5b0ef3e commit ccba916

3 files changed

Lines changed: 20 additions & 44 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-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

pkg/cmd/batch.go

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ var batchRetrieve = cli.Command{
2525
Required: true,
2626
PathParam: "batch_id",
2727
},
28-
&requestflag.Flag[[]string]{
29-
Name: "tag",
30-
Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.",
31-
QueryPath: "tags",
32-
},
3328
},
3429
Action: handleBatchRetrieve,
3530
HideHelpCommand: true,
@@ -50,14 +45,24 @@ var batchList = cli.Command{
5045
Usage: "Batches per page. Defaults to 25.",
5146
QueryPath: "limit",
5247
},
48+
&requestflag.Flag[string]{
49+
Name: "q",
50+
Usage: "Free-text search term, matched against the batch id, crawl source (start URL or sitemap domain), and tags.",
51+
QueryPath: "q",
52+
},
53+
&requestflag.Flag[string]{
54+
Name: "search-type",
55+
Usage: "`prefix` for as-you-type prefix matching (default), `exact` for full-token matching.",
56+
QueryPath: "search_type",
57+
},
5358
&requestflag.Flag[string]{
5459
Name: "status",
5560
Usage: "Filter by status.",
5661
QueryPath: "status",
5762
},
58-
&requestflag.Flag[[]string]{
59-
Name: "tag",
60-
Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.",
63+
&requestflag.Flag[string]{
64+
Name: "tags",
65+
Usage: "Comma-separated list of tags to filter by (matches batches having any of them).",
6166
QueryPath: "tags",
6267
},
6368
},
@@ -76,11 +81,6 @@ var batchCancel = cli.Command{
7681
Required: true,
7782
PathParam: "batch_id",
7883
},
79-
&requestflag.Flag[[]string]{
80-
Name: "tag",
81-
Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.",
82-
QueryPath: "tags",
83-
},
8484
},
8585
Action: handleBatchCancel,
8686
HideHelpCommand: true,
@@ -107,11 +107,6 @@ var batchGetResults = cli.Command{
107107
Usage: "Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records.",
108108
QueryPath: "limit",
109109
},
110-
&requestflag.Flag[[]string]{
111-
Name: "tag",
112-
Usage: "Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.",
113-
QueryPath: "tags",
114-
},
115110
},
116111
Action: handleBatchGetResults,
117112
HideHelpCommand: true,
@@ -173,16 +168,9 @@ func handleBatchRetrieve(ctx context.Context, cmd *cli.Command) error {
173168
return err
174169
}
175170

176-
params := contextdev.BatchGetParams{}
177-
178171
var res []byte
179172
options = append(options, option.WithResponseBodyInto(&res))
180-
_, err = client.Batch.Get(
181-
ctx,
182-
cmd.Value("batch-id").(string),
183-
params,
184-
options...,
185-
)
173+
_, err = client.Batch.Get(ctx, cmd.Value("batch-id").(string), options...)
186174
if err != nil {
187175
return err
188176
}
@@ -263,16 +251,9 @@ func handleBatchCancel(ctx context.Context, cmd *cli.Command) error {
263251
return err
264252
}
265253

266-
params := contextdev.BatchCancelParams{}
267-
268254
var res []byte
269255
options = append(options, option.WithResponseBodyInto(&res))
270-
_, err = client.Batch.Cancel(
271-
ctx,
272-
cmd.Value("batch-id").(string),
273-
params,
274-
options...,
275-
)
256+
_, err = client.Batch.Cancel(ctx, cmd.Value("batch-id").(string), options...)
276257
if err != nil {
277258
return err
278259
}

pkg/cmd/batch_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ func TestBatchRetrieve(t *testing.T) {
1717
"--api-key", "string",
1818
"batch", "retrieve",
1919
"--batch-id", "batch_9f2c8a",
20-
"--tag", "production",
21-
"--tag", "team-alpha",
2220
)
2321
})
2422
}
@@ -32,9 +30,10 @@ func TestBatchList(t *testing.T) {
3230
"batch", "list",
3331
"--cursor", "cursor",
3432
"--limit", "1",
33+
"--q", "batch_1a2b",
34+
"--search-type", "exact",
3535
"--status", "queued",
36-
"--tag", "production",
37-
"--tag", "team-alpha",
36+
"--tags", "docs,competitor",
3837
)
3938
})
4039
}
@@ -47,8 +46,6 @@ func TestBatchCancel(t *testing.T) {
4746
"--api-key", "string",
4847
"batch", "cancel",
4948
"--batch-id", "batch_9f2c8a",
50-
"--tag", "production",
51-
"--tag", "team-alpha",
5249
)
5350
})
5451
}
@@ -63,8 +60,6 @@ func TestBatchGetResults(t *testing.T) {
6360
"--batch-id", "batch_9f2c8a",
6461
"--cursor", "cursor",
6562
"--limit", "1",
66-
"--tag", "production",
67-
"--tag", "team-alpha",
6863
)
6964
})
7065
}

0 commit comments

Comments
 (0)