Skip to content

Commit 24361de

Browse files
feat(api): configs
1 parent c694b82 commit 24361de

File tree

5 files changed

+181
-4
lines changed

5 files changed

+181
-4
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-55484eb3c5a4487f67eb0ddc6b416b47792ad78685be2f3f33f586a1995a97dd.yml
3-
openapi_spec_hash: 32dad4966e2c03ced3e9d8b90f6b6a3b
4-
config_hash: 1bee02a0eeb902e1ea32aa032bc70f54
1+
configured_endpoints: 10
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-c9f598f79a7265337b04e831c4c36bfd8216901c74a5e6d14a38e30d33ec731b.yml
3+
openapi_spec_hash: 458ba78d4ac13aea449822777e9194a5
4+
config_hash: 8817e4ad583190fe8c46f5044c5dca03

completions.fish

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -l subcommands \
33
projects.update \
44
projects.branches.create \
55
projects.branches.retrieve \
6+
projects.configs.retrieve \
7+
projects.configs.guess \
68
builds.create \
79
builds.retrieve \
810
builds.list \
@@ -23,6 +25,12 @@ complete -c stainless-api-cli --no-files \
2325
complete -c stainless-api-cli --no-files \
2426
-n "__fish_seen_subcommand_from projects.branches.retrieve" \
2527
-a "--project --branch"
28+
complete -c stainless-api-cli --no-files \
29+
-n "__fish_seen_subcommand_from projects.configs.retrieve" \
30+
-a "--project --branch"
31+
complete -c stainless-api-cli --no-files \
32+
-n "__fish_seen_subcommand_from projects.configs.guess" \
33+
-a "--project --spec --branch"
2634
complete -c stainless-api-cli --no-files \
2735
-n "__fish_seen_subcommand_from builds.create" \
2836
-a "--project --revision --allow-empty --branch --commit-message --targets --+target"

