Skip to content

Commit 0468ad1

Browse files
feat(api): api update
1 parent 349f90c commit 0468ad1

13 files changed

Lines changed: 174 additions & 2 deletions

‎.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-fb56935a194e69348fecd985f7cf8b249795b46af2fb32f6c5c8ef648cf10c15.yml
3-
openapi_spec_hash: 7260a560474283b7ad6ac5d426058ac9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml
3+
openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2
44
config_hash: daabb160675d86b354711da1e77e5129

‎pkg/cmd/ai.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ var aiExtractProduct = cli.Command{
3131
Default: 604800000,
3232
BodyPath: "maxAgeMs",
3333
},
34+
&requestflag.Flag[[]string]{
35+
Name: "tag",
36+
Usage: "Optional 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.",
37+
BodyPath: "tags",
38+
},
3439
&requestflag.Flag[int64]{
3540
Name: "timeout-ms",
3641
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).",
@@ -62,6 +67,11 @@ var aiExtractProducts = cli.Command{
6267
Usage: "Maximum number of products to extract.",
6368
BodyPath: "maxProducts",
6469
},
70+
&requestflag.Flag[[]string]{
71+
Name: "tag",
72+
Usage: "Optional 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.",
73+
BodyPath: "tags",
74+
},
6575
&requestflag.Flag[int64]{
6676
Name: "timeout-ms",
6777
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/ai_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func TestAIExtractProduct(t *testing.T) {
1717
"ai", "extract-product",
1818
"--url", "https://example.com",
1919
"--max-age-ms", "0",
20+
"--tag", "production",
21+
"--tag", "team-alpha",
2022
"--timeout-ms", "1000",
2123
)
2224
})
@@ -26,6 +28,9 @@ func TestAIExtractProduct(t *testing.T) {
2628
pipeData := []byte("" +
2729
"url: https://example.com\n" +
2830
"maxAgeMs: 0\n" +
31+
"tags:\n" +
32+
" - production\n" +
33+
" - team-alpha\n" +
2934
"timeoutMS: 1000\n")
3035
mocktest.TestRunMockTestWithPipeAndFlags(
3136
t, pipeData,
@@ -45,6 +50,8 @@ func TestAIExtractProducts(t *testing.T) {
4550
"--domain", "domain",
4651
"--max-age-ms", "0",
4752
"--max-products", "1",
53+
"--tag", "production",
54+
"--tag", "team-alpha",
4855
"--timeout-ms", "1000",
4956
)
5057
})
@@ -55,6 +62,9 @@ func TestAIExtractProducts(t *testing.T) {
5562
"domain: domain\n" +
5663
"maxAgeMs: 0\n" +
5764
"maxProducts: 1\n" +
65+
"tags:\n" +
66+
" - production\n" +
67+
" - team-alpha\n" +
5868
"timeoutMS: 1000\n")
5969
mocktest.TestRunMockTestWithPipeAndFlags(
6070
t, pipeData,

‎pkg/cmd/brand.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ var brandRetrieve = cli.Command{
4545
Usage: "Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data.",
4646
BodyPath: "maxSpeed",
4747
},
48+
&requestflag.Flag[[]string]{
49+
Name: "tag",
50+
Usage: "Optional 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.",
51+
BodyPath: "tags",
52+
},
4853
&requestflag.Flag[int64]{
4954
Name: "timeout-ms",
5055
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).",
@@ -127,6 +132,11 @@ var brandRetrieveSimplified = cli.Command{
127132
Default: 7776000000,
128133
QueryPath: "maxAgeMs",
129134
},
135+
&requestflag.Flag[[]string]{
136+
Name: "tag",
137+
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.",
138+
QueryPath: "tags",
139+
},
130140
&requestflag.Flag[int64]{
131141
Name: "timeout-ms",
132142
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ func TestBrandRetrieve(t *testing.T) {
2020
"--force-language", "afrikaans",
2121
"--max-age-ms", "0",
2222
"--max-speed=true",
23+
"--tag", "production",
24+
"--tag", "team-alpha",
2325
"--timeout-ms", "1000",
2426
)
2527
})
@@ -32,6 +34,9 @@ func TestBrandRetrieve(t *testing.T) {
3234
"force_language: afrikaans\n" +
3335
"maxAgeMs: 0\n" +
3436
"maxSpeed: true\n" +
37+
"tags:\n" +
38+
" - production\n" +
39+
" - team-alpha\n" +
3540
"timeoutMS: 1000\n")
3641
mocktest.TestRunMockTestWithPipeAndFlags(
3742
t, pipeData,
@@ -50,6 +55,8 @@ func TestBrandRetrieveSimplified(t *testing.T) {
5055
"brand", "retrieve-simplified",
5156
"--domain", "domain",
5257
"--max-age-ms", "86400000",
58+
"--tag", "production",
59+
"--tag", "team-alpha",
5360
"--timeout-ms", "1000",
5461
)
5562
})

