Skip to content

Commit 8a3745d

Browse files
refactor: minor refactor of method bodies
1 parent f4d71d2 commit 8a3745d

File tree

7 files changed

+20
-27
lines changed

7 files changed

+20
-27
lines changed

build.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,12 @@ var buildsCompare = cli.Command{
236236

237237
func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
238238
cc := getAPICommandContext(ctx, cmd)
239-
240239
// Log to stderr that we're creating a build (using white text)
241240
fmt.Fprintf(os.Stderr, "Creating build...\n")
242-
241+
params := stainlessv0.BuildNewParams{}
243242
res, err := cc.client.Builds.New(
244243
context.TODO(),
245-
stainlessv0.BuildNewParams{},
244+
params,
246245
option.WithMiddleware(cc.AsMiddleware()),
247246
option.WithRequestBody("application/json", cc.body),
248247
)
@@ -338,7 +337,6 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
338337

339338
func handleBuildsRetrieve(ctx context.Context, cmd *cli.Command) error {
340339
cc := getAPICommandContext(ctx, cmd)
341-
342340
res, err := cc.client.Builds.Get(
343341
context.TODO(),
344342
cmd.Value("build-id").(string),
@@ -483,10 +481,10 @@ func pullOutput(output, url, ref, targetDir string) error {
483481

484482
func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
485483
cc := getAPICommandContext(ctx, cmd)
486-
484+
params := stainlessv0.BuildListParams{}
487485
res, err := cc.client.Builds.List(
488486
context.TODO(),
489-
stainlessv0.BuildListParams{},
487+
params,
490488
option.WithMiddleware(cc.AsMiddleware()),
491489
)
492490
if err != nil {
@@ -499,10 +497,10 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
499497

500498
func handleBuildsCompare(ctx context.Context, cmd *cli.Command) error {
501499
cc := getAPICommandContext(ctx, cmd)
502-
500+
params := stainlessv0.BuildCompareParams{}
503501
res, err := cc.client.Builds.Compare(
504502
context.TODO(),
505-
stainlessv0.BuildCompareParams{},
503+
params,
506504
option.WithMiddleware(cc.AsMiddleware()),
507505
option.WithRequestBody("application/json", cc.body),
508506
)

buildtargetoutput.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ var buildTargetOutputsPull = cli.Command{
6666

6767
func handleBuildTargetOutputsRetrieve(ctx context.Context, cmd *cli.Command) error {
6868
cc := getAPICommandContext(ctx, cmd)
69-
69+
params := stainlessv0.BuildTargetOutputGetParams{}
7070
res, err := cc.client.BuildTargetOutputs.Get(
7171
context.TODO(),
72-
stainlessv0.BuildTargetOutputGetParams{},
72+
params,
7373
option.WithMiddleware(cc.AsMiddleware()),
7474
)
7575
if err != nil {

org.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ var orgsList = cli.Command{
3535

3636
func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
3737
cc := getAPICommandContext(ctx, cmd)
38-
3938
res, err := cc.client.Orgs.Get(
4039
context.TODO(),
4140
cmd.Value("org-name").(string),
@@ -51,7 +50,6 @@ func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
5150

5251
func handleOrgsList(ctx context.Context, cmd *cli.Command) error {
5352
cc := getAPICommandContext(ctx, cmd)
54-
5553
res, err := cc.client.Orgs.List(context.TODO(), option.WithMiddleware(cc.AsMiddleware()))
5654
if err != nil {
5755
return err

project.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ var projectsList = cli.Command{
6666

6767
func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error {
6868
cc := getAPICommandContext(ctx, cmd)
69-
7069
res, err := cc.client.Projects.Get(
7170
context.TODO(),
7271
cmd.Value("project").(string),
@@ -82,11 +81,11 @@ func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error {
8281

8382
func handleProjectsUpdate(ctx context.Context, cmd *cli.Command) error {
8483
cc := getAPICommandContext(ctx, cmd)
85-
84+
params := stainlessv0.ProjectUpdateParams{}
8685
res, err := cc.client.Projects.Update(
8786
context.TODO(),
8887
cmd.Value("project").(string),
89-
stainlessv0.ProjectUpdateParams{},
88+
params,
9089
option.WithMiddleware(cc.AsMiddleware()),
9190
option.WithRequestBody("application/json", cc.body),
9291
)
@@ -100,10 +99,10 @@ func handleProjectsUpdate(ctx context.Context, cmd *cli.Command) error {
10099

101100
func handleProjectsList(ctx context.Context, cmd *cli.Command) error {
102101
cc := getAPICommandContext(ctx, cmd)
103-
102+
params := stainlessv0.ProjectListParams{}
104103
res, err := cc.client.Projects.List(
105104
context.TODO(),
106-
stainlessv0.ProjectListParams{},
105+
params,
107106
option.WithMiddleware(cc.AsMiddleware()),
108107
)
109108
if err != nil {

projectbranch.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ var projectsBranchesRetrieve = cli.Command{
5555

5656
func handleProjectsBranchesCreate(ctx context.Context, cmd *cli.Command) error {
5757
cc := getAPICommandContext(ctx, cmd)
58-
58+
params := stainlessv0.ProjectBranchNewParams{}
5959
res, err := cc.client.Projects.Branches.New(
6060
context.TODO(),
6161
cmd.Value("project").(string),
62-
stainlessv0.ProjectBranchNewParams{},
62+
params,
6363
option.WithMiddleware(cc.AsMiddleware()),
6464
option.WithRequestBody("application/json", cc.body),
6565
)
@@ -73,7 +73,6 @@ func handleProjectsBranchesCreate(ctx context.Context, cmd *cli.Command) error {
7373

7474
func handleProjectsBranchesRetrieve(ctx context.Context, cmd *cli.Command) error {
7575
cc := getAPICommandContext(ctx, cmd)
76-
7776
res, err := cc.client.Projects.Branches.Get(
7877
context.TODO(),
7978
cmd.Value("branch").(string),

projectconfig.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ var projectsConfigsGuess = cli.Command{
5252

5353
func handleProjectsConfigsRetrieve(ctx context.Context, cmd *cli.Command) error {
5454
cc := getAPICommandContext(ctx, cmd)
55-
56-
55+
params := stainlessv0.ProjectConfigGetParams{}
5756
res := []byte{}
5857
_, err := cc.client.Projects.Configs.Get(
5958
context.TODO(),
6059
cmd.Value("project").(string),
61-
stainlessv0.ProjectConfigGetParams{},
60+
params,
6261
option.WithMiddleware(cc.AsMiddleware()),
6362
option.WithResponseBodyInto(&res),
6463
)
@@ -72,12 +71,12 @@ func handleProjectsConfigsRetrieve(ctx context.Context, cmd *cli.Command) error
7271

7372
func handleProjectsConfigsGuess(ctx context.Context, cmd *cli.Command) error {
7473
cc := getAPICommandContext(ctx, cmd)
75-
74+
params := stainlessv0.ProjectConfigGuessParams{}
7675
res := []byte{}
7776
_, err := cc.client.Projects.Configs.Guess(
7877
context.TODO(),
7978
cmd.Value("project").(string),
80-
stainlessv0.ProjectConfigGuessParams{},
79+
params,
8180
option.WithMiddleware(cc.AsMiddleware()),
8281
option.WithRequestBody("application/json", cc.body),
8382
option.WithResponseBodyInto(&res),

projectsnippet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ var projectsSnippetsCreateRequest = cli.Command{
6767

6868
func handleProjectsSnippetsCreateRequest(ctx context.Context, cmd *cli.Command) error {
6969
cc := getAPICommandContext(ctx, cmd)
70-
70+
params := stainlessv0.ProjectSnippetNewRequestParams{}
7171
res, err := cc.client.Projects.Snippets.NewRequest(
7272
context.TODO(),
7373
cmd.Value("project-name").(string),
74-
stainlessv0.ProjectSnippetNewRequestParams{},
74+
params,
7575
option.WithMiddleware(cc.AsMiddleware()),
7676
option.WithRequestBody("application/json", cc.body),
7777
)

0 commit comments

Comments
 (0)