completions.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ _main()
1010
projects.update \
1111
projects.branches.create \
1212
projects.branches.retrieve \
13+
projects.configs.retrieve \
14+
projects.configs.guess \
1315
builds.create \
1416
builds.retrieve \
1517
builds.list \
@@ -37,6 +39,12 @@ _main()
3739
projects.branches.retrieve)
3840
flags="--project --branch"
3941
;;
42+
projects.configs.retrieve)
43+
flags="--project --branch"
44+
;;
45+
projects.configs.guess)
46+
flags="--project --spec --branch"
47+
;;
4048
builds.create)
4149
flags="--project --revision --allow-empty --branch --commit-message --targets --+target"
4250
;;

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func init() {
4646
var projectsBranchesRetrieveSubcommand = createProjectsBranchesRetrieveSubcommand()
4747
subcommands[projectsBranchesRetrieveSubcommand.flagSet.Name()] = &projectsBranchesRetrieveSubcommand
4848

49+
var projectsConfigsRetrieveSubcommand = createProjectsConfigsRetrieveSubcommand()
50+
subcommands[projectsConfigsRetrieveSubcommand.flagSet.Name()] = &projectsConfigsRetrieveSubcommand
51+
52+
var projectsConfigsGuessSubcommand = createProjectsConfigsGuessSubcommand(initialBody)
53+
subcommands[projectsConfigsGuessSubcommand.flagSet.Name()] = &projectsConfigsGuessSubcommand
54+
4955
var buildsCreateSubcommand = createBuildsCreateSubcommand(initialBody)
5056
subcommands[buildsCreateSubcommand.flagSet.Name()] = &buildsCreateSubcommand
5157

projectconfig.go

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"flag"
8+
"fmt"
9+
"net/http"
10+
"os"
11+
12+
"github.com/stainless-api/stainless-api-go"
13+
"github.com/stainless-api/stainless-api-go/option"
14+
)
15+
16+
func createProjectsConfigsRetrieveSubcommand() Subcommand {
17+
var project *string = nil
18+
query := []byte("{}")
19+
header := []byte("{}")
20+
var flagSet = flag.NewFlagSet("projects.configs.retrieve", flag.ExitOnError)
21+
22+
flagSet.Func(
23+
"project",
24+
"",
25+
func(string string) error {
26+
project = &string
27+
return nil
28+
},
29+
)
30+
31+
flagSet.Func(
32+
"branch",
33+
"",
34+
func(string string) error {
35+
var jsonErr error
36+
query, jsonErr = jsonSet(query, "branch", string)
37+
if jsonErr != nil {
38+
return jsonErr
39+
}
40+
return nil
41+
},
42+
)
43+
44+
return Subcommand{
45+
flagSet: flagSet,
46+
handle: func(client *stainlessv0.Client) {
47+
res, err := client.Projects.Configs.Get(
48+
context.TODO(),
49+
*project,
50+
stainlessv0.ProjectConfigGetParams{},
51+
option.WithMiddleware(func(r *http.Request, mn option.MiddlewareNext) (*http.Response, error) {
52+
q := r.URL.Query()
53+
for key, values := range serializeQuery(query) {
54+
for _, value := range values {
55+
q.Add(key, value)
56+
}
57+
}
58+
r.URL.RawQuery = q.Encode()
59+
60+
for key, values := range serializeHeader(header) {
61+
for _, value := range values {
62+
r.Header.Add(key, value)
63+
}
64+
}
65+
66+
return mn(r)
67+
}),
68+
)
69+
if err != nil {
70+
fmt.Printf("%s\n", err)
71+
os.Exit(1)
72+
}
73+
74+
fmt.Printf("%s\n", res.JSON.RawJSON())
75+
},
76+
}
77+
}
78+
79+
func createProjectsConfigsGuessSubcommand(initialBody []byte) Subcommand {
80+
var project *string = nil
81+
query := []byte("{}")
82+
header := []byte("{}")
83+
body := initialBody
84+
var flagSet = flag.NewFlagSet("projects.configs.guess", flag.ExitOnError)
85+
86+
flagSet.Func(
87+
"project",
88+
"",
89+
func(string string) error {
90+
project = &string
91+
return nil
92+
},
93+
)
94+
95+
flagSet.Func(
96+
"spec",
97+
"",
98+
func(string string) error {
99+
var jsonErr error
100+
body, jsonErr = jsonSet(body, "spec", string)
101+
if jsonErr != nil {
102+
return jsonErr
103+
}
104+
return nil
105+
},
106+
)
107+
108+
flagSet.Func(
109+
"branch",
110+
"",
111+
func(string string) error {
112+
var jsonErr error
113+
body, jsonErr = jsonSet(body, "branch", string)
114+
if jsonErr != nil {
115+
return jsonErr
116+
}
117+
return nil
118+
},
119+
)
120+
121+
return Subcommand{
122+
flagSet: flagSet,
123+
handle: func(client *stainlessv0.Client) {
124+
res, err := client.Projects.Configs.Guess(
125+
context.TODO(),
126+
*project,
127+
stainlessv0.ProjectConfigGuessParams{},
128+
option.WithMiddleware(func(r *http.Request, mn option.MiddlewareNext) (*http.Response, error) {
129+
q := r.URL.Query()
130+
for key, values := range serializeQuery(query) {
131+
for _, value := range values {
132+
q.Add(key, value)
133+
}
134+
}
135+
r.URL.RawQuery = q.Encode()
136+
137+
for key, values := range serializeHeader(header) {
138+
for _, value := range values {
139+
r.Header.Add(key, value)
140+
}
141+
}
142+
143+
return mn(r)
144+
}),
145+
option.WithRequestBody("application/json", body),
146+
)
147+
if err != nil {
148+
fmt.Printf("%s\n", err)
149+
os.Exit(1)
150+
}
151+
152+
fmt.Printf("%s\n", res.JSON.RawJSON())
153+
},
154+
}
155+
}

0 commit comments

Comments
 (0)