diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aaf968a..b56c3d0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.3" + ".": "0.1.0-alpha.4" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 0233db0..2260e4d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-475d7467c6365b48df46bee77ff6a07d22601f7c3a269a0383473e4ebce1146d.yml -openapi_spec_hash: 4b9f1b89f983978e970133b5653fd0d8 -config_hash: 28c1ddd1e9bdba67e018459acdfafc5b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-cfef2e882e091dad51a5b53bc39cc251ecf3f71cc0328561cec6309e8bbac93a.yml +openapi_spec_hash: fac1531252a5b791107de8257fdcf3cb +config_hash: e6d0ab5c40b50d896cdcacb62260c926 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df6295..e64abc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.1.0-alpha.4 (2025-05-23) + +Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.3...v0.1.0-alpha.4) + +### Features + +* **api:** change v0 path param projectName -> project ([f4d71d2](https://github.com/stainless-api/stainless-api-cli/commit/f4d71d2a7329db59b1a9fa6d341619ab0532db6b)) +* **api:** manual updates ([ad21d1e](https://github.com/stainless-api/stainless-api-cli/commit/ad21d1e0ee263bda24f88823c31f998295c842a2)) +* **api:** manual updates ([2539725](https://github.com/stainless-api/stainless-api-cli/commit/253972559414ee57ef40cfcfc989fd5ea4e4cc27)) + + +### Refactors + +* minor refactor of method bodies ([8a3745d](https://github.com/stainless-api/stainless-api-cli/commit/8a3745dd7415ac36eeba2ec8b54e695845ffc9b5)) + ## 0.1.0-alpha.3 (2025-05-22) Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) diff --git a/README.md b/README.md index 97c2052..6688644 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ stainless-api-cli [resource] [command] [flags] ```sh stainless-api-cli builds create \ - --project project \ --revision string ``` diff --git a/build.go b/build.go index 9751cd5..0af9c8e 100644 --- a/build.go +++ b/build.go @@ -236,13 +236,12 @@ var buildsCompare = cli.Command{ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - // Log to stderr that we're creating a build (using white text) fmt.Fprintf(os.Stderr, "Creating build...\n") - + params := stainlessv0.BuildNewParams{} res, err := cc.client.Builds.New( context.TODO(), - stainlessv0.BuildNewParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), ) @@ -338,7 +337,6 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error { func handleBuildsRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - res, err := cc.client.Builds.Get( context.TODO(), cmd.Value("build-id").(string), @@ -483,10 +481,10 @@ func pullOutput(output, url, ref, targetDir string) error { func handleBuildsList(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.BuildListParams{} res, err := cc.client.Builds.List( context.TODO(), - stainlessv0.BuildListParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), ) if err != nil { @@ -499,10 +497,10 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error { func handleBuildsCompare(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.BuildCompareParams{} res, err := cc.client.Builds.Compare( context.TODO(), - stainlessv0.BuildCompareParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), ) diff --git a/buildtargetoutput.go b/buildtargetoutput.go index 7f9b01c..56014f5 100644 --- a/buildtargetoutput.go +++ b/buildtargetoutput.go @@ -66,10 +66,10 @@ var buildTargetOutputsPull = cli.Command{ func handleBuildTargetOutputsRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.BuildTargetOutputGetParams{} res, err := cc.client.BuildTargetOutputs.Get( context.TODO(), - stainlessv0.BuildTargetOutputGetParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), ) if err != nil { diff --git a/go.mod b/go.mod index 582b51f..6135926 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.23.0 toolchain go1.23.9 require ( + github.com/stainless-api/stainless-api-go v0.5.1 github.com/logrusorgru/aurora/v4 v4.0.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c - github.com/stainless-api/stainless-api-go v0.4.0 github.com/tidwall/gjson v1.17.0 github.com/tidwall/pretty v1.2.1 github.com/tidwall/sjson v1.2.5 diff --git a/go.sum b/go.sum index dbf901e..84a39f6 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stainless-api/stainless-api-go v0.4.0 h1:uRuRqXULJEllH3NES3YbCjLngUG8eoRxaFutA1e/wEs= -github.com/stainless-api/stainless-api-go v0.4.0/go.mod h1:9Q2t8xq6EFgw8HYOsVxqKEfSDVe9eqCoh1zC0HMRwTY= +github.com/stainless-api/stainless-api-go v0.5.1 h1:+y/D5G9x7aaPA7AAkXhYSwKUhftz2Mj3D1MzDCymt3k= +github.com/stainless-api/stainless-api-go v0.5.1/go.mod h1:9Q2t8xq6EFgw8HYOsVxqKEfSDVe9eqCoh1zC0HMRwTY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= diff --git a/org.go b/org.go index a20fe23..806bddf 100644 --- a/org.go +++ b/org.go @@ -35,7 +35,6 @@ var orgsList = cli.Command{ func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - res, err := cc.client.Orgs.Get( context.TODO(), cmd.Value("org-name").(string), @@ -51,7 +50,6 @@ func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error { func handleOrgsList(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - res, err := cc.client.Orgs.List(context.TODO(), option.WithMiddleware(cc.AsMiddleware())) if err != nil { return err diff --git a/project.go b/project.go index 42e5e91..7562494 100644 --- a/project.go +++ b/project.go @@ -17,7 +17,7 @@ var projectsRetrieve = cli.Command{ Usage: "Retrieve a project by name", Flags: []cli.Flag{ &cli.StringFlag{ - Name: "project-name", + Name: "project", }, }, Before: initAPICommand, @@ -30,7 +30,7 @@ var projectsUpdate = cli.Command{ Usage: "Update a project's properties", Flags: []cli.Flag{ &cli.StringFlag{ - Name: "project-name", + Name: "project", }, &cli.StringFlag{ Name: "display-name", @@ -66,10 +66,13 @@ var projectsList = cli.Command{ func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectGetParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res, err := cc.client.Projects.Get( context.TODO(), - cmd.Value("project-name").(string), + params, option.WithMiddleware(cc.AsMiddleware()), ) if err != nil { @@ -82,11 +85,13 @@ func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error { func handleProjectsUpdate(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectUpdateParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res, err := cc.client.Projects.Update( context.TODO(), - cmd.Value("project-name").(string), - stainlessv0.ProjectUpdateParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), ) @@ -100,10 +105,10 @@ func handleProjectsUpdate(ctx context.Context, cmd *cli.Command) error { func handleProjectsList(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectListParams{} res, err := cc.client.Projects.List( context.TODO(), - stainlessv0.ProjectListParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), ) if err != nil { diff --git a/projectbranch.go b/projectbranch.go index c2f6c3e..ba90514 100644 --- a/projectbranch.go +++ b/projectbranch.go @@ -55,11 +55,13 @@ var projectsBranchesRetrieve = cli.Command{ func handleProjectsBranchesCreate(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectBranchNewParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res, err := cc.client.Projects.Branches.New( context.TODO(), - cmd.Value("project").(string), - stainlessv0.ProjectBranchNewParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), ) @@ -73,13 +75,14 @@ func handleProjectsBranchesCreate(ctx context.Context, cmd *cli.Command) error { func handleProjectsBranchesRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectBranchGetParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res, err := cc.client.Projects.Branches.Get( context.TODO(), cmd.Value("branch").(string), - stainlessv0.ProjectBranchGetParams { - Project: cmd.Value("project").(string), - }, + params, option.WithMiddleware(cc.AsMiddleware()), ) if err != nil { diff --git a/projectconfig.go b/projectconfig.go index cacffe2..b1e949f 100644 --- a/projectconfig.go +++ b/projectconfig.go @@ -52,13 +52,14 @@ var projectsConfigsGuess = cli.Command{ func handleProjectsConfigsRetrieve(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - - + params := stainlessv0.ProjectConfigGetParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res := []byte{} _, err := cc.client.Projects.Configs.Get( context.TODO(), - cmd.Value("project").(string), - stainlessv0.ProjectConfigGetParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithResponseBodyInto(&res), ) @@ -72,12 +73,14 @@ func handleProjectsConfigsRetrieve(ctx context.Context, cmd *cli.Command) error func handleProjectsConfigsGuess(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectConfigGuessParams{} + if cmd.IsSet("project") { + params.Project = stainlessv0.String(cmd.Value("project").(string)) + } res := []byte{} _, err := cc.client.Projects.Configs.Guess( context.TODO(), - cmd.Value("project").(string), - stainlessv0.ProjectConfigGuessParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), option.WithResponseBodyInto(&res), diff --git a/projectsnippet.go b/projectsnippet.go index c78fc4c..c34ecb5 100644 --- a/projectsnippet.go +++ b/projectsnippet.go @@ -19,10 +19,6 @@ var projectsSnippetsCreateRequest = cli.Command{ &cli.StringFlag{ Name: "project-name", }, - &cli.StringFlag{ - Name: "language", - Action: getAPIFlagAction[string]("body", "language"), - }, &cli.StringFlag{ Name: "request.method", Action: getAPIFlagAction[string]("body", "request.method"), @@ -51,6 +47,14 @@ var projectsSnippetsCreateRequest = cli.Command{ Name: "request.body.filePath", Action: getAPIFlagAction[string]("body", "request.body.filePath"), }, + &cli.BoolFlag{ + Name: "har", + Action: getAPIFlagActionWithValue[bool]("body", "har", nil), + }, + &cli.StringFlag{ + Name: "language", + Action: getAPIFlagAction[string]("body", "language"), + }, &cli.StringFlag{ Name: "version", Action: getAPIFlagAction[string]("body", "version"), @@ -63,11 +67,11 @@ var projectsSnippetsCreateRequest = cli.Command{ func handleProjectsSnippetsCreateRequest(ctx context.Context, cmd *cli.Command) error { cc := getAPICommandContext(ctx, cmd) - + params := stainlessv0.ProjectSnippetNewRequestParams{} res, err := cc.client.Projects.Snippets.NewRequest( context.TODO(), cmd.Value("project-name").(string), - stainlessv0.ProjectSnippetNewRequestParams{}, + params, option.WithMiddleware(cc.AsMiddleware()), option.WithRequestBody("application/json", cc.body), )