Skip to content

Commit a0e254f

Browse files
feat(api): api update
1 parent 1aef807 commit a0e254f

3 files changed

Lines changed: 5 additions & 36 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: 29
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9de98d1d4d2c9a431961599cb54716212c06200a919e09adedd42244038ec07b.yml
3-
openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5280c0f42603633a06d2404b120b98d0d9aa43256d13680bbdead7579a90452a.yml
3+
openapi_spec_hash: 34869d638c12bf076949bb7e050dd634
44
config_hash: ff35e224e809656528c44163aa41bebd

pkg/cmd/utility.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/urfave/cli/v3"
1515
)
1616

17-
var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{
17+
var utilityPrefetch = cli.Command{
1818
Name: "prefetch",
1919
Usage: "Signal that you may fetch brand data soon to improve latency. The type field\nselects what to prefetch (currently only 'brand') and identifier carries exactly\none lookup key: a domain, or an email whose domain is extracted and validated\n(free email providers and disposable email addresses are not allowed).",
2020
Suggest: true,
@@ -39,20 +39,7 @@ var utilityPrefetch = requestflag.WithInnerFlags(cli.Command{
3939
},
4040
Action: handleUtilityPrefetch,
4141
HideHelpCommand: true,
42-
}, map[string][]requestflag.HasOuterFlag{
43-
"identifier": {
44-
&requestflag.InnerFlag[string]{
45-
Name: "identifier.domain",
46-
Usage: "Domain name to prefetch brand data for",
47-
InnerField: "domain",
48-
},
49-
&requestflag.InnerFlag[string]{
50-
Name: "identifier.email",
51-
Usage: "Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed.",
52-
InnerField: "email",
53-
},
54-
},
55-
})
42+
}
5643

5744
func handleUtilityPrefetch(ctx context.Context, cmd *cli.Command) error {
5845
client := contextdev.NewClient(getDefaultRequestOptions(cmd)...)

pkg/cmd/utility_test.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"testing"
77

88
"github.com/context-dot-dev/context-dev-cli/internal/mocktest"
9-
"github.com/context-dot-dev/context-dev-cli/internal/requestflag"
109
)
1110

1211
func TestUtilityPrefetch(t *testing.T) {
@@ -16,23 +15,7 @@ func TestUtilityPrefetch(t *testing.T) {
1615
t,
1716
"--api-key", "string",
1817
"utility", "prefetch",
19-
"--identifier", "{domain: domain, email: dev@stainless.com}",
20-
"--type", "brand",
21-
"--timeout-ms", "1000",
22-
)
23-
})
24-
25-
t.Run("inner flags", func(t *testing.T) {
26-
// Check that inner flags have been set up correctly
27-
requestflag.CheckInnerFlags(utilityPrefetch)
28-
29-
// Alternative argument passing style using inner flags
30-
mocktest.TestRunMockTestWithFlags(
31-
t,
32-
"--api-key", "string",
33-
"utility", "prefetch",
34-
"--identifier.domain", "domain",
35-
"--identifier.email", "dev@stainless.com",
18+
"--identifier", "{domain: domain}",
3619
"--type", "brand",
3720
"--timeout-ms", "1000",
3821
)
@@ -43,7 +26,6 @@ func TestUtilityPrefetch(t *testing.T) {
4326
pipeData := []byte("" +
4427
"identifier:\n" +
4528
" domain: domain\n" +
46-
" email: dev@stainless.com\n" +
4729
"type: brand\n" +
4830
"timeoutMS: 1000\n")
4931
mocktest.TestRunMockTestWithPipeAndFlags(

0 commit comments

Comments
 (0)