Skip to content

Commit

Permalink
release: 0.1.0-beta.6 (#83)
Browse files Browse the repository at this point in the history
Automated Release PR
---


## 0.1.0-beta.6 (2025-02-07)

Full Changelog:
[v0.1.0-beta.5...v0.1.0-beta.6](v0.1.0-beta.5...v0.1.0-beta.6)

### Breaking Changes

* **api:** Dedupe enum values that have different casing. Prefer upper
cased enums.

### Features

* **api:** Add recurring commit and credit configs to the contract
create API.
* **client:** send `X-Stainless-Timeout` header
([#92](#92))
([2a829ce](2a829ce))


### Bug Fixes

* fix early cancel when RequestTimeout is provided for streaming
requests
([#97](#97))
([a6f23da](a6f23da))
* fix interface implementation stub names for unions
([#84](#84))
([c6124ab](c6124ab))
* fix unicode encoding for json
([#89](#89))
([655c9d5](655c9d5))


### Chores

* add UnionUnmarshaler for responses that are interfaces
([#93](#93))
([6f9193d](6f9193d))
* **internal:** codegen related update
([#85](#85))
([1c9cd5e](1c9cd5e))
* **internal:** codegen related update
([#87](#87))
([bda1654](bda1654))
* **internal:** codegen related update
([#88](#88))
([09a4fe2](09a4fe2))


### Documentation

* document raw responses
([#90](#90))
([7422f4f](7422f4f))

---
This pull request is managed by Stainless's [GitHub
App](https://github.com/apps/stainless-app).

The [semver version
number](https://semver.org/#semantic-versioning-specification-semver) is
based on included [commit
messages](https://www.conventionalcommits.org/en/v1.0.0/).
Alternatively, you can manually set the version number in the title of
this pull request.

For a better experience, it is recommended to use either rebase-merge or
squash-merge when merging this pull request.

🔗 Stainless [website](https://www.stainlessapi.com)
📚 Read the [docs](https://app.stainlessapi.com/docs)
🙋 [Reach out](mailto:support@stainlessapi.com) for help or questions

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
  • Loading branch information
stainless-app[bot] authored Feb 7, 2025
1 parent 2f7308f commit 90b11dc
Show file tree
Hide file tree
Showing 19 changed files with 1,110 additions and 194 deletions.
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.1.0-beta.5"
".": "0.1.0-beta.6"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 91
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-d45fa7bea4d4904432df31863500afbad8207834d9857d1d4b37549ed4621e10.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-b72a02c62483cb264bcf60bb973078212a6a74c8dd93d05ac622ab521528cc89.yml
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 0.1.0-beta.6 (2025-02-07)

Full Changelog: [v0.1.0-beta.5...v0.1.0-beta.6](https://github.com/Metronome-Industries/metronome-go/compare/v0.1.0-beta.5...v0.1.0-beta.6)

### Features

* **api:** api update ([#82](https://github.com/Metronome-Industries/metronome-go/issues/82)) ([e595dba](https://github.com/Metronome-Industries/metronome-go/commit/e595dba88231c9d1ad1c2b58c738c9a622244ae6))
* **api:** api update ([#86](https://github.com/Metronome-Industries/metronome-go/issues/86)) ([828fa6d](https://github.com/Metronome-Industries/metronome-go/commit/828fa6d228275a6f0005cf518ec21782ca7703d0))
* **api:** api update ([#91](https://github.com/Metronome-Industries/metronome-go/issues/91)) ([b39ccb5](https://github.com/Metronome-Industries/metronome-go/commit/b39ccb5b5fb34dbb7892a6b8a404cd4bca55774b))
* **api:** api update ([#94](https://github.com/Metronome-Industries/metronome-go/issues/94)) ([98bbde2](https://github.com/Metronome-Industries/metronome-go/commit/98bbde2443092f178f7645641f17ecee381a7384))
* **api:** api update ([#95](https://github.com/Metronome-Industries/metronome-go/issues/95)) ([caa1afc](https://github.com/Metronome-Industries/metronome-go/commit/caa1afc3fdb245a7963ba18cc895e1c1df5d2b23))
* **api:** api update ([#96](https://github.com/Metronome-Industries/metronome-go/issues/96)) ([49136e0](https://github.com/Metronome-Industries/metronome-go/commit/49136e0ca20df8e7cdeeb1c1b0ad102f3e00b327))
* **client:** send `X-Stainless-Timeout` header ([#92](https://github.com/Metronome-Industries/metronome-go/issues/92)) ([2a829ce](https://github.com/Metronome-Industries/metronome-go/commit/2a829ce54058c0321f334e6c384662cf7b0d63c2))


### Bug Fixes

* fix early cancel when RequestTimeout is provided for streaming requests ([#97](https://github.com/Metronome-Industries/metronome-go/issues/97)) ([a6f23da](https://github.com/Metronome-Industries/metronome-go/commit/a6f23da9199737dcddeb991555bb05beec6b8241))
* fix interface implementation stub names for unions ([#84](https://github.com/Metronome-Industries/metronome-go/issues/84)) ([c6124ab](https://github.com/Metronome-Industries/metronome-go/commit/c6124ab96197bc00d6014a381406bbb07a0eedb4))
* fix unicode encoding for json ([#89](https://github.com/Metronome-Industries/metronome-go/issues/89)) ([655c9d5](https://github.com/Metronome-Industries/metronome-go/commit/655c9d51ce948b06fadacb255ca54ee98e2a8192))


### Chores

* add UnionUnmarshaler for responses that are interfaces ([#93](https://github.com/Metronome-Industries/metronome-go/issues/93)) ([6f9193d](https://github.com/Metronome-Industries/metronome-go/commit/6f9193db34ad3858fbfe2e857adfce4648b1aa8e))
* **internal:** codegen related update ([#85](https://github.com/Metronome-Industries/metronome-go/issues/85)) ([1c9cd5e](https://github.com/Metronome-Industries/metronome-go/commit/1c9cd5eddb7d6cd8e9634fb2ea4fadf6f5a119de))
* **internal:** codegen related update ([#87](https://github.com/Metronome-Industries/metronome-go/issues/87)) ([bda1654](https://github.com/Metronome-Industries/metronome-go/commit/bda16540ec2dd5395563efebb1c2d555562267a6))
* **internal:** codegen related update ([#88](https://github.com/Metronome-Industries/metronome-go/issues/88)) ([09a4fe2](https://github.com/Metronome-Industries/metronome-go/commit/09a4fe21ea8fbfd2503c63125c9bf1012543328f))


### Documentation

* document raw responses ([#90](https://github.com/Metronome-Industries/metronome-go/issues/90)) ([7422f4f](https://github.com/Metronome-Industries/metronome-go/commit/7422f4fce6db256370dca28aa6b9c6bf46516c33))

## 0.1.0-beta.5 (2025-01-27)

Full Changelog: [v0.1.0-beta.4...v0.1.0-beta.5](https://github.com/Metronome-Industries/metronome-go/compare/v0.1.0-beta.4...v0.1.0-beta.5)
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/Metronome-Industries/metronome-go@v0.1.0-beta.5'
go get -u 'github.com/Metronome-Industries/metronome-go@v0.1.0-beta.6'
```

<!-- x-release-please-end -->
Expand All @@ -53,7 +53,7 @@ func main() {
client := metronome.NewClient(
option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("METRONOME_BEARER_TOKEN")
)
client.Usage.Ingest(context.TODO(), metronome.UsageIngestParams{
err := client.Usage.Ingest(context.TODO(), metronome.UsageIngestParams{
Usage: []metronome.UsageIngestParamsUsage{{
CustomerID: metronome.F("team@example.com"),
EventType: metronome.F("heartbeat"),
Expand Down Expand Up @@ -283,6 +283,31 @@ client.Contracts.New(
)
```

### Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when
you need to examine response headers, status codes, or other details.

```go
// Create a variable to store the HTTP response
var response *http.Response
contract, err := client.Contracts.New(
context.TODO(),
metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
},
option.WithResponseInto(&response),
)
if err != nil {
// handle error
}
fmt.Printf("%+v\n", contract)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
```

### Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented
Expand Down
5 changes: 2 additions & 3 deletions alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ type AlertNewParams struct {
// field is only defined for CreditPercentage and CreditBalance alerts
CreditGrantTypeFilters param.Field[[]string] `json:"credit_grant_type_filters"`
CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
// Only present for beta contract invoices. This field's availability is dependent
// on your client's configuration. A list of custom field filters for alert types
// that support advanced filtering
// A list of custom field filters for alert types that support advanced filtering.
// Only present for contract invoices.
CustomFieldFilters param.Field[[]AlertNewParamsCustomFieldFilter] `json:"custom_field_filters"`
// If provided, will create this alert for this specific customer. To create an
// alert for all customers, do not specify `customer_id` or `plan_id`.
Expand Down
82 changes: 82 additions & 0 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,88 @@ const ContractWithoutAmendmentsUsageStatementScheduleFrequencyQuarterly = shared
// This is an alias to an internal value.
const ContractWithoutAmendmentsUsageStatementScheduleFrequencyAnnual = shared.ContractWithoutAmendmentsUsageStatementScheduleFrequencyAnnual

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommit = shared.ContractWithoutAmendmentsRecurringCommit

// The amount of commit to grant.
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsAccessAmount = shared.ContractWithoutAmendmentsRecurringCommitsAccessAmount

// The amount of time the created commits will be valid for
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsCommitDuration = shared.ContractWithoutAmendmentsRecurringCommitsCommitDuration

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsCommitDurationUnit = shared.ContractWithoutAmendmentsRecurringCommitsCommitDurationUnit

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCommitsCommitDurationUnitPeriods = shared.ContractWithoutAmendmentsRecurringCommitsCommitDurationUnitPeriods

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsProduct = shared.ContractWithoutAmendmentsRecurringCommitsProduct

// Whether the created commits will use the commit rate or list rate
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsRateType = shared.ContractWithoutAmendmentsRecurringCommitsRateType

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCommitsRateTypeCommitRate = shared.ContractWithoutAmendmentsRecurringCommitsRateTypeCommitRate

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCommitsRateTypeListRate = shared.ContractWithoutAmendmentsRecurringCommitsRateTypeListRate

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsContract = shared.ContractWithoutAmendmentsRecurringCommitsContract

// The amount the customer should be billed for the commit. Not required.
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCommitsInvoiceAmount = shared.ContractWithoutAmendmentsRecurringCommitsInvoiceAmount

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCredit = shared.ContractWithoutAmendmentsRecurringCredit

// The amount of commit to grant.
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsAccessAmount = shared.ContractWithoutAmendmentsRecurringCreditsAccessAmount

// The amount of time the created commits will be valid for
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsCommitDuration = shared.ContractWithoutAmendmentsRecurringCreditsCommitDuration

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsCommitDurationUnit = shared.ContractWithoutAmendmentsRecurringCreditsCommitDurationUnit

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCreditsCommitDurationUnitPeriods = shared.ContractWithoutAmendmentsRecurringCreditsCommitDurationUnitPeriods

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsProduct = shared.ContractWithoutAmendmentsRecurringCreditsProduct

// Whether the created commits will use the commit rate or list rate
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsRateType = shared.ContractWithoutAmendmentsRecurringCreditsRateType

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCreditsRateTypeCommitRate = shared.ContractWithoutAmendmentsRecurringCreditsRateTypeCommitRate

// This is an alias to an internal value.
const ContractWithoutAmendmentsRecurringCreditsRateTypeListRate = shared.ContractWithoutAmendmentsRecurringCreditsRateTypeListRate

// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsContract = shared.ContractWithoutAmendmentsRecurringCreditsContract

// The amount the customer should be billed for the commit. Not required.
//
// This is an alias to an internal type.
type ContractWithoutAmendmentsRecurringCreditsInvoiceAmount = shared.ContractWithoutAmendmentsRecurringCreditsInvoiceAmount

// This is an alias to an internal type.
type ContractWithoutAmendmentsResellerRoyalty = shared.ContractWithoutAmendmentsResellerRoyalty

Expand Down
42 changes: 21 additions & 21 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
res, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
_, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

attempts := len(retryCountHeaders)
Expand Down Expand Up @@ -100,12 +100,12 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
res, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
_, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

expectedRetryCountHeaders := []string{"", "", ""}
Expand All @@ -132,12 +132,12 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
res, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
_, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

expectedRetryCountHeaders := []string{"42", "42", "42"}
Expand All @@ -163,12 +163,12 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
res, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
_, err := client.Contracts.New(context.Background(), metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}
if want := 3; attempts != want {
t.Errorf("Expected %d attempts, got %d", want, attempts)
Expand All @@ -188,12 +188,12 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
res, err := client.Contracts.New(cancelCtx, metronome.ContractNewParams{
_, err := client.Contracts.New(cancelCtx, metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}
}

Expand All @@ -210,12 +210,12 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
res, err := client.Contracts.New(cancelCtx, metronome.ContractNewParams{
_, err := client.Contracts.New(cancelCtx, metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("expected there to be a cancel error")
}
}

Expand All @@ -238,12 +238,12 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
res, err := client.Contracts.New(deadlineCtx, metronome.ContractNewParams{
_, err := client.Contracts.New(deadlineCtx, metronome.ContractNewParams{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
StartingAt: metronome.F(time.Now()),
})
if err == nil || res != nil {
t.Error("expected there to be a deadline error and for the response to be nil")
if err == nil {
t.Error("expected there to be a deadline error")
}
close(testDone)
}()
Expand Down
Loading

0 comments on commit 90b11dc

Please sign in to comment.