Skip to content

Commit fa1c817

Browse files
authored
Merge pull request #41 from stainless-api/release-please--branches--main--changes--next
release: 0.27.0
2 parents bcc4be5 + fe541b8 commit fa1c817

File tree

11 files changed

+99
-12
lines changed

11 files changed

+99
-12
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.26.0"
2+
".": "0.27.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 20
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-030e47a1bfd79a657974f5beddd685940ec04b1aa1786c3b2cb0f4610ad2b42c.yml
3-
openapi_spec_hash: 33b337af28bcc1c9aa1a5218acf2a7fe
4-
config_hash: ebaca4741c1a2caf1372aa5bba88d4c7
1+
configured_endpoints: 21
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-ec93b81b2d599edd19449bae3cb40bdb17890908d97cc867e36425a45e491c16.yml
3+
openapi_spec_hash: fe8b8fd7782670698fecfe2fcc05f693
4+
config_hash: 626376bcac885a796930ef32094b8387

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.27.0 (2025-11-13)
4+
5+
Full Changelog: [v0.26.0...v0.27.0](https://github.com/stainless-api/stainless-api-go/compare/v0.26.0...v0.27.0)
6+
7+
### Features
8+
9+
* **api:** add branch reset functionality ([bc2d34b](https://github.com/stainless-api/stainless-api-go/commit/bc2d34b482890531f569f80145098155016c811b))
10+
11+
12+
### Chores
13+
14+
* bump gjson version ([e184162](https://github.com/stainless-api/stainless-api-go/commit/e18416285bd4ee3216cd921b6f3cac67f65ffe6b))
15+
* **internal:** grammar fix (it's -> its) ([f99f299](https://github.com/stainless-api/stainless-api-go/commit/f99f299b11538f0b426e2be90a922486772056f1))
16+
317
## 0.26.0 (2025-10-07)
418

519
Full Changelog: [v0.25.0...v0.26.0](https://github.com/stainless-api/stainless-api-go/compare/v0.25.0...v0.26.0)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Or to pin the version:
2828
<!-- x-release-please-start-version -->
2929

3030
```sh
31-
go get -u 'github.com/stainless-api/stainless-api-go@v0.26.0'
31+
go get -u 'github.com/stainless-api/stainless-api-go@v0.27.0'
3232
```
3333

3434
<!-- x-release-please-end -->
@@ -131,7 +131,7 @@ custom := param.Override[stainless.FooParams](12)
131131

132132
### Request unions
133133

134-
Unions are represented as a struct with fields prefixed by "Of" for each of it's variants,
134+
Unions are represented as a struct with fields prefixed by "Of" for each of its variants,
135135
only one field can be non-zero. The non-zero field will be serialized.
136136

137137
Sub-properties of the union can be accessed via methods on the union struct.

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Methods:
3636
- <code title="get /v0/projects/{project}/branches">client.Projects.Branches.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchListParams">ProjectBranchListParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/packages/pagination#Page">Page</a>[<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchListResponse">ProjectBranchListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
3737
- <code title="delete /v0/projects/{project}/branches/{branch}">client.Projects.Branches.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, branch <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchDeleteParams">ProjectBranchDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchDeleteResponse">ProjectBranchDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
3838
- <code title="put /v0/projects/{project}/branches/{branch}/rebase">client.Projects.Branches.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchService.Rebase">Rebase</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, branch <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchRebaseParams">ProjectBranchRebaseParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranch">ProjectBranch</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
39+
- <code title="put /v0/projects/{project}/branches/{branch}/reset">client.Projects.Branches.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchService.Reset">Reset</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, branch <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranchResetParams">ProjectBranchResetParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go">stainless</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#ProjectBranch">ProjectBranch</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
3940

4041
## Configs
4142

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/stainless-api/stainless-api-go
33
go 1.22
44

55
require (
6-
github.com/tidwall/gjson v1.14.4
6+
github.com/tidwall/gjson v1.18.0
77
github.com/tidwall/sjson v1.2.5
88
)
99

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
2-
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
3-
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
2+
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
3+
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
44
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
55
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
66
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=

internal/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
package internal
44

5-
const PackageVersion = "0.26.0" // x-release-please-version
5+
const PackageVersion = "0.27.0" // x-release-please-version

packages/respjson/respjson.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package respjson
55
// Use [Field.Valid] to check if an optional value was null or omitted.
66
//
77
// A Field will always occur in the following structure, where it
8-
// mirrors the original field in it's parent struct:
8+
// mirrors the original field in its parent struct:
99
//
1010
// type ExampleObject struct {
1111
// Foo bool `json:"foo"`

projectbranch.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,30 @@ func (r *ProjectBranchService) Rebase(ctx context.Context, branch string, params
157157
return
158158
}
159159

160+
// Reset a project branch.
161+
//
162+
// If `branch` === `main`, the branch is reset to `target_config_sha`. Otherwise,
163+
// the branch is reset to `main`.
164+
func (r *ProjectBranchService) Reset(ctx context.Context, branch string, params ProjectBranchResetParams, opts ...option.RequestOption) (res *ProjectBranch, err error) {
165+
opts = slices.Concat(r.Options, opts)
166+
precfg, err := requestconfig.PreRequestOptions(opts...)
167+
if err != nil {
168+
return
169+
}
170+
requestconfig.UseDefaultParam(&params.Project, precfg.Project)
171+
if params.Project.Value == "" {
172+
err = errors.New("missing required project parameter")
173+
return
174+
}
175+
if branch == "" {
176+
err = errors.New("missing required branch parameter")
177+
return
178+
}
179+
path := fmt.Sprintf("v0/projects/%s/branches/%s/reset", url.PathEscape(params.Project.Value), url.PathEscape(branch))
180+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...)
181+
return
182+
}
183+
160184
// A project branch names a line of development for a project. Like a Git branch,
161185
// it points to a Git commit with a set of config files. In addition, a project
162186
// branch also points to a set of custom code changes, corresponding to Git
@@ -384,3 +408,21 @@ func (r ProjectBranchRebaseParams) URLQuery() (v url.Values, err error) {
384408
NestedFormat: apiquery.NestedQueryFormatBrackets,
385409
})
386410
}
411+
412+
type ProjectBranchResetParams struct {
413+
// Use [option.WithProject] on the client to set a global default for this field.
414+
Project param.Opt[string] `path:"project,omitzero,required" json:"-"`
415+
// The commit SHA to reset the main branch to. Required if resetting the main
416+
// branch; disallowed otherwise.
417+
TargetConfigSha param.Opt[string] `query:"target_config_sha,omitzero" json:"-"`
418+
paramObj
419+
}
420+
421+
// URLQuery serializes [ProjectBranchResetParams]'s query parameters as
422+
// `url.Values`.
423+
func (r ProjectBranchResetParams) URLQuery() (v url.Values, err error) {
424+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
425+
ArrayFormat: apiquery.ArrayQueryFormatComma,
426+
NestedFormat: apiquery.NestedQueryFormatBrackets,
427+
})
428+
}

0 commit comments

Comments
 (0)