Skip to content

Commit d7fa9ae

Browse files
feat(api): manual updates
1 parent b7e9c79 commit d7fa9ae

File tree

5 files changed

+200
-4
lines changed

5 files changed

+200
-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: 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: 7532946d051190f2cb8accabad7d586b
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-4fd8477b6ac821ae7ed8be9f2bf0995788a1b89009bf771bff6868f3a62c0c50.yml
3+
openapi_spec_hash: 43ec44a0c44eacf31a71a5f00cd28a83
4+
config_hash: 66be21d9e622533a4b22a18501a02005

main.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func main() {
2020
Commands: []*cli.Command{
2121
&projectsRetrieve,
2222
&projectsUpdate,
23+
&projectsList,
2324
},
2425
},
2526

@@ -39,6 +40,13 @@ func main() {
3940
},
4041
},
4142

43+
{
44+
Name: "projects:snippets",
45+
Commands: []*cli.Command{
46+
&projectsSnippetsCreateRequest,
47+
},
48+
},
49+
4250
{
4351
Name: "builds",
4452
Commands: []*cli.Command{
@@ -54,6 +62,14 @@ func main() {
5462
&buildTargetOutputsRetrieve,
5563
},
5664
},
65+
66+
{
67+
Name: "orgs",
68+
Commands: []*cli.Command{
69+
&orgsRetrieve,
70+
&orgsList,
71+
},
72+
},
5773
},
5874
EnableShellCompletion: true,
5975
HideHelpCommand: true,

org.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"os"
9+
10+
"github.com/stainless-api/stainless-api-go/option"
11+
"github.com/urfave/cli/v3"
12+
)
13+
14+
var orgsRetrieve = cli.Command{
15+
Name: "retrieve",
16+
Usage: "TODO",
17+
Flags: []cli.Flag{
18+
&cli.StringFlag{
19+
Name: "org-name",
20+
},
21+
},
22+
Before: initAPICommand,
23+
Action: handleOrgsRetrieve,
24+
HideHelpCommand: true,
25+
}
26+
27+
var orgsList = cli.Command{
28+
Name: "list",
29+
Usage: "TODO",
30+
Flags: []cli.Flag{},
31+
Before: initAPICommand,
32+
Action: handleOrgsList,
33+
HideHelpCommand: true,
34+
}
35+
36+
func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
37+
cc := getAPICommandContext(ctx, cmd)
38+
39+
res, err := cc.client.Orgs.Get(
40+
context.TODO(),
41+
cmd.Value("org-name").(string),
42+
option.WithMiddleware(cc.AsMiddleware()),
43+
)
44+
if err != nil {
45+
return err
46+
}
47+
48+
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
49+
return nil
50+
}
51+
52+
func handleOrgsList(ctx context.Context, cmd *cli.Command) error {
53+
cc := getAPICommandContext(ctx, cmd)
54+
55+
res, err := cc.client.Orgs.List(context.TODO(), option.WithMiddleware(cc.AsMiddleware()))
56+
if err != nil {
57+
return err
58+
}
59+
60+
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
61+
return nil
62+
}

project.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ var projectsUpdate = cli.Command{
4242
HideHelpCommand: true,
4343
}
4444

45+
var projectsList = cli.Command{
46+
Name: "list",
47+
Usage: "TODO",
48+
Flags: []cli.Flag{
49+
&cli.StringFlag{
50+
Name: "org",
51+
Action: getAPIFlagAction[string]("query", "org"),
52+
},
53+
&cli.StringFlag{
54+
Name: "cursor",
55+
Action: getAPIFlagAction[string]("query", "cursor"),
56+
},
57+
&cli.FloatFlag{
58+
Name: "limit",
59+
Action: getAPIFlagAction[float64]("query", "limit"),
60+
},
61+
},
62+
Before: initAPICommand,
63+
Action: handleProjectsList,
64+
HideHelpCommand: true,
65+
}
66+
4567
func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error {
4668
cc := getAPICommandContext(ctx, cmd)
4769

@@ -75,3 +97,19 @@ func handleProjectsUpdate(ctx context.Context, cmd *cli.Command) error {
7597
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
7698
return nil
7799
}
100+
101+
func handleProjectsList(ctx context.Context, cmd *cli.Command) error {
102+
cc := getAPICommandContext(ctx, cmd)
103+
104+
res, err := cc.client.Projects.List(
105+
context.TODO(),
106+
stainlessv0.ProjectListParams{},
107+
option.WithMiddleware(cc.AsMiddleware()),
108+
)
109+
if err != nil {
110+
return err
111+
}
112+
113+
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
114+
return nil
115+
}

projectsnippet.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"os"
9+
10+
"github.com/stainless-api/stainless-api-go"
11+
"github.com/stainless-api/stainless-api-go/option"
12+
"github.com/urfave/cli/v3"
13+
)
14+
15+
var projectsSnippetsCreateRequest = cli.Command{
16+
Name: "create_request",
17+
Usage: "TODO",
18+
Flags: []cli.Flag{
19+
&cli.StringFlag{
20+
Name: "project-name",
21+
},
22+
&cli.StringFlag{
23+
Name: "language",
24+
Action: getAPIFlagAction[string]("body", "language"),
25+
},
26+
&cli.StringFlag{
27+
Name: "request.method",
28+
Action: getAPIFlagAction[string]("body", "request.method"),
29+
},
30+
&cli.StringFlag{
31+
Name: "request.parameters.in",
32+
Action: getAPIFlagAction[string]("body", "request.parameters.#.in"),
33+
},
34+
&cli.StringFlag{
35+
Name: "request.parameters.name",
36+
Action: getAPIFlagAction[string]("body", "request.parameters.#.name"),
37+
},
38+
&cli.BoolFlag{
39+
Name: "request.+parameter",
40+
Action: getAPIFlagActionWithValue[bool]("body", "request.parameters.-1", map[string]interface{}{}),
41+
},
42+
&cli.StringFlag{
43+
Name: "request.path",
44+
Action: getAPIFlagAction[string]("body", "request.path"),
45+
},
46+
&cli.StringFlag{
47+
Name: "request.body.fileParam",
48+
Action: getAPIFlagAction[string]("body", "request.body.fileParam"),
49+
},
50+
&cli.StringFlag{
51+
Name: "request.body.filePath",
52+
Action: getAPIFlagAction[string]("body", "request.body.filePath"),
53+
},
54+
&cli.StringFlag{
55+
Name: "version",
56+
Action: getAPIFlagAction[string]("body", "version"),
57+
},
58+
},
59+
Before: initAPICommand,
60+
Action: handleProjectsSnippetsCreateRequest,
61+
HideHelpCommand: true,
62+
}
63+
64+
func handleProjectsSnippetsCreateRequest(ctx context.Context, cmd *cli.Command) error {
65+
cc := getAPICommandContext(ctx, cmd)
66+
67+
res, err := cc.client.Projects.Snippets.NewRequest(
68+
context.TODO(),
69+
cmd.Value("project-name").(string),
70+
stainlessv0.ProjectSnippetNewRequestParams{},
71+
option.WithMiddleware(cc.AsMiddleware()),
72+
option.WithRequestBody("application/json", cc.body),
73+
)
74+
if err != nil {
75+
return err
76+
}
77+
78+
fmt.Printf("%s\n", colorizeJSON(res.RawJSON(), os.Stdout))
79+
return nil
80+
}

0 commit comments

Comments
 (0)