From fd2069d1892eb4698fc2d5187cbf3c7cc0fe505b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 18:26:32 +0000 Subject: [PATCH 01/11] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e151b1a..9408466 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-e588492ce099ac1af79467a22ecac606b1fe8cf78a82fd37137bf8e30ac1a80e.yml openapi_spec_hash: 7311d0d71ab64604d2b298e3c38b945f -config_hash: c42f554df7aa099708e68be87b878449 +config_hash: a26ba24f29a839386d9a195ff365be23 From 86931566d48420dd214db29b5a1364ef91269f08 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 04:20:34 +0000 Subject: [PATCH 02/11] chore(internal): codegen related update --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5450028..769c1a5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # Stainless Go API Library + + Go Reference + + The Stainless Go library provides convenient access to the [Stainless REST API](https://www.stainless.com/docs/getting-started/quickstart-cli) from applications written in Go. From 483b23c5999d093fd7348e42afae589181b7b182 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 04:58:31 +0000 Subject: [PATCH 03/11] fix(internal): unmarshal correctly when there are multiple discriminators --- internal/apijson/decodeparam_test.go | 88 ++++++++++++++++++++++++++++ internal/apijson/union.go | 48 ++++++++------- 2 files changed, 115 insertions(+), 21 deletions(-) diff --git a/internal/apijson/decodeparam_test.go b/internal/apijson/decodeparam_test.go index 6392103..72a8d1b 100644 --- a/internal/apijson/decodeparam_test.go +++ b/internal/apijson/decodeparam_test.go @@ -351,6 +351,36 @@ func init() { }) } +type FooVariant struct { + Type string `json:"type,required"` + Value string `json:"value,required"` +} + +type BarVariant struct { + Type string `json:"type,required"` + Enable bool `json:"enable,required"` +} + +type MultiDiscriminatorUnion struct { + OfFoo *FooVariant `json:",inline"` + OfBar *BarVariant `json:",inline"` + + paramUnion +} + +func init() { + apijson.RegisterDiscriminatedUnion[MultiDiscriminatorUnion]("type", map[string]reflect.Type{ + "foo": reflect.TypeOf(FooVariant{}), + "foo_v2": reflect.TypeOf(FooVariant{}), + "bar": reflect.TypeOf(BarVariant{}), + "bar_legacy": reflect.TypeOf(BarVariant{}), + }) +} + +func (m *MultiDiscriminatorUnion) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, m) +} + func (d *DiscriminatedUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, d) } @@ -408,3 +438,61 @@ func TestDiscriminatedUnion(t *testing.T) { }) } } + +func TestMultiDiscriminatorUnion(t *testing.T) { + tests := map[string]struct { + raw string + target MultiDiscriminatorUnion + shouldFail bool + }{ + "foo_variant": { + raw: `{"type":"foo","value":"test"}`, + target: MultiDiscriminatorUnion{OfFoo: &FooVariant{ + Type: "foo", + Value: "test", + }}, + }, + "foo_v2_variant": { + raw: `{"type":"foo_v2","value":"test_v2"}`, + target: MultiDiscriminatorUnion{OfFoo: &FooVariant{ + Type: "foo_v2", + Value: "test_v2", + }}, + }, + "bar_variant": { + raw: `{"type":"bar","enable":true}`, + target: MultiDiscriminatorUnion{OfBar: &BarVariant{ + Type: "bar", + Enable: true, + }}, + }, + "bar_legacy_variant": { + raw: `{"type":"bar_legacy","enable":false}`, + target: MultiDiscriminatorUnion{OfBar: &BarVariant{ + Type: "bar_legacy", + Enable: false, + }}, + }, + "invalid_type": { + raw: `{"type":"unknown","value":"test"}`, + target: MultiDiscriminatorUnion{}, + shouldFail: true, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + var dst MultiDiscriminatorUnion + err := json.Unmarshal([]byte(test.raw), &dst) + if err != nil && !test.shouldFail { + t.Fatalf("failed unmarshal with err: %v", err) + } + if err == nil && test.shouldFail { + t.Fatalf("expected unmarshal to fail but it succeeded") + } + if !reflect.DeepEqual(dst, test.target) { + t.Fatalf("failed equality, got %#v but expected %#v", dst, test.target) + } + }) + } +} diff --git a/internal/apijson/union.go b/internal/apijson/union.go index 33d373e..bfad1dd 100644 --- a/internal/apijson/union.go +++ b/internal/apijson/union.go @@ -39,12 +39,10 @@ func RegisterDiscriminatedUnion[T any](key string, mappings map[string]reflect.T func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc { type variantDecoder struct { - decoder decoderFunc - field reflect.StructField - discriminatorValue any + decoder decoderFunc + field reflect.StructField } - - variants := []variantDecoder{} + decoders := []variantDecoder{} for i := 0; i < t.NumField(); i++ { field := t.Field(i) @@ -53,18 +51,26 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc { } decoder := d.typeDecoder(field.Type) - variants = append(variants, variantDecoder{ + decoders = append(decoders, variantDecoder{ decoder: decoder, field: field, }) } + type discriminatedDecoder struct { + variantDecoder + discriminator any + } + discriminatedDecoders := []discriminatedDecoder{} unionEntry, discriminated := unionRegistry[t] - for _, unionVariant := range unionEntry.variants { - for i := 0; i < len(variants); i++ { - variant := &variants[i] - if variant.field.Type.Elem() == unionVariant.Type { - variant.discriminatorValue = unionVariant.DiscriminatorValue + for _, variant := range unionEntry.variants { + // For each union variant, find a matching decoder and save it + for _, decoder := range decoders { + if decoder.field.Type.Elem() == variant.Type { + discriminatedDecoders = append(discriminatedDecoders, discriminatedDecoder{ + decoder, + variant.DiscriminatorValue, + }) break } } @@ -73,10 +79,10 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc { return func(n gjson.Result, v reflect.Value, state *decoderState) error { if discriminated && n.Type == gjson.JSON && len(unionEntry.discriminatorKey) != 0 { discriminator := n.Get(unionEntry.discriminatorKey).Value() - for _, variant := range variants { - if discriminator == variant.discriminatorValue { - inner := v.FieldByIndex(variant.field.Index) - return variant.decoder(n, inner, state) + for _, decoder := range discriminatedDecoders { + if discriminator == decoder.discriminator { + inner := v.FieldByIndex(decoder.field.Index) + return decoder.decoder(n, inner, state) } } return errors.New("apijson: was not able to find discriminated union variant") @@ -85,15 +91,15 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc { // Set bestExactness to worse than loose bestExactness := loose - 1 bestVariant := -1 - for i, variant := range variants { + for i, decoder := range decoders { // Pointers are used to discern JSON object variants from value variants - if n.Type != gjson.JSON && variant.field.Type.Kind() == reflect.Ptr { + if n.Type != gjson.JSON && decoder.field.Type.Kind() == reflect.Ptr { continue } sub := decoderState{strict: state.strict, exactness: exact} - inner := v.FieldByIndex(variant.field.Index) - err := variant.decoder(n, inner, &sub) + inner := v.FieldByIndex(decoder.field.Index) + err := decoder.decoder(n, inner, &sub) if err != nil { continue } @@ -116,11 +122,11 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc { return errors.New("apijson: was not able to coerce type as union strictly") } - for i := 0; i < len(variants); i++ { + for i := 0; i < len(decoders); i++ { if i == bestVariant { continue } - v.FieldByIndex(variants[i].field.Index).SetZero() + v.FieldByIndex(decoders[i].field.Index).SetZero() } return nil From 6ddaf31154e868936a48d3f104e812a344603b75 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 18:46:49 +0000 Subject: [PATCH 04/11] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 9408466..246eac4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-e588492ce099ac1af79467a22ecac606b1fe8cf78a82fd37137bf8e30ac1a80e.yml openapi_spec_hash: 7311d0d71ab64604d2b298e3c38b945f -config_hash: a26ba24f29a839386d9a195ff365be23 +config_hash: b4d273d7503424c98b7d284102d23fb1 From 1e2bb41ccad74b245ebbe42473449c5fdc546b0c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 19:18:23 +0000 Subject: [PATCH 05/11] feat(api): docs --- .stats.yml | 6 +- README.md | 36 +++++----- api.md | 8 +-- build.go | 114 ++++++++++++++++++------------- builddiagnostic.go | 30 ++++++--- buildtargetoutput.go | 15 ++++- client_test.go | 32 ++++----- org.go | 4 +- paginationauto_test.go | 2 +- paginationmanual_test.go | 2 +- project.go | 13 ++-- projectbranch.go | 142 +++++++++++++++++++++++++++++++++------ projectconfig.go | 6 +- usage_test.go | 8 +-- 14 files changed, 279 insertions(+), 139 deletions(-) diff --git a/.stats.yml b/.stats.yml index 246eac4..c57e36e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-e588492ce099ac1af79467a22ecac606b1fe8cf78a82fd37137bf8e30ac1a80e.yml -openapi_spec_hash: 7311d0d71ab64604d2b298e3c38b945f -config_hash: b4d273d7503424c98b7d284102d23fb1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-a015455f60c6b613608a0a1fc4918a41593038160a16b09f714f601ab98c84bf.yml +openapi_spec_hash: 6f4ebb173c63d77efa9addde9b11f69e +config_hash: 50a257a9f90f8a010873c283e2832095 diff --git a/README.md b/README.md index 769c1a5..045b6a5 100644 --- a/README.md +++ b/README.md @@ -57,16 +57,16 @@ func main() { option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("STAINLESS_API_KEY") option.WithEnvironmentStaging(), // defaults to option.WithEnvironmentProduction() ) - buildObject, err := client.Builds.New(context.TODO(), stainless.BuildNewParams{ - Project: stainless.String("project"), + build, err := client.Builds.New(context.TODO(), stainless.BuildNewParams{ + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", buildObject.ID) + fmt.Printf("%+v\n", build.ID) } ``` @@ -292,12 +292,12 @@ You can use `.ListAutoPaging()` methods to iterate through items across all page ```go iter := client.Builds.ListAutoPaging(context.TODO(), stainless.BuildListParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), }) // Automatically fetches more pages as needed. for iter.Next() { - buildObject := iter.Current() - fmt.Printf("%+v\n", buildObject) + build := iter.Current() + fmt.Printf("%+v\n", build) } if err := iter.Err(); err != nil { panic(err.Error()) @@ -309,7 +309,7 @@ with additional helper methods like `.GetNextPage()`, e.g.: ```go page, err := client.Builds.List(context.TODO(), stainless.BuildListParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), }) for page != nil { for _, build := range page.Data { @@ -333,9 +333,9 @@ To handle errors, we recommend that you use the `errors.As` pattern: ```go _, err := client.Builds.New(context.TODO(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err != nil { @@ -365,9 +365,9 @@ defer cancel() client.Builds.New( ctx, stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }, // This sets the per-retry timeout @@ -406,9 +406,9 @@ client := stainless.NewClient( client.Builds.New( context.TODO(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }, option.WithMaxRetries(5), @@ -423,12 +423,12 @@ you need to examine response headers, status codes, or other details. ```go // Create a variable to store the HTTP response var response *http.Response -buildObject, err := client.Builds.New( +build, err := client.Builds.New( context.TODO(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }, option.WithResponseInto(&response), @@ -436,7 +436,7 @@ buildObject, err := client.Builds.New( if err != nil { // handle error } -fmt.Printf("%+v\n", buildObject) +fmt.Printf("%+v\n", build) fmt.Printf("Status Code: %d\n", response.StatusCode) fmt.Printf("Headers: %+#v\n", response.Header) diff --git a/api.md b/api.md index 06cb95c..7788c07 100644 --- a/api.md +++ b/api.md @@ -51,16 +51,16 @@ Methods: Response Types: -- stainless.BuildObject +- stainless.Build - stainless.BuildTarget - stainless.CheckStepUnion - stainless.BuildCompareResponse Methods: -- client.Builds.New(ctx context.Context, body stainless.BuildNewParams) (stainless.BuildObject, error) -- client.Builds.Get(ctx context.Context, buildID string) (stainless.BuildObject, error) -- client.Builds.List(ctx context.Context, query stainless.BuildListParams) (pagination.Page[stainless.BuildObject], error) +- client.Builds.New(ctx context.Context, body stainless.BuildNewParams) (stainless.Build, error) +- client.Builds.Get(ctx context.Context, buildID string) (stainless.Build, error) +- client.Builds.List(ctx context.Context, query stainless.BuildListParams) (pagination.Page[stainless.Build], error) - client.Builds.Compare(ctx context.Context, body stainless.BuildCompareParams) (stainless.BuildCompareResponse, error) ## Diagnostics diff --git a/build.go b/build.go index 63e3e68..67c9c04 100644 --- a/build.go +++ b/build.go @@ -45,8 +45,11 @@ func NewBuildService(opts ...option.RequestOption) (r BuildService) { return } -// Create a new build -func (r *BuildService) New(ctx context.Context, body BuildNewParams, opts ...option.RequestOption) (res *BuildObject, err error) { +// Create a build, on top of a project branch, against a given input revision. +// +// The project branch will be modified so that its latest set of config files +// points to the one specified by the input revision. +func (r *BuildService) New(ctx context.Context, body BuildNewParams, opts ...option.RequestOption) (res *Build, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { @@ -58,8 +61,8 @@ func (r *BuildService) New(ctx context.Context, body BuildNewParams, opts ...opt return } -// Retrieve a build by ID -func (r *BuildService) Get(ctx context.Context, buildID string, opts ...option.RequestOption) (res *BuildObject, err error) { +// Retrieve a build by its ID. +func (r *BuildService) Get(ctx context.Context, buildID string, opts ...option.RequestOption) (res *Build, err error) { opts = append(r.Options[:], opts...) if buildID == "" { err = errors.New("missing required buildId parameter") @@ -70,8 +73,11 @@ func (r *BuildService) Get(ctx context.Context, buildID string, opts ...option.R return } -// List builds for a project -func (r *BuildService) List(ctx context.Context, query BuildListParams, opts ...option.RequestOption) (res *pagination.Page[BuildObject], err error) { +// List user-triggered builds for a given project. +// +// An optional revision can be specified to filter by config commit SHA, or hashes +// of file contents. +func (r *BuildService) List(ctx context.Context, query BuildListParams, opts ...option.RequestOption) (res *pagination.Page[Build], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -93,12 +99,23 @@ func (r *BuildService) List(ctx context.Context, query BuildListParams, opts ... return res, nil } -// List builds for a project -func (r *BuildService) ListAutoPaging(ctx context.Context, query BuildListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BuildObject] { +// List user-triggered builds for a given project. +// +// An optional revision can be specified to filter by config commit SHA, or hashes +// of file contents. +func (r *BuildService) ListAutoPaging(ctx context.Context, query BuildListParams, opts ...option.RequestOption) *pagination.PageAutoPager[Build] { return pagination.NewPageAutoPager(r.List(ctx, query, opts...)) } -// Creates two builds whose outputs can be compared directly +// Create two builds whose outputs can be directly compared with each other. +// +// Created builds _modify_ their project branches so that their latest sets of +// config files point to the ones specified by the input revision. +// +// This endpoint is useful because a build has more inputs than the set of config +// files it uses, so comparing two builds directly may return spurious differences. +// Builds made via this endpoint are guaranteed to have differences arising from +// the set of config files, and any custom code. func (r *BuildService) Compare(ctx context.Context, body BuildCompareParams, opts ...option.RequestOption) (res *BuildCompareResponse, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -111,17 +128,18 @@ func (r *BuildService) Compare(ctx context.Context, body BuildCompareParams, opt return } -type BuildObject struct { - ID string `json:"id,required"` - ConfigCommit string `json:"config_commit,required"` - CreatedAt time.Time `json:"created_at,required" format:"date-time"` - DocumentedSpec BuildObjectDocumentedSpecUnion `json:"documented_spec,required"` +type Build struct { + // Build ID + ID string `json:"id,required"` + ConfigCommit string `json:"config_commit,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + DocumentedSpec BuildDocumentedSpecUnion `json:"documented_spec,required"` // Any of "build". - Object BuildObjectObject `json:"object,required"` - Org string `json:"org,required"` - Project string `json:"project,required"` - Targets BuildObjectTargets `json:"targets,required"` - UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` + Object BuildObject `json:"object,required"` + Org string `json:"org,required"` + Project string `json:"project,required"` + Targets BuildTargets `json:"targets,required"` + UpdatedAt time.Time `json:"updated_at,required" format:"date-time"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ID respjson.Field @@ -139,23 +157,23 @@ type BuildObject struct { } // Returns the unmodified JSON received from the API -func (r BuildObject) RawJSON() string { return r.JSON.raw } -func (r *BuildObject) UnmarshalJSON(data []byte) error { +func (r Build) RawJSON() string { return r.JSON.raw } +func (r *Build) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -// BuildObjectDocumentedSpecUnion contains all possible properties and values from -// [BuildObjectDocumentedSpecObject], [BuildObjectDocumentedSpecObject]. +// BuildDocumentedSpecUnion contains all possible properties and values from +// [BuildDocumentedSpecObject], [BuildDocumentedSpecObject]. // // Use the methods beginning with 'As' to cast the union to one of its variants. -type BuildObjectDocumentedSpecUnion struct { - // This field is from variant [BuildObjectDocumentedSpecObject]. +type BuildDocumentedSpecUnion struct { + // This field is from variant [BuildDocumentedSpecObject]. Content string `json:"content"` - // This field is from variant [BuildObjectDocumentedSpecObject]. + // This field is from variant [BuildDocumentedSpecObject]. Type string `json:"type"` - // This field is from variant [BuildObjectDocumentedSpecObject]. + // This field is from variant [BuildDocumentedSpecObject]. Expires time.Time `json:"expires"` - // This field is from variant [BuildObjectDocumentedSpecObject]. + // This field is from variant [BuildDocumentedSpecObject]. URL string `json:"url"` JSON struct { Content respjson.Field @@ -166,24 +184,24 @@ type BuildObjectDocumentedSpecUnion struct { } `json:"-"` } -func (u BuildObjectDocumentedSpecUnion) AsBuildObjectDocumentedSpecObject() (v BuildObjectDocumentedSpecObject) { +func (u BuildDocumentedSpecUnion) AsBuildDocumentedSpecObject() (v BuildDocumentedSpecObject) { apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) return } -func (u BuildObjectDocumentedSpecUnion) AsVariant2() (v BuildObjectDocumentedSpecObject) { +func (u BuildDocumentedSpecUnion) AsVariant2() (v BuildDocumentedSpecObject) { apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) return } // Returns the unmodified JSON received from the API -func (u BuildObjectDocumentedSpecUnion) RawJSON() string { return u.JSON.raw } +func (u BuildDocumentedSpecUnion) RawJSON() string { return u.JSON.raw } -func (r *BuildObjectDocumentedSpecUnion) UnmarshalJSON(data []byte) error { +func (r *BuildDocumentedSpecUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -type BuildObjectDocumentedSpecObject struct { +type BuildDocumentedSpecObject struct { Content string `json:"content,required"` // Any of "content". Type string `json:"type,required"` @@ -197,18 +215,18 @@ type BuildObjectDocumentedSpecObject struct { } // Returns the unmodified JSON received from the API -func (r BuildObjectDocumentedSpecObject) RawJSON() string { return r.JSON.raw } -func (r *BuildObjectDocumentedSpecObject) UnmarshalJSON(data []byte) error { +func (r BuildDocumentedSpecObject) RawJSON() string { return r.JSON.raw } +func (r *BuildDocumentedSpecObject) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -type BuildObjectObject string +type BuildObject string const ( - BuildObjectObjectBuild BuildObjectObject = "build" + BuildObjectBuild BuildObject = "build" ) -type BuildObjectTargets struct { +type BuildTargets struct { Cli BuildTarget `json:"cli"` Csharp BuildTarget `json:"csharp"` Go BuildTarget `json:"go"` @@ -239,8 +257,8 @@ type BuildObjectTargets struct { } // Returns the unmodified JSON received from the API -func (r BuildObjectTargets) RawJSON() string { return r.JSON.raw } -func (r *BuildObjectTargets) UnmarshalJSON(data []byte) error { +func (r BuildTargets) RawJSON() string { return r.JSON.raw } +func (r *BuildTargets) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } @@ -663,8 +681,8 @@ func (r *CheckStepCompletedCompleted) UnmarshalJSON(data []byte) error { } type BuildCompareResponse struct { - Base BuildObject `json:"base,required"` - Head BuildObject `json:"head,required"` + Base Build `json:"base,required"` + Head Build `json:"head,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Base respjson.Field @@ -684,11 +702,11 @@ type BuildNewParams struct { // Project name Project param.Opt[string] `json:"project,omitzero,required"` // Specifies what to build: a branch name, commit SHA, merge command - // ("base..head"), or file contents + // ("base..head"), or file contents. Revision BuildNewParamsRevisionUnion `json:"revision,omitzero,required"` // Whether to allow empty commits (no changes). Defaults to false. AllowEmpty param.Opt[bool] `json:"allow_empty,omitzero"` - // The Stainless branch to use for the build. If not specified, the branch is + // The project branch to use for the build. If not specified, the branch is // inferred from the `revision`, and will 400 when that is not possible. Branch param.Opt[string] `json:"branch,omitzero"` // Optional commit message to use when creating a new commit. @@ -739,9 +757,9 @@ type BuildListParams struct { Project param.Opt[string] `query:"project,omitzero,required" json:"-"` // Branch name Branch param.Opt[string] `query:"branch,omitzero" json:"-"` - // Pagination cursor from a previous response + // Pagination cursor from a previous response. Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"` - // Maximum number of builds to return, defaults to 10 (maximum: 100) + // Maximum number of builds to return, defaults to 10 (maximum: 100). Limit param.Opt[float64] `query:"limit,omitzero" json:"-"` // A config commit SHA used for the build Revision BuildListParamsRevisionUnion `query:"revision,omitzero" json:"-"` @@ -818,7 +836,7 @@ type BuildCompareParamsBase struct { // Branch to use. When using a branch name as revision, this must match or be // omitted. Branch string `json:"branch,required"` - // Specifies what to build: a branch name, a commit SHA, or file contents + // Specifies what to build: a branch name, a commit SHA, or file contents. Revision BuildCompareParamsBaseRevisionUnion `json:"revision,omitzero,required"` // Optional commit message to use when creating a new commit. CommitMessage param.Opt[string] `json:"commit_message,omitzero"` @@ -865,7 +883,7 @@ type BuildCompareParamsHead struct { // Branch to use. When using a branch name as revision, this must match or be // omitted. Branch string `json:"branch,required"` - // Specifies what to build: a branch name, a commit SHA, or file contents + // Specifies what to build: a branch name, a commit SHA, or file contents. Revision BuildCompareParamsHeadRevisionUnion `json:"revision,omitzero,required"` // Optional commit message to use when creating a new commit. CommitMessage param.Opt[string] `json:"commit_message,omitzero"` diff --git a/builddiagnostic.go b/builddiagnostic.go index 38b98ae..40639b7 100644 --- a/builddiagnostic.go +++ b/builddiagnostic.go @@ -37,7 +37,10 @@ func NewBuildDiagnosticService(opts ...option.RequestOption) (r BuildDiagnosticS return } -// Get diagnostics for a build +// Get the list of diagnostics for a given build. +// +// If no language targets are specified, diagnostics for all languages are +// returned. func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) (res *pagination.Page[BuildDiagnosticListResponse], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -59,7 +62,10 @@ func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query return res, nil } -// Get diagnostics for a build +// Get the list of diagnostics for a given build. +// +// If no language targets are specified, diagnostics for all languages are +// returned. func (r *BuildDiagnosticService) ListAutoPaging(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BuildDiagnosticListResponse] { return pagination.NewPageAutoPager(r.List(ctx, buildID, query, opts...)) } @@ -81,13 +87,20 @@ const ( ) type BuildDiagnosticListResponse struct { - Code string `json:"code,required"` - Ignored bool `json:"ignored,required"` + // The kind of diagnostic. + Code string `json:"code,required"` + // Whether the diagnostic is ignored in the Stainless config. + Ignored bool `json:"ignored,required"` + // The severity of the diagnostic. + // // Any of "fatal", "error", "warning", "note". - Level BuildDiagnosticListResponseLevel `json:"level,required"` - Message string `json:"message,required"` - ConfigRef string `json:"config_ref"` - OasRef string `json:"oas_ref"` + Level BuildDiagnosticListResponseLevel `json:"level,required"` + // A description of the diagnostic. + Message string `json:"message,required"` + // A JSON pointer to a relevant field in the Stainless config. + ConfigRef string `json:"config_ref"` + // A JSON pointer to a relevant field in the OpenAPI spec. + OasRef string `json:"oas_ref"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Code respjson.Field @@ -107,6 +120,7 @@ func (r *BuildDiagnosticListResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// The severity of the diagnostic. type BuildDiagnosticListResponseLevel string const ( diff --git a/buildtargetoutput.go b/buildtargetoutput.go index f33950c..7cdb940 100644 --- a/buildtargetoutput.go +++ b/buildtargetoutput.go @@ -34,7 +34,16 @@ func NewBuildTargetOutputService(opts ...option.RequestOption) (r BuildTargetOut return } -// Download the output of a build target +// Retrieve a method to download an output for a given build target. +// +// If the requested type of output is `source`, and the requested output method is +// `url`, a download link to a tarball of the source files is returned. If the +// requested output method is `git`, a Git remote, ref, and access token (if +// necessary) is returned. +// +// Otherwise, the possible types of outputs are specific to the requested target, +// and the output method _must_ be `url`. See the documentation for `type` for more +// information. func (r *BuildTargetOutputService) Get(ctx context.Context, query BuildTargetOutputGetParams, opts ...option.RequestOption) (res *BuildTargetOutputGetResponseUnion, err error) { opts = append(r.Options[:], opts...) path := "v0/build_target_outputs" @@ -140,7 +149,7 @@ type BuildTargetOutputGetParams struct { Target BuildTargetOutputGetParamsTarget `query:"target,omitzero,required" json:"-"` // Any of "source", "dist", "wheel". Type BuildTargetOutputGetParamsType `query:"type,omitzero,required" json:"-"` - // Output format: url (download URL) or git (temporary access token) + // Output format: url (download URL) or git (temporary access token). // // Any of "url", "git". Output BuildTargetOutputGetParamsOutput `query:"output,omitzero" json:"-"` @@ -181,7 +190,7 @@ const ( BuildTargetOutputGetParamsTypeWheel BuildTargetOutputGetParamsType = "wheel" ) -// Output format: url (download URL) or git (temporary access token) +// Output format: url (download URL) or git (temporary access token). type BuildTargetOutputGetParamsOutput string const ( diff --git a/client_test.go b/client_test.go index 5e7f495..8cded33 100644 --- a/client_test.go +++ b/client_test.go @@ -39,9 +39,9 @@ func TestUserAgentHeader(t *testing.T) { }), ) client.Builds.New(context.Background(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if userAgent != fmt.Sprintf("Stainless/Go %s", internal.PackageVersion) { @@ -68,9 +68,9 @@ func TestRetryAfter(t *testing.T) { }), ) _, err := client.Builds.New(context.Background(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -108,9 +108,9 @@ func TestDeleteRetryCountHeader(t *testing.T) { option.WithHeaderDel("X-Stainless-Retry-Count"), ) _, err := client.Builds.New(context.Background(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -143,9 +143,9 @@ func TestOverwriteRetryCountHeader(t *testing.T) { option.WithHeader("X-Stainless-Retry-Count", "42"), ) _, err := client.Builds.New(context.Background(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -177,9 +177,9 @@ func TestRetryAfterMs(t *testing.T) { }), ) _, err := client.Builds.New(context.Background(), stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -205,9 +205,9 @@ func TestContextCancel(t *testing.T) { cancelCtx, cancel := context.WithCancel(context.Background()) cancel() _, err := client.Builds.New(cancelCtx, stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -230,9 +230,9 @@ func TestContextCancelDelay(t *testing.T) { cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond) defer cancel() _, err := client.Builds.New(cancelCtx, stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { @@ -261,9 +261,9 @@ func TestContextDeadline(t *testing.T) { }), ) _, err := client.Builds.New(deadlineCtx, stainless.BuildNewParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err == nil { diff --git a/org.go b/org.go index d8e31cb..a64e199 100644 --- a/org.go +++ b/org.go @@ -34,7 +34,7 @@ func NewOrgService(opts ...option.RequestOption) (r OrgService) { return } -// Retrieve an organization by name +// Retrieve an organization by name. func (r *OrgService) Get(ctx context.Context, org string, opts ...option.RequestOption) (res *Org, err error) { opts = append(r.Options[:], opts...) if org == "" { @@ -46,7 +46,7 @@ func (r *OrgService) Get(ctx context.Context, org string, opts ...option.Request return } -// List organizations the user has access to +// List organizations accessible to the current authentication method. func (r *OrgService) List(ctx context.Context, opts ...option.RequestOption) (res *OrgListResponse, err error) { opts = append(r.Options[:], opts...) path := "v0/orgs" diff --git a/paginationauto_test.go b/paginationauto_test.go index c62ba64..72cca77 100644 --- a/paginationauto_test.go +++ b/paginationauto_test.go @@ -25,7 +25,7 @@ func TestAutoPagination(t *testing.T) { option.WithAPIKey("My API Key"), ) iter := client.Builds.ListAutoPaging(context.TODO(), stainless.BuildListParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), }) // Prism mock isn't going to give us real pagination for i := 0; i < 3 && iter.Next(); i++ { diff --git a/paginationmanual_test.go b/paginationmanual_test.go index f95fced..70d2e31 100644 --- a/paginationmanual_test.go +++ b/paginationmanual_test.go @@ -25,7 +25,7 @@ func TestManualPagination(t *testing.T) { option.WithAPIKey("My API Key"), ) page, err := client.Builds.List(context.TODO(), stainless.BuildListParams{ - Project: stainless.String("project"), + Project: stainless.String("stainless"), }) if err != nil { t.Fatalf("err should be nil: %s", err.Error()) diff --git a/project.go b/project.go index f5f0ec5..c1665f6 100644 --- a/project.go +++ b/project.go @@ -42,7 +42,7 @@ func NewProjectService(opts ...option.RequestOption) (r ProjectService) { return } -// Create a new project +// Create a new project. func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts ...option.RequestOption) (res *Project, err error) { opts = append(r.Options[:], opts...) path := "v0/projects" @@ -50,7 +50,7 @@ func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts .. return } -// Retrieve a project by name +// Retrieve a project by name. func (r *ProjectService) Get(ctx context.Context, query ProjectGetParams, opts ...option.RequestOption) (res *Project, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -67,7 +67,7 @@ func (r *ProjectService) Get(ctx context.Context, query ProjectGetParams, opts . return } -// Update a project's properties +// Update a project's properties. func (r *ProjectService) Update(ctx context.Context, params ProjectUpdateParams, opts ...option.RequestOption) (res *Project, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -84,7 +84,7 @@ func (r *ProjectService) Update(ctx context.Context, params ProjectUpdateParams, return } -// List projects in an organization, from oldest to newest +// List projects in an organization, from oldest to newest. func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts ...option.RequestOption) (res *pagination.Page[Project], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -102,11 +102,12 @@ func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts return res, nil } -// List projects in an organization, from oldest to newest +// List projects in an organization, from oldest to newest. func (r *ProjectService) ListAutoPaging(ctx context.Context, query ProjectListParams, opts ...option.RequestOption) *pagination.PageAutoPager[Project] { return pagination.NewPageAutoPager(r.List(ctx, query, opts...)) } +// A project is a collection of SDKs generated from the same set of config files. type Project struct { ConfigRepo string `json:"config_repo,required"` DisplayName string `json:"display_name,required"` @@ -186,7 +187,7 @@ func (r *ProjectUpdateParams) UnmarshalJSON(data []byte) error { type ProjectListParams struct { // Pagination cursor from a previous response Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"` - // Maximum number of projects to return, defaults to 10 (maximum: 100) + // Maximum number of projects to return, defaults to 10 (maximum: 100). Limit param.Opt[float64] `query:"limit,omitzero" json:"-"` Org param.Opt[string] `query:"org,omitzero" json:"-"` paramObj diff --git a/projectbranch.go b/projectbranch.go index 71402f8..4895f1c 100644 --- a/projectbranch.go +++ b/projectbranch.go @@ -16,7 +16,6 @@ import ( "github.com/stainless-api/stainless-api-go/packages/pagination" "github.com/stainless-api/stainless-api-go/packages/param" "github.com/stainless-api/stainless-api-go/packages/respjson" - "github.com/stainless-api/stainless-api-go/shared" ) // ProjectBranchService contains methods and other services that help with @@ -38,7 +37,11 @@ func NewProjectBranchService(opts ...option.RequestOption) (r ProjectBranchServi return } -// Create a new branch for a project +// Create a new branch for a project. +// +// The branch inherits the config files from the revision pointed to by the +// `branch_from` parameter. In addition, if the revision is a branch name, the +// branch will also inherit custom code changes from that branch. func (r *ProjectBranchService) New(ctx context.Context, params ProjectBranchNewParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -55,7 +58,7 @@ func (r *ProjectBranchService) New(ctx context.Context, params ProjectBranchNewP return } -// Retrieve a project branch +// Retrieve a project branch by name. func (r *ProjectBranchService) Get(ctx context.Context, branch string, query ProjectBranchGetParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -76,7 +79,7 @@ func (r *ProjectBranchService) Get(ctx context.Context, branch string, query Pro return } -// List project branches +// Retrieve a project branch by name. func (r *ProjectBranchService) List(ctx context.Context, params ProjectBranchListParams, opts ...option.RequestOption) (res *pagination.Page[ProjectBranchListResponse], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -103,12 +106,12 @@ func (r *ProjectBranchService) List(ctx context.Context, params ProjectBranchLis return res, nil } -// List project branches +// Retrieve a project branch by name. func (r *ProjectBranchService) ListAutoPaging(ctx context.Context, params ProjectBranchListParams, opts ...option.RequestOption) *pagination.PageAutoPager[ProjectBranchListResponse] { return pagination.NewPageAutoPager(r.List(ctx, params, opts...)) } -// Delete a project branch +// Delete a project branch by name. func (r *ProjectBranchService) Delete(ctx context.Context, branch string, body ProjectBranchDeleteParams, opts ...option.RequestOption) (res *ProjectBranchDeleteResponse, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -129,7 +132,10 @@ func (r *ProjectBranchService) Delete(ctx context.Context, branch string, body P return } -// Rebase a project branch +// Rebase a project branch. +// +// The branch is rebased onto the `base` branch or commit SHA, inheriting any +// config and custom code changes. func (r *ProjectBranchService) Rebase(ctx context.Context, branch string, params ProjectBranchRebaseParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -150,14 +156,21 @@ func (r *ProjectBranchService) Rebase(ctx context.Context, branch string, params return } +// A project branch names a line of development for a project. Like a Git branch, +// it points to a Git commit with a set of config files. In addition, a project +// branch also points to a set of custom code changes, corresponding to Git +// branches in the staging repos. type ProjectBranch struct { - Branch string `json:"branch,required"` - ConfigCommit shared.Commit `json:"config_commit,required"` - LatestBuild BuildObject `json:"latest_build,required"` + // Branch name + Branch string `json:"branch,required"` + // A Git commit that points to the latest set of config files on a given branch. + ConfigCommit ProjectBranchConfigCommit `json:"config_commit,required"` + LatestBuild Build `json:"latest_build,required"` // Any of "project_branch". - Object ProjectBranchObject `json:"object,required"` - Org string `json:"org,required"` - Project string `json:"project,required"` + Object ProjectBranchObject `json:"object,required"` + Org string `json:"org,required"` + // Project name + Project string `json:"project,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Branch respjson.Field @@ -177,20 +190,66 @@ func (r *ProjectBranch) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// A Git commit that points to the latest set of config files on a given branch. +type ProjectBranchConfigCommit struct { + Repo ProjectBranchConfigCommitRepo `json:"repo,required"` + Sha string `json:"sha,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Repo respjson.Field + Sha respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ProjectBranchConfigCommit) RawJSON() string { return r.JSON.raw } +func (r *ProjectBranchConfigCommit) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ProjectBranchConfigCommitRepo struct { + Branch string `json:"branch,required"` + Name string `json:"name,required"` + Owner string `json:"owner,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Branch respjson.Field + Name respjson.Field + Owner respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ProjectBranchConfigCommitRepo) RawJSON() string { return r.JSON.raw } +func (r *ProjectBranchConfigCommitRepo) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type ProjectBranchObject string const ( ProjectBranchObjectProjectBranch ProjectBranchObject = "project_branch" ) +// A project branch names a line of development for a project. Like a Git branch, +// it points to a Git commit with a set of config files. In addition, a project +// branch also points to a set of custom code changes, corresponding to Git +// branches in the staging repos. type ProjectBranchListResponse struct { - Branch string `json:"branch,required"` - ConfigCommit shared.Commit `json:"config_commit,required"` - LatestBuildID string `json:"latest_build_id,required"` + // Branch name + Branch string `json:"branch,required"` + // A Git commit that points to the latest set of config files on a given branch. + ConfigCommit ProjectBranchListResponseConfigCommit `json:"config_commit,required"` + LatestBuildID string `json:"latest_build_id,required"` // Any of "project_branch". - Object ProjectBranchListResponseObject `json:"object,required"` - Org string `json:"org,required"` - Project string `json:"project,required"` + Object ProjectBranchListResponseObject `json:"object,required"` + Org string `json:"org,required"` + // Project name + Project string `json:"project,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { Branch respjson.Field @@ -210,6 +269,45 @@ func (r *ProjectBranchListResponse) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } +// A Git commit that points to the latest set of config files on a given branch. +type ProjectBranchListResponseConfigCommit struct { + Repo ProjectBranchListResponseConfigCommitRepo `json:"repo,required"` + Sha string `json:"sha,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Repo respjson.Field + Sha respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ProjectBranchListResponseConfigCommit) RawJSON() string { return r.JSON.raw } +func (r *ProjectBranchListResponseConfigCommit) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type ProjectBranchListResponseConfigCommitRepo struct { + Branch string `json:"branch,required"` + Name string `json:"name,required"` + Owner string `json:"owner,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Branch respjson.Field + Name respjson.Field + Owner respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r ProjectBranchListResponseConfigCommitRepo) RawJSON() string { return r.JSON.raw } +func (r *ProjectBranchListResponseConfigCommitRepo) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type ProjectBranchListResponseObject string const ( @@ -221,9 +319,9 @@ type ProjectBranchDeleteResponse = any type ProjectBranchNewParams struct { // Use [option.WithProject] on the client to set a global default for this field. Project param.Opt[string] `path:"project,omitzero,required" json:"-"` - // Name of the new project branch. + // Branch name Branch string `json:"branch,required"` - // Branch or commit SHA to branch from. + // Branch or commit SHA to branch from BranchFrom string `json:"branch_from,required"` // Whether to throw an error if the branch already exists. Defaults to false. Force param.Opt[bool] `json:"force,omitzero"` @@ -249,7 +347,7 @@ type ProjectBranchListParams struct { Project param.Opt[string] `path:"project,omitzero,required" json:"-"` // Pagination cursor from a previous response Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"` - // Maximum number of items to return, defaults to 10 (maximum: 100) + // Maximum number of items to return, defaults to 10 (maximum: 100). Limit param.Opt[float64] `query:"limit,omitzero" json:"-"` paramObj } diff --git a/projectconfig.go b/projectconfig.go index 893e60b..5c3f164 100644 --- a/projectconfig.go +++ b/projectconfig.go @@ -36,7 +36,7 @@ func NewProjectConfigService(opts ...option.RequestOption) (r ProjectConfigServi return } -// Retrieve configuration files for a project +// Retrieve the configuration files for a given project. func (r *ProjectConfigService) Get(ctx context.Context, params ProjectConfigGetParams, opts ...option.RequestOption) (res *ProjectConfigGetResponse, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -53,7 +53,7 @@ func (r *ProjectConfigService) Get(ctx context.Context, params ProjectConfigGetP return } -// Generate configuration suggestions based on an OpenAPI spec +// Generate suggestions for changes to config files based on an OpenAPI spec. func (r *ProjectConfigService) Guess(ctx context.Context, params ProjectConfigGuessParams, opts ...option.RequestOption) (res *ProjectConfigGuessResponse, err error) { opts = append(r.Options[:], opts...) precfg, err := requestconfig.PreRequestOptions(opts...) @@ -111,7 +111,7 @@ func (r *ProjectConfigGuessResponseItem) UnmarshalJSON(data []byte) error { type ProjectConfigGetParams struct { // Use [option.WithProject] on the client to set a global default for this field. Project param.Opt[string] `path:"project,omitzero,required" json:"-"` - // Branch name, defaults to "main" + // Branch name, defaults to "main". Branch param.Opt[string] `query:"branch,omitzero" json:"-"` Include param.Opt[string] `query:"include,omitzero" json:"-"` paramObj diff --git a/usage_test.go b/usage_test.go index 8680afb..8564faf 100644 --- a/usage_test.go +++ b/usage_test.go @@ -24,14 +24,14 @@ func TestUsage(t *testing.T) { option.WithBaseURL(baseURL), option.WithAPIKey("My API Key"), ) - buildObject, err := client.Builds.New(context.TODO(), stainless.BuildNewParams{ - Project: stainless.String("project"), + build, err := client.Builds.New(context.TODO(), stainless.BuildNewParams{ + Project: stainless.String("stainless"), Revision: stainless.BuildNewParamsRevisionUnion{ - OfString: stainless.String("string"), + OfString: stainless.String("main"), }, }) if err != nil { t.Fatalf("err should be nil: %s", err.Error()) } - t.Logf("%+v\n", buildObject.ID) + t.Logf("%+v\n", build.ID) } From 2738bce37625d08602d18c798451f24c6461d76e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 02:13:51 +0000 Subject: [PATCH 06/11] chore: add more to diagnostics --- .stats.yml | 6 +- aliases.go | 36 +++++++++ api.md | 12 ++- build.go | 4 +- build_test.go | 5 +- builddiagnostic.go | 149 ++++++++++++++++++++++++++++------- builddiagnostic_test.go | 3 +- buildtargetoutput.go | 116 +++++++++++++++++++++------ project.go | 10 +-- project_test.go | 2 +- shared/constant/constants.go | 12 +++ shared/shared.go | 16 ++++ 12 files changed, 298 insertions(+), 73 deletions(-) diff --git a/.stats.yml b/.stats.yml index c57e36e..d0144c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-a015455f60c6b613608a0a1fc4918a41593038160a16b09f714f601ab98c84bf.yml -openapi_spec_hash: 6f4ebb173c63d77efa9addde9b11f69e -config_hash: 50a257a9f90f8a010873c283e2832095 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-5c1008fd27f64bcde1a146a4158f1c3113b4e13437a4d880bd6811fb063cfcd6.yml +openapi_spec_hash: 9583f62164b5dc15b10051dad6a7fca4 +config_hash: 0a8370ad6abcfe39671b61684a502e45 diff --git a/aliases.go b/aliases.go index 4d4814a..5ab0046 100644 --- a/aliases.go +++ b/aliases.go @@ -30,3 +30,39 @@ type FileInputContentParam = shared.FileInputContentParam // This is an alias to an internal type. type FileInputURLParam = shared.FileInputURLParam + +// This is an alias to an internal type. +type Target = shared.Target + +// Equals "node" +const TargetNode = shared.TargetNode + +// Equals "typescript" +const TargetTypescript = shared.TargetTypescript + +// Equals "python" +const TargetPython = shared.TargetPython + +// Equals "go" +const TargetGo = shared.TargetGo + +// Equals "java" +const TargetJava = shared.TargetJava + +// Equals "kotlin" +const TargetKotlin = shared.TargetKotlin + +// Equals "ruby" +const TargetRuby = shared.TargetRuby + +// Equals "terraform" +const TargetTerraform = shared.TargetTerraform + +// Equals "cli" +const TargetCli = shared.TargetCli + +// Equals "php" +const TargetPhp = shared.TargetPhp + +// Equals "csharp" +const TargetCsharp = shared.TargetCsharp diff --git a/api.md b/api.md index 7788c07..ab5e514 100644 --- a/api.md +++ b/api.md @@ -1,10 +1,12 @@ # Shared Params Types - shared.FileInputUnionParam +- shared.Target # Shared Response Types - shared.Commit +- shared.Target # Projects @@ -65,18 +67,14 @@ Methods: ## Diagnostics -Params Types: - -- stainless.Target - Response Types: -- stainless.Target -- stainless.BuildDiagnosticListResponse +- stainless.BuildDiagnostic +- stainless.BuildDiagnosticMoreUnion Methods: -- client.Builds.Diagnostics.List(ctx context.Context, buildID string, query stainless.BuildDiagnosticListParams) (pagination.Page[stainless.BuildDiagnosticListResponse], error) +- client.Builds.Diagnostics.List(ctx context.Context, buildID string, query stainless.BuildDiagnosticListParams) (pagination.Page[stainless.BuildDiagnostic], error) ## TargetOutputs diff --git a/build.go b/build.go index 67c9c04..4b7c58a 100644 --- a/build.go +++ b/build.go @@ -713,7 +713,7 @@ type BuildNewParams struct { CommitMessage param.Opt[string] `json:"commit_message,omitzero"` // Optional list of SDK targets to build. If not specified, all configured targets // will be built. - Targets []Target `json:"targets,omitzero"` + Targets []shared.Target `json:"targets,omitzero"` paramObj } @@ -817,7 +817,7 @@ type BuildCompareParams struct { Head BuildCompareParamsHead `json:"head,omitzero,required"` // Optional list of SDK targets to build. If not specified, all configured targets // will be built. - Targets []Target `json:"targets,omitzero"` + Targets []shared.Target `json:"targets,omitzero"` paramObj } diff --git a/build_test.go b/build_test.go index 706c8e2..57271a5 100644 --- a/build_test.go +++ b/build_test.go @@ -11,6 +11,7 @@ import ( "github.com/stainless-api/stainless-api-go" "github.com/stainless-api/stainless-api-go/internal/testutil" "github.com/stainless-api/stainless-api-go/option" + "github.com/stainless-api/stainless-api-go/shared" ) func TestBuildNewWithOptionalParams(t *testing.T) { @@ -34,7 +35,7 @@ func TestBuildNewWithOptionalParams(t *testing.T) { AllowEmpty: stainless.Bool(true), Branch: stainless.String("branch"), CommitMessage: stainless.String("commit_message"), - Targets: []stainless.Target{stainless.TargetNode}, + Targets: []shared.Target{shared.TargetNode}, }) if err != nil { var apierr *stainless.Error @@ -128,7 +129,7 @@ func TestBuildCompareWithOptionalParams(t *testing.T) { CommitMessage: stainless.String("commit_message"), }, Project: stainless.String("project"), - Targets: []stainless.Target{stainless.TargetNode}, + Targets: []shared.Target{shared.TargetNode}, }) if err != nil { var apierr *stainless.Error diff --git a/builddiagnostic.go b/builddiagnostic.go index 40639b7..74f4b5e 100644 --- a/builddiagnostic.go +++ b/builddiagnostic.go @@ -4,6 +4,7 @@ package stainless import ( "context" + "encoding/json" "errors" "fmt" "net/http" @@ -16,6 +17,8 @@ import ( "github.com/stainless-api/stainless-api-go/packages/pagination" "github.com/stainless-api/stainless-api-go/packages/param" "github.com/stainless-api/stainless-api-go/packages/respjson" + "github.com/stainless-api/stainless-api-go/shared" + "github.com/stainless-api/stainless-api-go/shared/constant" ) // BuildDiagnosticService contains methods and other services that help with @@ -41,7 +44,7 @@ func NewBuildDiagnosticService(opts ...option.RequestOption) (r BuildDiagnosticS // // If no language targets are specified, diagnostics for all languages are // returned. -func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) (res *pagination.Page[BuildDiagnosticListResponse], err error) { +func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) (res *pagination.Page[BuildDiagnostic], err error) { var raw *http.Response opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -66,27 +69,11 @@ func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query // // If no language targets are specified, diagnostics for all languages are // returned. -func (r *BuildDiagnosticService) ListAutoPaging(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BuildDiagnosticListResponse] { +func (r *BuildDiagnosticService) ListAutoPaging(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) *pagination.PageAutoPager[BuildDiagnostic] { return pagination.NewPageAutoPager(r.List(ctx, buildID, query, opts...)) } -type Target string - -const ( - TargetNode Target = "node" - TargetTypescript Target = "typescript" - TargetPython Target = "python" - TargetGo Target = "go" - TargetJava Target = "java" - TargetKotlin Target = "kotlin" - TargetRuby Target = "ruby" - TargetTerraform Target = "terraform" - TargetCli Target = "cli" - TargetPhp Target = "php" - TargetCsharp Target = "csharp" -) - -type BuildDiagnosticListResponse struct { +type BuildDiagnostic struct { // The kind of diagnostic. Code string `json:"code,required"` // Whether the diagnostic is ignored in the Stainless config. @@ -94,9 +81,10 @@ type BuildDiagnosticListResponse struct { // The severity of the diagnostic. // // Any of "fatal", "error", "warning", "note". - Level BuildDiagnosticListResponseLevel `json:"level,required"` + Level BuildDiagnosticLevel `json:"level,required"` // A description of the diagnostic. - Message string `json:"message,required"` + Message string `json:"message,required"` + More BuildDiagnosticMoreUnion `json:"more,required"` // A JSON pointer to a relevant field in the Stainless config. ConfigRef string `json:"config_ref"` // A JSON pointer to a relevant field in the OpenAPI spec. @@ -107,6 +95,7 @@ type BuildDiagnosticListResponse struct { Ignored respjson.Field Level respjson.Field Message respjson.Field + More respjson.Field ConfigRef respjson.Field OasRef respjson.Field ExtraFields map[string]respjson.Field @@ -115,21 +104,123 @@ type BuildDiagnosticListResponse struct { } // Returns the unmodified JSON received from the API -func (r BuildDiagnosticListResponse) RawJSON() string { return r.JSON.raw } -func (r *BuildDiagnosticListResponse) UnmarshalJSON(data []byte) error { +func (r BuildDiagnostic) RawJSON() string { return r.JSON.raw } +func (r *BuildDiagnostic) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } // The severity of the diagnostic. -type BuildDiagnosticListResponseLevel string +type BuildDiagnosticLevel string const ( - BuildDiagnosticListResponseLevelFatal BuildDiagnosticListResponseLevel = "fatal" - BuildDiagnosticListResponseLevelError BuildDiagnosticListResponseLevel = "error" - BuildDiagnosticListResponseLevelWarning BuildDiagnosticListResponseLevel = "warning" - BuildDiagnosticListResponseLevelNote BuildDiagnosticListResponseLevel = "note" + BuildDiagnosticLevelFatal BuildDiagnosticLevel = "fatal" + BuildDiagnosticLevelError BuildDiagnosticLevel = "error" + BuildDiagnosticLevelWarning BuildDiagnosticLevel = "warning" + BuildDiagnosticLevelNote BuildDiagnosticLevel = "note" ) +// BuildDiagnosticMoreUnion contains all possible properties and values from +// [BuildDiagnosticMoreMarkdown], [BuildDiagnosticMoreRaw]. +// +// Use the [BuildDiagnosticMoreUnion.AsAny] method to switch on the variant. +// +// Use the methods beginning with 'As' to cast the union to one of its variants. +type BuildDiagnosticMoreUnion struct { + // This field is from variant [BuildDiagnosticMoreMarkdown]. + Markdown string `json:"markdown"` + // Any of "markdown", "raw". + Type string `json:"type"` + // This field is from variant [BuildDiagnosticMoreRaw]. + Raw string `json:"raw"` + JSON struct { + Markdown respjson.Field + Type respjson.Field + Raw respjson.Field + raw string + } `json:"-"` +} + +// anyBuildDiagnosticMore is implemented by each variant of +// [BuildDiagnosticMoreUnion] to add type safety for the return type of +// [BuildDiagnosticMoreUnion.AsAny] +type anyBuildDiagnosticMore interface { + implBuildDiagnosticMoreUnion() +} + +func (BuildDiagnosticMoreMarkdown) implBuildDiagnosticMoreUnion() {} +func (BuildDiagnosticMoreRaw) implBuildDiagnosticMoreUnion() {} + +// Use the following switch statement to find the correct variant +// +// switch variant := BuildDiagnosticMoreUnion.AsAny().(type) { +// case stainless.BuildDiagnosticMoreMarkdown: +// case stainless.BuildDiagnosticMoreRaw: +// default: +// fmt.Errorf("no variant present") +// } +func (u BuildDiagnosticMoreUnion) AsAny() anyBuildDiagnosticMore { + switch u.Type { + case "markdown": + return u.AsMarkdown() + case "raw": + return u.AsRaw() + } + return nil +} + +func (u BuildDiagnosticMoreUnion) AsMarkdown() (v BuildDiagnosticMoreMarkdown) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +func (u BuildDiagnosticMoreUnion) AsRaw() (v BuildDiagnosticMoreRaw) { + apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) + return +} + +// Returns the unmodified JSON received from the API +func (u BuildDiagnosticMoreUnion) RawJSON() string { return u.JSON.raw } + +func (r *BuildDiagnosticMoreUnion) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type BuildDiagnosticMoreMarkdown struct { + Markdown string `json:"markdown,required"` + Type constant.Markdown `json:"type,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Markdown respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BuildDiagnosticMoreMarkdown) RawJSON() string { return r.JSON.raw } +func (r *BuildDiagnosticMoreMarkdown) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type BuildDiagnosticMoreRaw struct { + Raw string `json:"raw,required"` + Type constant.Raw `json:"type,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Raw respjson.Field + Type respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BuildDiagnosticMoreRaw) RawJSON() string { return r.JSON.raw } +func (r *BuildDiagnosticMoreRaw) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + type BuildDiagnosticListParams struct { // Pagination cursor from a previous response Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"` @@ -140,7 +231,7 @@ type BuildDiagnosticListParams struct { // Any of "fatal", "error", "warning", "note". Severity BuildDiagnosticListParamsSeverity `query:"severity,omitzero" json:"-"` // Optional list of language targets to filter diagnostics by - Targets []Target `query:"targets,omitzero" json:"-"` + Targets []shared.Target `query:"targets,omitzero" json:"-"` paramObj } diff --git a/builddiagnostic_test.go b/builddiagnostic_test.go index 11684c9..844918f 100644 --- a/builddiagnostic_test.go +++ b/builddiagnostic_test.go @@ -11,6 +11,7 @@ import ( "github.com/stainless-api/stainless-api-go" "github.com/stainless-api/stainless-api-go/internal/testutil" "github.com/stainless-api/stainless-api-go/option" + "github.com/stainless-api/stainless-api-go/shared" ) func TestBuildDiagnosticListWithOptionalParams(t *testing.T) { @@ -33,7 +34,7 @@ func TestBuildDiagnosticListWithOptionalParams(t *testing.T) { Cursor: stainless.String("cursor"), Limit: stainless.Float(1), Severity: stainless.BuildDiagnosticListParamsSeverityFatal, - Targets: []stainless.Target{stainless.TargetNode}, + Targets: []shared.Target{shared.TargetNode}, }, ) if err != nil { diff --git a/buildtargetoutput.go b/buildtargetoutput.go index 7cdb940..8973908 100644 --- a/buildtargetoutput.go +++ b/buildtargetoutput.go @@ -13,6 +13,8 @@ import ( "github.com/stainless-api/stainless-api-go/internal/requestconfig" "github.com/stainless-api/stainless-api-go/option" "github.com/stainless-api/stainless-api-go/packages/respjson" + "github.com/stainless-api/stainless-api-go/shared" + "github.com/stainless-api/stainless-api-go/shared/constant" ) // BuildTargetOutputService contains methods and other services that help with @@ -52,21 +54,22 @@ func (r *BuildTargetOutputService) Get(ctx context.Context, query BuildTargetOut } // BuildTargetOutputGetResponseUnion contains all possible properties and values -// from [BuildTargetOutputGetResponseObject], [BuildTargetOutputGetResponseObject]. +// from [BuildTargetOutputGetResponseURL], [BuildTargetOutputGetResponseGit]. +// +// Use the [BuildTargetOutputGetResponseUnion.AsAny] method to switch on the +// variant. // // Use the methods beginning with 'As' to cast the union to one of its variants. type BuildTargetOutputGetResponseUnion struct { - // This field is from variant [BuildTargetOutputGetResponseObject]. + // Any of "url", "git". Output string `json:"output"` - // This field is from variant [BuildTargetOutputGetResponseObject]. - Target Target `json:"target"` - // This field is from variant [BuildTargetOutputGetResponseObject]. - Type BuildTargetOutputGetResponseObjectType `json:"type"` - // This field is from variant [BuildTargetOutputGetResponseObject]. - URL string `json:"url"` - // This field is from variant [BuildTargetOutputGetResponseObject]. + // This field is from variant [BuildTargetOutputGetResponseURL]. + Target shared.Target `json:"target"` + Type string `json:"type"` + URL string `json:"url"` + // This field is from variant [BuildTargetOutputGetResponseGit]. Token string `json:"token"` - // This field is from variant [BuildTargetOutputGetResponseObject]. + // This field is from variant [BuildTargetOutputGetResponseGit]. Ref string `json:"ref"` JSON struct { Output respjson.Field @@ -79,12 +82,40 @@ type BuildTargetOutputGetResponseUnion struct { } `json:"-"` } -func (u BuildTargetOutputGetResponseUnion) AsBuildTargetOutputGetResponseObject() (v BuildTargetOutputGetResponseObject) { +// anyBuildTargetOutputGetResponse is implemented by each variant of +// [BuildTargetOutputGetResponseUnion] to add type safety for the return type of +// [BuildTargetOutputGetResponseUnion.AsAny] +type anyBuildTargetOutputGetResponse interface { + implBuildTargetOutputGetResponseUnion() +} + +func (BuildTargetOutputGetResponseURL) implBuildTargetOutputGetResponseUnion() {} +func (BuildTargetOutputGetResponseGit) implBuildTargetOutputGetResponseUnion() {} + +// Use the following switch statement to find the correct variant +// +// switch variant := BuildTargetOutputGetResponseUnion.AsAny().(type) { +// case stainless.BuildTargetOutputGetResponseURL: +// case stainless.BuildTargetOutputGetResponseGit: +// default: +// fmt.Errorf("no variant present") +// } +func (u BuildTargetOutputGetResponseUnion) AsAny() anyBuildTargetOutputGetResponse { + switch u.Output { + case "url": + return u.AsURL() + case "git": + return u.AsGit() + } + return nil +} + +func (u BuildTargetOutputGetResponseUnion) AsURL() (v BuildTargetOutputGetResponseURL) { apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) return } -func (u BuildTargetOutputGetResponseUnion) AsVariant2() (v BuildTargetOutputGetResponseObject) { +func (u BuildTargetOutputGetResponseUnion) AsGit() (v BuildTargetOutputGetResponseGit) { apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v) return } @@ -96,14 +127,13 @@ func (r *BuildTargetOutputGetResponseUnion) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -type BuildTargetOutputGetResponseObject struct { - // Any of "url". - Output string `json:"output,required"` +type BuildTargetOutputGetResponseURL struct { + Output constant.URL `json:"output,required"` // Any of "node", "typescript", "python", "go", "java", "kotlin", "ruby", // "terraform", "cli", "php", "csharp". - Target Target `json:"target,required"` + Target shared.Target `json:"target,required"` // Any of "source", "dist", "wheel". - Type BuildTargetOutputGetResponseObjectType `json:"type,required"` + Type BuildTargetOutputGetResponseURLType `json:"type,required"` // URL for direct download URL string `json:"url,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. @@ -118,17 +148,57 @@ type BuildTargetOutputGetResponseObject struct { } // Returns the unmodified JSON received from the API -func (r BuildTargetOutputGetResponseObject) RawJSON() string { return r.JSON.raw } -func (r *BuildTargetOutputGetResponseObject) UnmarshalJSON(data []byte) error { +func (r BuildTargetOutputGetResponseURL) RawJSON() string { return r.JSON.raw } +func (r *BuildTargetOutputGetResponseURL) UnmarshalJSON(data []byte) error { + return apijson.UnmarshalRoot(data, r) +} + +type BuildTargetOutputGetResponseURLType string + +const ( + BuildTargetOutputGetResponseURLTypeSource BuildTargetOutputGetResponseURLType = "source" + BuildTargetOutputGetResponseURLTypeDist BuildTargetOutputGetResponseURLType = "dist" + BuildTargetOutputGetResponseURLTypeWheel BuildTargetOutputGetResponseURLType = "wheel" +) + +type BuildTargetOutputGetResponseGit struct { + // Temporary GitHub access token + Token string `json:"token,required"` + Output constant.Git `json:"output,required"` + // Git reference (commit SHA, branch, or tag) + Ref string `json:"ref,required"` + // Any of "node", "typescript", "python", "go", "java", "kotlin", "ruby", + // "terraform", "cli", "php", "csharp". + Target shared.Target `json:"target,required"` + // Any of "source", "dist", "wheel". + Type BuildTargetOutputGetResponseGitType `json:"type,required"` + // URL to git remote + URL string `json:"url,required"` + // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. + JSON struct { + Token respjson.Field + Output respjson.Field + Ref respjson.Field + Target respjson.Field + Type respjson.Field + URL respjson.Field + ExtraFields map[string]respjson.Field + raw string + } `json:"-"` +} + +// Returns the unmodified JSON received from the API +func (r BuildTargetOutputGetResponseGit) RawJSON() string { return r.JSON.raw } +func (r *BuildTargetOutputGetResponseGit) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } -type BuildTargetOutputGetResponseObjectType string +type BuildTargetOutputGetResponseGitType string const ( - BuildTargetOutputGetResponseObjectTypeSource BuildTargetOutputGetResponseObjectType = "source" - BuildTargetOutputGetResponseObjectTypeDist BuildTargetOutputGetResponseObjectType = "dist" - BuildTargetOutputGetResponseObjectTypeWheel BuildTargetOutputGetResponseObjectType = "wheel" + BuildTargetOutputGetResponseGitTypeSource BuildTargetOutputGetResponseGitType = "source" + BuildTargetOutputGetResponseGitTypeDist BuildTargetOutputGetResponseGitType = "dist" + BuildTargetOutputGetResponseGitTypeWheel BuildTargetOutputGetResponseGitType = "wheel" ) type BuildTargetOutputGetResponseType string diff --git a/project.go b/project.go index c1665f6..1bc461c 100644 --- a/project.go +++ b/project.go @@ -112,10 +112,10 @@ type Project struct { ConfigRepo string `json:"config_repo,required"` DisplayName string `json:"display_name,required"` // Any of "project". - Object ProjectObject `json:"object,required"` - Org string `json:"org,required"` - Slug string `json:"slug,required"` - Targets []Target `json:"targets,required"` + Object ProjectObject `json:"object,required"` + Org string `json:"org,required"` + Slug string `json:"slug,required"` + Targets []shared.Target `json:"targets,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. JSON struct { ConfigRepo respjson.Field @@ -151,7 +151,7 @@ type ProjectNewParams struct { // Project name/slug Slug string `json:"slug,required"` // Targets to generate for - Targets []Target `json:"targets,omitzero,required"` + Targets []shared.Target `json:"targets,omitzero,required"` paramObj } diff --git a/project_test.go b/project_test.go index e0c1e5f..6891a1e 100644 --- a/project_test.go +++ b/project_test.go @@ -38,7 +38,7 @@ func TestProjectNew(t *testing.T) { }, }, Slug: "slug", - Targets: []stainless.Target{stainless.TargetNode}, + Targets: []shared.Target{shared.TargetNode}, }) if err != nil { var apierr *stainless.Error diff --git a/shared/constant/constants.go b/shared/constant/constants.go index 71bbdd7..7aa9ba1 100644 --- a/shared/constant/constants.go +++ b/shared/constant/constants.go @@ -19,19 +19,31 @@ func ValueOf[T Constant[T]]() T { } type Completed string // Always "completed" +type Git string // Always "git" type InProgress string // Always "in_progress" +type Markdown string // Always "markdown" type NotStarted string // Always "not_started" type Queued string // Always "queued" +type Raw string // Always "raw" +type URL string // Always "url" func (c Completed) Default() Completed { return "completed" } +func (c Git) Default() Git { return "git" } func (c InProgress) Default() InProgress { return "in_progress" } +func (c Markdown) Default() Markdown { return "markdown" } func (c NotStarted) Default() NotStarted { return "not_started" } func (c Queued) Default() Queued { return "queued" } +func (c Raw) Default() Raw { return "raw" } +func (c URL) Default() URL { return "url" } func (c Completed) MarshalJSON() ([]byte, error) { return marshalString(c) } +func (c Git) MarshalJSON() ([]byte, error) { return marshalString(c) } func (c InProgress) MarshalJSON() ([]byte, error) { return marshalString(c) } +func (c Markdown) MarshalJSON() ([]byte, error) { return marshalString(c) } func (c NotStarted) MarshalJSON() ([]byte, error) { return marshalString(c) } func (c Queued) MarshalJSON() ([]byte, error) { return marshalString(c) } +func (c Raw) MarshalJSON() ([]byte, error) { return marshalString(c) } +func (c URL) MarshalJSON() ([]byte, error) { return marshalString(c) } type constant[T any] interface { Constant[T] diff --git a/shared/shared.go b/shared/shared.go index 1cc024d..e96647a 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -118,3 +118,19 @@ func (r FileInputURLParam) MarshalJSON() (data []byte, err error) { func (r *FileInputURLParam) UnmarshalJSON(data []byte) error { return apijson.UnmarshalRoot(data, r) } + +type Target string + +const ( + TargetNode Target = "node" + TargetTypescript Target = "typescript" + TargetPython Target = "python" + TargetGo Target = "go" + TargetJava Target = "java" + TargetKotlin Target = "kotlin" + TargetRuby Target = "ruby" + TargetTerraform Target = "terraform" + TargetCli Target = "cli" + TargetPhp Target = "php" + TargetCsharp Target = "csharp" +) From 02dcae6d255f5721f9567d4760390d07a4411a66 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:38:07 +0000 Subject: [PATCH 07/11] chore: bump minimum go version to 1.22 --- go.mod | 2 +- internal/encoding/json/shims/shims.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 38fda1c..bfb379e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/stainless-api/stainless-api-go -go 1.21 +go 1.22 require ( github.com/tidwall/gjson v1.14.4 diff --git a/internal/encoding/json/shims/shims.go b/internal/encoding/json/shims/shims.go index b65a016..fe9a71a 100644 --- a/internal/encoding/json/shims/shims.go +++ b/internal/encoding/json/shims/shims.go @@ -1,5 +1,5 @@ // This package provides shims over Go 1.2{2,3} APIs -// which are missing from Go 1.21, and used by the Go 1.24 encoding/json package. +// which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. // // Inside the vendored package, all shim code has comments that begin look like // // SHIM(...): ... From 6ff4f7b89fed2e2e2deee5a9c81fa090507c356d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:39:19 +0000 Subject: [PATCH 08/11] chore: update more docs for 1.22 --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8de4470..c987219 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ $ ./scripts/lint This will install all the required dependencies and build the SDK. -You can also [install go 1.18+ manually](https://go.dev/doc/install). +You can also [install go 1.22+ manually](https://go.dev/doc/install). ## Modifying/Adding code diff --git a/README.md b/README.md index 045b6a5..ce90dc7 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ go get -u 'github.com/stainless-api/stainless-api-go@v0.24.0' ## Requirements -This library requires Go 1.18+. +This library requires Go 1.22+. ## Usage From 2fe476f3aead6384eac77f714d8e64be13b5fe56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:40:05 +0000 Subject: [PATCH 09/11] fix: use slices.Concat instead of sometimes modifying r.Options --- build.go | 9 +++++---- builddiagnostic.go | 3 ++- buildtargetoutput.go | 3 ++- client.go | 3 ++- org.go | 5 +++-- project.go | 9 +++++---- projectbranch.go | 11 ++++++----- projectconfig.go | 5 +++-- 8 files changed, 28 insertions(+), 20 deletions(-) diff --git a/build.go b/build.go index 4b7c58a..185076a 100644 --- a/build.go +++ b/build.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "time" "github.com/stainless-api/stainless-api-go/internal/apijson" @@ -50,7 +51,7 @@ func NewBuildService(opts ...option.RequestOption) (r BuildService) { // The project branch will be modified so that its latest set of config files // points to the one specified by the input revision. func (r *BuildService) New(ctx context.Context, body BuildNewParams, opts ...option.RequestOption) (res *Build, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -63,7 +64,7 @@ func (r *BuildService) New(ctx context.Context, body BuildNewParams, opts ...opt // Retrieve a build by its ID. func (r *BuildService) Get(ctx context.Context, buildID string, opts ...option.RequestOption) (res *Build, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) if buildID == "" { err = errors.New("missing required buildId parameter") return @@ -79,7 +80,7 @@ func (r *BuildService) Get(ctx context.Context, buildID string, opts ...option.R // of file contents. func (r *BuildService) List(ctx context.Context, query BuildListParams, opts ...option.RequestOption) (res *pagination.Page[Build], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { @@ -117,7 +118,7 @@ func (r *BuildService) ListAutoPaging(ctx context.Context, query BuildListParams // Builds made via this endpoint are guaranteed to have differences arising from // the set of config files, and any custom code. func (r *BuildService) Compare(ctx context.Context, body BuildCompareParams, opts ...option.RequestOption) (res *BuildCompareResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return diff --git a/builddiagnostic.go b/builddiagnostic.go index 74f4b5e..cc1fc1c 100644 --- a/builddiagnostic.go +++ b/builddiagnostic.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/apiquery" @@ -46,7 +47,7 @@ func NewBuildDiagnosticService(opts ...option.RequestOption) (r BuildDiagnosticS // returned. func (r *BuildDiagnosticService) List(ctx context.Context, buildID string, query BuildDiagnosticListParams, opts ...option.RequestOption) (res *pagination.Page[BuildDiagnostic], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) if buildID == "" { err = errors.New("missing required buildId parameter") diff --git a/buildtargetoutput.go b/buildtargetoutput.go index 8973908..74799ca 100644 --- a/buildtargetoutput.go +++ b/buildtargetoutput.go @@ -7,6 +7,7 @@ import ( "encoding/json" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/apiquery" @@ -47,7 +48,7 @@ func NewBuildTargetOutputService(opts ...option.RequestOption) (r BuildTargetOut // and the output method _must_ be `url`. See the documentation for `type` for more // information. func (r *BuildTargetOutputService) Get(ctx context.Context, query BuildTargetOutputGetParams, opts ...option.RequestOption) (res *BuildTargetOutputGetResponseUnion, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "v0/build_target_outputs" err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) return diff --git a/client.go b/client.go index 487a3ce..64affd0 100644 --- a/client.go +++ b/client.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "os" + "slices" "github.com/stainless-api/stainless-api-go/internal/requestconfig" "github.com/stainless-api/stainless-api-go/option" @@ -82,7 +83,7 @@ func NewClient(opts ...option.RequestOption) (r Client) { // For even greater flexibility, see [option.WithResponseInto] and // [option.WithResponseBodyInto]. func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error { - opts = append(r.Options, opts...) + opts = slices.Concat(r.Options, opts) return requestconfig.ExecuteNewRequest(ctx, method, path, params, res, opts...) } diff --git a/org.go b/org.go index a64e199..e4dda53 100644 --- a/org.go +++ b/org.go @@ -8,6 +8,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/requestconfig" @@ -36,7 +37,7 @@ func NewOrgService(opts ...option.RequestOption) (r OrgService) { // Retrieve an organization by name. func (r *OrgService) Get(ctx context.Context, org string, opts ...option.RequestOption) (res *Org, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) if org == "" { err = errors.New("missing required org parameter") return @@ -48,7 +49,7 @@ func (r *OrgService) Get(ctx context.Context, org string, opts ...option.Request // List organizations accessible to the current authentication method. func (r *OrgService) List(ctx context.Context, opts ...option.RequestOption) (res *OrgListResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "v0/orgs" err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) return diff --git a/project.go b/project.go index 1bc461c..491d17c 100644 --- a/project.go +++ b/project.go @@ -8,6 +8,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/apiquery" @@ -44,7 +45,7 @@ func NewProjectService(opts ...option.RequestOption) (r ProjectService) { // Create a new project. func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts ...option.RequestOption) (res *Project, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "v0/projects" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -52,7 +53,7 @@ func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts .. // Retrieve a project by name. func (r *ProjectService) Get(ctx context.Context, query ProjectGetParams, opts ...option.RequestOption) (res *Project, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -69,7 +70,7 @@ func (r *ProjectService) Get(ctx context.Context, query ProjectGetParams, opts . // Update a project's properties. func (r *ProjectService) Update(ctx context.Context, params ProjectUpdateParams, opts ...option.RequestOption) (res *Project, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -87,7 +88,7 @@ func (r *ProjectService) Update(ctx context.Context, params ProjectUpdateParams, // List projects in an organization, from oldest to newest. func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts ...option.RequestOption) (res *pagination.Page[Project], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "v0/projects" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) diff --git a/projectbranch.go b/projectbranch.go index 4895f1c..6f4570b 100644 --- a/projectbranch.go +++ b/projectbranch.go @@ -8,6 +8,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/apiquery" @@ -43,7 +44,7 @@ func NewProjectBranchService(opts ...option.RequestOption) (r ProjectBranchServi // `branch_from` parameter. In addition, if the revision is a branch name, the // branch will also inherit custom code changes from that branch. func (r *ProjectBranchService) New(ctx context.Context, params ProjectBranchNewParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -60,7 +61,7 @@ func (r *ProjectBranchService) New(ctx context.Context, params ProjectBranchNewP // Retrieve a project branch by name. func (r *ProjectBranchService) Get(ctx context.Context, branch string, query ProjectBranchGetParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -82,7 +83,7 @@ func (r *ProjectBranchService) Get(ctx context.Context, branch string, query Pro // Retrieve a project branch by name. func (r *ProjectBranchService) List(ctx context.Context, params ProjectBranchListParams, opts ...option.RequestOption) (res *pagination.Page[ProjectBranchListResponse], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { @@ -113,7 +114,7 @@ func (r *ProjectBranchService) ListAutoPaging(ctx context.Context, params Projec // Delete a project branch by name. func (r *ProjectBranchService) Delete(ctx context.Context, branch string, body ProjectBranchDeleteParams, opts ...option.RequestOption) (res *ProjectBranchDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -137,7 +138,7 @@ func (r *ProjectBranchService) Delete(ctx context.Context, branch string, body P // The branch is rebased onto the `base` branch or commit SHA, inheriting any // config and custom code changes. func (r *ProjectBranchService) Rebase(ctx context.Context, branch string, params ProjectBranchRebaseParams, opts ...option.RequestOption) (res *ProjectBranch, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return diff --git a/projectconfig.go b/projectconfig.go index 5c3f164..ab6a397 100644 --- a/projectconfig.go +++ b/projectconfig.go @@ -8,6 +8,7 @@ import ( "fmt" "net/http" "net/url" + "slices" "github.com/stainless-api/stainless-api-go/internal/apijson" "github.com/stainless-api/stainless-api-go/internal/apiquery" @@ -38,7 +39,7 @@ func NewProjectConfigService(opts ...option.RequestOption) (r ProjectConfigServi // Retrieve the configuration files for a given project. func (r *ProjectConfigService) Get(ctx context.Context, params ProjectConfigGetParams, opts ...option.RequestOption) (res *ProjectConfigGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return @@ -55,7 +56,7 @@ func (r *ProjectConfigService) Get(ctx context.Context, params ProjectConfigGetP // Generate suggestions for changes to config files based on an OpenAPI spec. func (r *ProjectConfigService) Guess(ctx context.Context, params ProjectConfigGuessParams, opts ...option.RequestOption) (res *ProjectConfigGuessResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) precfg, err := requestconfig.PreRequestOptions(opts...) if err != nil { return From d86bb1368002c0b2f1ba5229428ec73efee2b2ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 03:40:58 +0000 Subject: [PATCH 10/11] chore: do not install brew dependencies in ./scripts/bootstrap by default --- scripts/bootstrap | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index d6ac165..5ab3066 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From cf41543a8585262104603ddc31b1f9cd8cf14d95 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 19 Sep 2025 23:41:13 -0400 Subject: [PATCH 11/11] release: 0.25.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d2d60a3..a36746b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.24.0" + ".": "0.25.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5931716..9c44ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.25.0 (2025-09-20) + +Full Changelog: [v0.24.0...v0.25.0](https://github.com/stainless-api/stainless-api-go/compare/v0.24.0...v0.25.0) + +### Features + +* **api:** docs ([1e2bb41](https://github.com/stainless-api/stainless-api-go/commit/1e2bb41ccad74b245ebbe42473449c5fdc546b0c)) + + +### Bug Fixes + +* **internal:** unmarshal correctly when there are multiple discriminators ([483b23c](https://github.com/stainless-api/stainless-api-go/commit/483b23c5999d093fd7348e42afae589181b7b182)) +* use slices.Concat instead of sometimes modifying r.Options ([2fe476f](https://github.com/stainless-api/stainless-api-go/commit/2fe476f3aead6384eac77f714d8e64be13b5fe56)) + + +### Chores + +* add more to diagnostics ([2738bce](https://github.com/stainless-api/stainless-api-go/commit/2738bce37625d08602d18c798451f24c6461d76e)) +* bump minimum go version to 1.22 ([02dcae6](https://github.com/stainless-api/stainless-api-go/commit/02dcae6d255f5721f9567d4760390d07a4411a66)) +* do not install brew dependencies in ./scripts/bootstrap by default ([d86bb13](https://github.com/stainless-api/stainless-api-go/commit/d86bb1368002c0b2f1ba5229428ec73efee2b2ff)) +* **internal:** codegen related update ([8693156](https://github.com/stainless-api/stainless-api-go/commit/86931566d48420dd214db29b5a1364ef91269f08)) +* update more docs for 1.22 ([6ff4f7b](https://github.com/stainless-api/stainless-api-go/commit/6ff4f7b89fed2e2e2deee5a9c81fa090507c356d)) + ## 0.24.0 (2025-08-30) Full Changelog: [v0.23.0...v0.24.0](https://github.com/stainless-api/stainless-api-go/compare/v0.23.0...v0.24.0) diff --git a/README.md b/README.md index ce90dc7..28788aa 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Or to pin the version: ```sh -go get -u 'github.com/stainless-api/stainless-api-go@v0.24.0' +go get -u 'github.com/stainless-api/stainless-api-go@v0.25.0' ``` diff --git a/internal/version.go b/internal/version.go index 5f694dc..de6cef8 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.24.0" // x-release-please-version +const PackageVersion = "0.25.0" // x-release-please-version