‎pkg/cmd/industry.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ var industryRetrieveNaics = cli.Command{
3737
Default: 1,
3838
QueryPath: "minResults",
3939
},
40+
&requestflag.Flag[[]string]{
41+
Name: "tag",
42+
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.",
43+
QueryPath: "tags",
44+
},
4045
&requestflag.Flag[int64]{
4146
Name: "timeout-ms",
4247
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).",
@@ -70,6 +75,11 @@ var industryRetrieveSic = cli.Command{
7075
Default: 1,
7176
QueryPath: "minResults",
7277
},
78+
&requestflag.Flag[[]string]{
79+
Name: "tag",
80+
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.",
81+
QueryPath: "tags",
82+
},
7383
&requestflag.Flag[int64]{
7484
Name: "timeout-ms",
7585
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/industry_test.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func TestIndustryRetrieveNaics(t *testing.T) {
1818
"--input", "input",
1919
"--max-results", "1",
2020
"--min-results", "1",
21+
"--tag", "production",
22+
"--tag", "team-alpha",
2123
"--timeout-ms", "1000",
2224
)
2325
})
@@ -33,6 +35,8 @@ func TestIndustryRetrieveSic(t *testing.T) {
3335
"--input", "input",
3436
"--max-results", "1",
3537
"--min-results", "1",
38+
"--tag", "production",
39+
"--tag", "team-alpha",
3640
"--timeout-ms", "1000",
3741
"--type", "original_sic",
3842
)

‎pkg/cmd/parse.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
6262
Default: true,
6363
QueryPath: "shortenBase64Images",
6464
},
65+
&requestflag.Flag[[]string]{
66+
Name: "tag",
67+
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.",
68+
QueryPath: "tags",
69+
},
6570
&requestflag.Flag[bool]{
6671
Name: "use-main-content-only",
6772
Usage: "Extract only the main content from HTML-like inputs",

‎pkg/cmd/parse_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ func TestParseHandle(t *testing.T) {
2323
"--ocr=true",
2424
"--pdf", "{end: 1, start: 1}",
2525
"--shorten-base64-images=true",
26+
"--tag", "production",
27+
"--tag", "team-alpha",
2628
"--use-main-content-only=true",
2729
)
2830
})
@@ -44,6 +46,8 @@ func TestParseHandle(t *testing.T) {
4446
"--pdf.end", "1",
4547
"--pdf.start", "1",
4648
"--shorten-base64-images=true",
49+
"--tag", "production",
50+
"--tag", "team-alpha",
4751
"--use-main-content-only=true",
4852
)
4953
})
@@ -61,6 +65,8 @@ func TestParseHandle(t *testing.T) {
6165
"--ocr=true",
6266
"--pdf", "{end: 1, start: 1}",
6367
"--shorten-base64-images=true",
68+
"--tag", "production",
69+
"--tag", "team-alpha",
6470
"--use-main-content-only=true",
6571
)
6672
})

‎pkg/cmd/utility.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ var utilityPrefetch = cli.Command{
3131
Required: true,
3232
BodyPath: "type",
3333
},
34+
&requestflag.Flag[[]string]{
35+
Name: "tag",
36+
Usage: "Optional 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.",
37+
BodyPath: "tags",
38+
},
3439
&requestflag.Flag[int64]{
3540
Name: "timeout-ms",
3641
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).",

0 commit comments

Comments
 (0)