Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.24.0"
".": "0.25.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-5c1008fd27f64bcde1a146a4158f1c3113b4e13437a4d880bd6811fb063cfcd6.yml
openapi_spec_hash: 9583f62164b5dc15b10051dad6a7fca4
config_hash: 0a8370ad6abcfe39671b61684a502e45
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Stainless Go API Library

<!-- x-release-please-start-version -->

<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go"><img src="https://pkg.go.dev/badge/github.com/stainless-api/stainless-api-go.svg" alt="Go Reference"></a>

<!-- x-release-please-end -->

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.

Expand All @@ -24,14 +28,14 @@ Or to pin the version:
<!-- x-release-please-start-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'
```

<!-- x-release-please-end -->

## Requirements

This library requires Go 1.18+.
This library requires Go 1.22+.

## Usage

Expand All @@ -53,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)
}

```
Expand Down Expand Up @@ -288,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())
Expand All @@ -305,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 {
Expand All @@ -329,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 {
Expand Down Expand Up @@ -361,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
Expand Down Expand Up @@ -402,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),
Expand All @@ -419,20 +423,20 @@ 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),
)
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)
Expand Down
36 changes: 36 additions & 0 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 9 additions & 11 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Shared Params Types

- <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared#FileInputUnionParam">FileInputUnionParam</a>
- <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared#Target">Target</a>

# Shared Response Types

- <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared#Commit">Commit</a>
- <a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go/shared#Target">Target</a>

# Projects

Expand Down Expand Up @@ -51,32 +53,28 @@ Methods:

Response Types:

- <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#BuildObject">BuildObject</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#Build">Build</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#BuildTarget">BuildTarget</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#CheckStepUnion">CheckStepUnion</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#BuildCompareResponse">BuildCompareResponse</a>

Methods:

- <code title="post /v0/builds">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</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#BuildNewParams">BuildNewParams</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#BuildObject">BuildObject</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v0/builds/{buildId}">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, buildID <a href="https://pkg.go.dev/builtin#string">string</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#BuildObject">BuildObject</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v0/builds">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <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#BuildListParams">BuildListParams</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#BuildObject">BuildObject</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /v0/builds">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</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#BuildNewParams">BuildNewParams</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#Build">Build</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v0/builds/{buildId}">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, buildID <a href="https://pkg.go.dev/builtin#string">string</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#Build">Build</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v0/builds">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <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#BuildListParams">BuildListParams</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#Build">Build</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /v0/builds/compare">client.Builds.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildService.Compare">Compare</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</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#BuildCompareParams">BuildCompareParams</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#BuildCompareResponse">BuildCompareResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Diagnostics

Params Types:

- <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#Target">Target</a>

Response Types:

- <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#Target">Target</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#BuildDiagnosticListResponse">BuildDiagnosticListResponse</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#BuildDiagnostic">BuildDiagnostic</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#BuildDiagnosticMoreUnion">BuildDiagnosticMoreUnion</a>

Methods:

- <code title="get /v0/builds/{buildId}/diagnostics">client.Builds.Diagnostics.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildDiagnosticService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, buildID <a href="https://pkg.go.dev/builtin#string">string</a>, query <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#BuildDiagnosticListParams">BuildDiagnosticListParams</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#BuildDiagnosticListResponse">BuildDiagnosticListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v0/builds/{buildId}/diagnostics">client.Builds.Diagnostics.<a href="https://pkg.go.dev/github.com/stainless-api/stainless-api-go#BuildDiagnosticService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, buildID <a href="https://pkg.go.dev/builtin#string">string</a>, query <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#BuildDiagnosticListParams">BuildDiagnosticListParams</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#BuildDiagnostic">BuildDiagnostic</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## TargetOutputs

Expand Down
Loading