Skip to content

Commit 21c81e4

Browse files
feat(api): api update
1 parent 0468ad1 commit 21c81e4

11 files changed

Lines changed: 200 additions & 171 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: 30
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml
3-
openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d49b84cf1125618f171698ff1ee4ff9a8d04151619cb4a56d650103869834465.yml
3+
openapi_spec_hash: 49b7a6f59dcdff1e2bf88feb6474a562
44
config_hash: daabb160675d86b354711da1e77e5129

‎pkg/cmd/brand.go‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var brandRetrieve = cli.Command{
3030
Required: true,
3131
BodyPath: "type",
3232
},
33-
&requestflag.Flag[string]{
33+
&requestflag.Flag[*string]{
3434
Name: "force-language",
3535
Usage: `Allowed values: "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese", "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi", "fijian", "finnish", "french", "galician", "georgian", "german", "greek", "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean", "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo", "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian", "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili", "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan", "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu", "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba", "zulu".`,
3636
BodyPath: "force_language",
@@ -100,12 +100,12 @@ var brandRetrieve = cli.Command{
100100
Usage: "When set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence.",
101101
BodyPath: "high_confidence_only",
102102
},
103-
&requestflag.Flag[int64]{
103+
&requestflag.Flag[any]{
104104
Name: "mcc",
105105
Usage: "Optional Merchant Category Code (MCC) to help identify the business category or industry.",
106106
BodyPath: "mcc",
107107
},
108-
&requestflag.Flag[float64]{
108+
&requestflag.Flag[any]{
109109
Name: "phone",
110110
Usage: "Optional phone number from the transaction to help verify brand match.",
111111
BodyPath: "phone",
@@ -126,17 +126,22 @@ var brandRetrieveSimplified = cli.Command{
126126
Required: true,
127127
QueryPath: "domain",
128128
},
129-
&requestflag.Flag[int64]{
129+
&requestflag.Flag[*int64]{
130130
Name: "max-age-ms",
131131
Usage: "Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.",
132-
Default: 7776000000,
132+
Default: requestflag.Ptr[int64](7776000000),
133133
QueryPath: "maxAgeMs",
134134
},
135135
&requestflag.Flag[[]string]{
136136
Name: "tag",
137137
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.",
138138
QueryPath: "tags",
139139
},
140+
&requestflag.Flag[string]{
141+
Name: "theme",
142+
Usage: "Optional theme preference used when selecting brand assets.",
143+
QueryPath: "theme",
144+
},
140145
&requestflag.Flag[int64]{
141146
Name: "timeout-ms",
142147
Usage: "Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).",

‎pkg/cmd/brand_test.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestBrandRetrieve(t *testing.T) {
1515
t,
1616
"--api-key", "string",
1717
"brand", "retrieve",
18-
"--domain", "domain",
18+
"--domain", "xxx",
1919
"--type", "by_domain",
2020
"--force-language", "afrikaans",
2121
"--max-age-ms", "0",
@@ -29,7 +29,7 @@ func TestBrandRetrieve(t *testing.T) {
2929
t.Run("piping data", func(t *testing.T) {
3030
// Test piping YAML data over stdin
3131
pipeData := []byte("" +
32-
"domain: domain\n" +
32+
"domain: xxx\n" +
3333
"type: by_domain\n" +
3434
"force_language: afrikaans\n" +
3535
"maxAgeMs: 0\n" +
@@ -53,10 +53,11 @@ func TestBrandRetrieveSimplified(t *testing.T) {
5353
t,
5454
"--api-key", "string",
5555
"brand", "retrieve-simplified",
56-
"--domain", "domain",
57-
"--max-age-ms", "86400000",
56+
"--domain", "xxx",
57+
"--max-age-ms", "0",
5858
"--tag", "production",
5959
"--tag", "team-alpha",
60+
"--theme", "light",
6061
"--timeout-ms", "1000",
6162
)
6263
})

‎pkg/cmd/industry_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestIndustryRetrieveNaics(t *testing.T) {
1515
t,
1616
"--api-key", "string",
1717
"industry", "retrieve-naics",
18-
"--input", "input",
18+
"--input", "xxxx",
1919
"--max-results", "1",
2020
"--min-results", "1",
2121
"--tag", "production",
@@ -32,7 +32,7 @@ func TestIndustryRetrieveSic(t *testing.T) {
3232
t,
3333
"--api-key", "string",
3434
"industry", "retrieve-sic",
35-
"--input", "input",
35+
"--input", "xxxx",
3636
"--max-results", "1",
3737
"--min-results", "1",
3838
"--tag", "production",

‎pkg/cmd/monitor.go‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,52 +202,52 @@ var monitorsList = cli.Command{
202202
Flags: []cli.Flag{
203203
&requestflag.Flag[string]{
204204
Name: "change-detection-type",
205-
Usage: `Allowed values: "exact", "semantic".`,
205+
Usage: "Filter by change detection type.",
206206
QueryPath: "change_detection_type",
207207
},
208208
&requestflag.Flag[string]{
209209
Name: "cursor",
210+
Usage: "Opaque pagination cursor from a previous response.",
210211
QueryPath: "cursor",
211212
},
212213
&requestflag.Flag[int64]{
213214
Name: "limit",
214-
Default: 25,
215+
Usage: "Maximum number of items to return per page (1-100). Defaults to 25.",
215216
QueryPath: "limit",
216217
},
217218
&requestflag.Flag[string]{
218219
Name: "q",
219220
Usage: "Free-text search term, matched against the fields named in `search_by`.",
220221
QueryPath: "q",
221222
},
222-
&requestflag.Flag[[]string]{
223+
&requestflag.Flag[any]{
223224
Name: "search-by",
224225
Usage: "Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors.",
225226
QueryPath: "search_by",
226227
},
227228
&requestflag.Flag[string]{
228229
Name: "search-type",
229230
Usage: "`prefix` for as-you-type prefix matching (default), `exact` for full-token matching.",
230-
Default: "prefix",
231231
QueryPath: "search_type",
232232
},
233233
&requestflag.Flag[string]{
234234
Name: "status",
235-
Usage: "Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`.",
235+
Usage: "Filter monitors by lifecycle status.",
236236
QueryPath: "status",
237237
},
238238
&requestflag.Flag[string]{
239239
Name: "tag",
240240
Usage: "Filter to items that have this tag.",
241241
QueryPath: "tag",
242242
},
243-
&requestflag.Flag[[]string]{
243+
&requestflag.Flag[any]{
244244
Name: "tag",
245245
Usage: "Comma-separated list of tags to filter by (matches monitors having any of them).",
246246
QueryPath: "tags",
247247
},
248248
&requestflag.Flag[string]{
249249
Name: "target-type",
250-
Usage: `Allowed values: "page", "sitemap", "extract".`,
250+
Usage: "Filter by target type.",
251251
QueryPath: "target_type",
252252
},
253253
},
@@ -277,24 +277,27 @@ var monitorsListAccountChanges = cli.Command{
277277
Flags: []cli.Flag{
278278
&requestflag.Flag[string]{
279279
Name: "change-detection-type",
280-
Usage: `Allowed values: "exact", "semantic".`,
280+
Usage: "Filter by change detection type.",
281281
QueryPath: "change_detection_type",
282282
},
283283
&requestflag.Flag[string]{
284284
Name: "cursor",
285+
Usage: "Opaque pagination cursor from a previous response.",
285286
QueryPath: "cursor",
286287
},
287288
&requestflag.Flag[int64]{
288289
Name: "limit",
289-
Default: 25,
290+
Usage: "Maximum number of items to return per page (1-100). Defaults to 25.",
290291
QueryPath: "limit",
291292
},
292293
&requestflag.Flag[string]{
293294
Name: "monitor-id",
295+
Usage: "Filter changes to a single monitor.",
294296
QueryPath: "monitor_id",
295297
},
296298
&requestflag.Flag[any]{
297299
Name: "since",
300+
Usage: "Only include items at or after this ISO 8601 timestamp.",
298301
QueryPath: "since",
299302
},
300303
&requestflag.Flag[string]{
@@ -304,11 +307,12 @@ var monitorsListAccountChanges = cli.Command{
304307
},
305308
&requestflag.Flag[string]{
306309
Name: "target-type",
307-
Usage: `Allowed values: "page", "sitemap", "extract".`,
310+
Usage: "Filter by target type.",
308311
QueryPath: "target_type",
309312
},
310313
&requestflag.Flag[any]{
311314
Name: "until",
315+
Usage: "Only include items before this ISO 8601 timestamp.",
312316
QueryPath: "until",
313317
},
314318
},
@@ -323,16 +327,17 @@ var monitorsListAccountRuns = cli.Command{
323327
Flags: []cli.Flag{
324328
&requestflag.Flag[string]{
325329
Name: "cursor",
330+
Usage: "Opaque pagination cursor from a previous response.",
326331
QueryPath: "cursor",
327332
},
328333
&requestflag.Flag[int64]{
329334
Name: "limit",
330-
Default: 25,
335+
Usage: "Maximum number of items to return per page (1-100). Defaults to 25.",
331336
QueryPath: "limit",
332337
},
333338
&requestflag.Flag[string]{
334339
Name: "status",
335-
Usage: "Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run).",
340+
Usage: "Filter runs by lifecycle status.",
336341
QueryPath: "status",
337342
},
338343
},
@@ -352,15 +357,17 @@ var monitorsListChanges = cli.Command{
352357
},
353358
&requestflag.Flag[string]{
354359
Name: "cursor",
360+
Usage: "Opaque pagination cursor from a previous response.",
355361
QueryPath: "cursor",
356362
},
357363
&requestflag.Flag[int64]{
358364
Name: "limit",
359-
Default: 25,
365+
Usage: "Maximum number of items to return per page (1-100). Defaults to 25.",
360366
QueryPath: "limit",
361367
},
362368
&requestflag.Flag[any]{
363369
Name: "since",
370+
Usage: "Only include items at or after this ISO 8601 timestamp.",
364371
QueryPath: "since",
365372
},
366373
&requestflag.Flag[string]{
@@ -370,6 +377,7 @@ var monitorsListChanges = cli.Command{
370377
},
371378
&requestflag.Flag[any]{
372379
Name: "until",
380+
Usage: "Only include items before this ISO 8601 timestamp.",
373381
QueryPath: "until",
374382
},
375383
},
@@ -389,16 +397,17 @@ var monitorsListRuns = cli.Command{
389397
},
390398
&requestflag.Flag[string]{
391399
Name: "cursor",
400+
Usage: "Opaque pagination cursor from a previous response.",
392401
QueryPath: "cursor",
393402
},
394403
&requestflag.Flag[int64]{
395404
Name: "limit",
396-
Default: 25,
405+
Usage: "Maximum number of items to return per page (1-100). Defaults to 25.",
397406
QueryPath: "limit",
398407
},
399408
&requestflag.Flag[string]{
400409
Name: "status",
401-
Usage: "Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run).",
410+
Usage: "Filter runs by lifecycle status.",
402411
QueryPath: "status",
403412
},
404413
},

‎pkg/cmd/monitor_test.go‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ func TestMonitorsList(t *testing.T) {
178178
"--change-detection-type", "exact",
179179
"--cursor", "cursor",
180180
"--limit", "1",
181-
"--q", "q",
182-
"--search-by", "name",
181+
"--q", "pricing",
182+
"--search-by", "[name]",
183183
"--search-type", "exact",
184184
"--status", "active",
185-
"--tag", "tag",
186-
"--tag", "string",
185+
"--tag", "pricing",
186+
"--tag", "[x]",
187187
"--target-type", "page",
188188
)
189189
})
@@ -211,11 +211,11 @@ func TestMonitorsListAccountChanges(t *testing.T) {
211211
"--change-detection-type", "exact",
212212
"--cursor", "cursor",
213213
"--limit", "1",
214-
"--monitor-id", "monitor_id",
215-
"--since", "'2019-12-27T18:11:19.117Z'",
216-
"--tag", "tag",
214+
"--monitor-id", "mon_123",
215+
"--since", "'2026-06-01T00:00:00Z'",
216+
"--tag", "pricing",
217217
"--target-type", "page",
218-
"--until", "'2019-12-27T18:11:19.117Z'",
218+
"--until", "'2026-06-28T00:00:00Z'",
219219
)
220220
})
221221
}
@@ -244,9 +244,9 @@ func TestMonitorsListChanges(t *testing.T) {
244244
"--monitor-id", "mon_123",
245245
"--cursor", "cursor",
246246
"--limit", "1",
247-
"--since", "'2019-12-27T18:11:19.117Z'",
248-
"--tag", "tag",
249-
"--until", "'2019-12-27T18:11:19.117Z'",
247+
"--since", "'2026-06-01T00:00:00Z'",
248+
"--tag", "pricing",
249+
"--until", "'2026-06-28T00:00:00Z'",
250250
)
251251
})
252252
}

‎pkg/cmd/parse.go‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
var parseHandle = requestflag.WithInnerFlags(cli.Command{
2020
Name: "handle",
21-
Usage: "Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes\ninto LLM-usable Markdown. The base request costs 1 credit. When OCR runs\n(requires ocr=true), the entire call costs 5 credits; ocr=true requests where no\nOCR ends up running still cost 1 credit.",
21+
Usage: "Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes\ninto LLM-usable Markdown.",
2222
Suggest: true,
2323
Flags: []cli.Flag{
2424
&requestflag.Flag[string]{
@@ -27,36 +27,41 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
2727
BodyRoot: true,
2828
FileInput: true,
2929
},
30+
&requestflag.Flag[string]{
31+
Name: "client",
32+
Usage: "Optional client identifier used for usage attribution.",
33+
QueryPath: "client",
34+
},
3035
&requestflag.Flag[string]{
3136
Name: "extension",
32-
Usage: `Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf").`,
37+
Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.",
3338
QueryPath: "extension",
3439
},
35-
&requestflag.Flag[bool]{
40+
&requestflag.Flag[any]{
3641
Name: "include-images",
3742
Usage: "Include image references in Markdown output",
3843
Default: false,
3944
QueryPath: "includeImages",
4045
},
41-
&requestflag.Flag[bool]{
46+
&requestflag.Flag[any]{
4247
Name: "include-links",
4348
Usage: "Preserve hyperlinks in Markdown output",
4449
Default: true,
4550
QueryPath: "includeLinks",
4651
},
47-
&requestflag.Flag[bool]{
52+
&requestflag.Flag[any]{
4853
Name: "ocr",
49-
Usage: "Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1.",
54+
Usage: "When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback.",
5055
Default: false,
5156
QueryPath: "ocr",
5257
},
5358
&requestflag.Flag[map[string]any]{
5459
Name: "pdf",
55-
Usage: "PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range.",
60+
Usage: `PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.`,
5661
Default: map[string]any{},
5762
QueryPath: "pdf",
5863
},
59-
&requestflag.Flag[bool]{
64+
&requestflag.Flag[any]{
6065
Name: "shorten-base64-images",
6166
Usage: "Shorten base64-encoded image data in the Markdown output",
6267
Default: true,
@@ -67,7 +72,7 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
6772
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.",
6873
QueryPath: "tags",
6974
},
70-
&requestflag.Flag[bool]{
75+
&requestflag.Flag[any]{
7176
Name: "use-main-content-only",
7277
Usage: "Extract only the main content from HTML-like inputs",
7378
Default: false,

0 commit comments

Comments
 (0)