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 @@
{
".": "1.29.0"
".": "1.30.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 118
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-2b5eeb4a60cbec92f80b4a54f33c2d17b36cbac4739886f737108f2ad74ff12d.yml
openapi_spec_hash: ebbe8419f5831506de5b4c0b4eb56acf
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-828c91953d2351040fdd4d90a3d9eafd09f9d240c4f6ce0441b7a10c06c1c722.yml
openapi_spec_hash: c82bc88563f80f600e59e22014d4cec4
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.30.0 (2025-10-17)

Full Changelog: [v1.29.0...v1.30.0](https://github.com/orbcorp/orb-go/compare/v1.29.0...v1.30.0)

### Features

* **api:** api update ([30787d5](https://github.com/orbcorp/orb-go/commit/30787d5d8799945833d481d0311017dddda7ae59))

## 1.29.0 (2025-10-15)

Full Changelog: [v1.28.0...v1.29.0](https://github.com/orbcorp/orb-go/compare/v1.28.0...v1.29.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/orbcorp/orb-go@v1.29.0'
go get -u 'github.com/orbcorp/orb-go@v1.30.0'
```

<!-- x-release-please-end -->
Expand Down
4,461 changes: 3,170 additions & 1,291 deletions aliases.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TierParam">TierParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TieredConfigParam">TieredConfigParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TieredConversionRateConfigParam">TieredConversionRateConfigParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TransformPriceFilterParam">TransformPriceFilterParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TrialDiscountParam">TrialDiscountParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#UnitConfigParam">UnitConfigParam</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#UnitConversionRateConfigParam">UnitConversionRateConfigParam</a>
Expand Down Expand Up @@ -151,7 +150,6 @@
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TierSubLineItem">TierSubLineItem</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TieredConfig">TieredConfig</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TieredConversionRateConfig">TieredConversionRateConfig</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TransformPriceFilter">TransformPriceFilter</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#TrialDiscount">TrialDiscount</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#UnitConfig">UnitConfig</a>
- <a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/orbcorp/orb-go/shared#UnitConversionRateConfig">UnitConversionRateConfig</a>
Expand Down
15 changes: 14 additions & 1 deletion beta.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ type PlanVersionAdjustment struct {
AdjustmentType PlanVersionAdjustmentsAdjustmentType `json:"adjustment_type,required"`
// This field can have the runtime type of [[]string].
AppliesToPriceIDs interface{} `json:"applies_to_price_ids,required"`
// This field can have the runtime type of [[]shared.TransformPriceFilter].
// This field can have the runtime type of
// [[]shared.PlanPhaseUsageDiscountAdjustmentFilter],
// [[]shared.PlanPhaseAmountDiscountAdjustmentFilter],
// [[]shared.PlanPhasePercentageDiscountAdjustmentFilter],
// [[]shared.PlanPhaseMinimumAdjustmentFilter],
// [[]shared.PlanPhaseMaximumAdjustmentFilter].
Filters interface{} `json:"filters,required"`
// True for adjustments that apply to an entire invoice, false for adjustments that
// apply to only one price.
Expand Down Expand Up @@ -1240,6 +1245,10 @@ func (r BetaNewPlanVersionParamsAddPricesPriceNewPlanEventOutputPriceCadence) Is
type BetaNewPlanVersionParamsAddPricesPriceNewPlanEventOutputPriceEventOutputConfig struct {
// The key in the event data to extract the unit rate from.
UnitRatingKey param.Field[string] `json:"unit_rating_key,required"`
// If provided, this amount will be used as the unit rate when an event does not
// have a value for the `unit_rating_key`. If not provided, events missing a unit
// rate will be ignored.
DefaultUnitRate param.Field[string] `json:"default_unit_rate"`
// An optional key in the event data to group by (e.g., event ID). All events will
// also be grouped by their unit rate.
GroupingKey param.Field[string] `json:"grouping_key"`
Expand Down Expand Up @@ -2291,6 +2300,10 @@ func (r BetaNewPlanVersionParamsReplacePricesPriceNewPlanEventOutputPriceCadence
type BetaNewPlanVersionParamsReplacePricesPriceNewPlanEventOutputPriceEventOutputConfig struct {
// The key in the event data to extract the unit rate from.
UnitRatingKey param.Field[string] `json:"unit_rating_key,required"`
// If provided, this amount will be used as the unit rate when an event does not
// have a value for the `unit_rating_key`. If not provided, events missing a unit
// rate will be ignored.
DefaultUnitRate param.Field[string] `json:"default_unit_rate"`
// An optional key in the event data to group by (e.g., event ID). All events will
// also be grouped by their unit rate.
GroupingKey param.Field[string] `json:"grouping_key"`
Expand Down
12 changes: 6 additions & 6 deletions beta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func TestBetaNewPlanVersionWithOptionalParams(t *testing.T) {
AppliesToItemIDs: orb.F([]string{"item_1", "item_2"}),
AppliesToPriceIDs: orb.F([]string{"price_1", "price_2"}),
Currency: orb.F("currency"),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.NewPercentageDiscountFilterParam{{
Field: orb.F(shared.NewPercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.NewPercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
IsInvoiceLevel: orb.F(true),
Expand Down Expand Up @@ -117,9 +117,9 @@ func TestBetaNewPlanVersionWithOptionalParams(t *testing.T) {
AppliesToItemIDs: orb.F([]string{"item_1", "item_2"}),
AppliesToPriceIDs: orb.F([]string{"price_1", "price_2"}),
Currency: orb.F("currency"),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.NewPercentageDiscountFilterParam{{
Field: orb.F(shared.NewPercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.NewPercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
IsInvoiceLevel: orb.F(true),
Expand Down
8 changes: 8 additions & 0 deletions betaexternalplanid.go
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,10 @@ func (r BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanEventOutputPr
type BetaExternalPlanIDNewPlanVersionParamsAddPricesPriceNewPlanEventOutputPriceEventOutputConfig struct {
// The key in the event data to extract the unit rate from.
UnitRatingKey param.Field[string] `json:"unit_rating_key,required"`
// If provided, this amount will be used as the unit rate when an event does not
// have a value for the `unit_rating_key`. If not provided, events missing a unit
// rate will be ignored.
DefaultUnitRate param.Field[string] `json:"default_unit_rate"`
// An optional key in the event data to group by (e.g., event ID). All events will
// also be grouped by their unit rate.
GroupingKey param.Field[string] `json:"grouping_key"`
Expand Down Expand Up @@ -2058,6 +2062,10 @@ func (r BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanEventOutp
type BetaExternalPlanIDNewPlanVersionParamsReplacePricesPriceNewPlanEventOutputPriceEventOutputConfig struct {
// The key in the event data to extract the unit rate from.
UnitRatingKey param.Field[string] `json:"unit_rating_key,required"`
// If provided, this amount will be used as the unit rate when an event does not
// have a value for the `unit_rating_key`. If not provided, events missing a unit
// rate will be ignored.
DefaultUnitRate param.Field[string] `json:"default_unit_rate"`
// An optional key in the event data to group by (e.g., event ID). All events will
// also be grouped by their unit rate.
GroupingKey param.Field[string] `json:"grouping_key"`
Expand Down
12 changes: 6 additions & 6 deletions betaexternalplanid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func TestBetaExternalPlanIDNewPlanVersionWithOptionalParams(t *testing.T) {
AppliesToItemIDs: orb.F([]string{"item_1", "item_2"}),
AppliesToPriceIDs: orb.F([]string{"price_1", "price_2"}),
Currency: orb.F("currency"),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.NewPercentageDiscountFilterParam{{
Field: orb.F(shared.NewPercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.NewPercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
IsInvoiceLevel: orb.F(true),
Expand Down Expand Up @@ -117,9 +117,9 @@ func TestBetaExternalPlanIDNewPlanVersionWithOptionalParams(t *testing.T) {
AppliesToItemIDs: orb.F([]string{"item_1", "item_2"}),
AppliesToPriceIDs: orb.F([]string{"price_1", "price_2"}),
Currency: orb.F("currency"),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.NewPercentageDiscountFilterParam{{
Field: orb.F(shared.NewPercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.NewPercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
IsInvoiceLevel: orb.F(true),
Expand Down
3 changes: 2 additions & 1 deletion coupon.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ type CouponDiscount struct {
AmountDiscount string `json:"amount_discount"`
// This field can have the runtime type of [[]string].
AppliesToPriceIDs interface{} `json:"applies_to_price_ids"`
// This field can have the runtime type of [[]shared.TransformPriceFilter].
// This field can have the runtime type of [[]shared.PercentageDiscountFilter],
// [[]shared.AmountDiscountFilter].
Filters interface{} `json:"filters"`
// Only available if discount_type is `percentage`. This is a number between 0
// and 1.
Expand Down
73 changes: 69 additions & 4 deletions customercreditledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,17 @@ func (r *CustomerCreditLedgerService) ListByExternalIDAutoPaging(ctx context.Con
}

type AffectedBlock struct {
ID string `json:"id,required"`
ExpiryDate time.Time `json:"expiry_date,required,nullable" format:"date-time"`
PerUnitCostBasis string `json:"per_unit_cost_basis,required,nullable"`
JSON affectedBlockJSON `json:"-"`
ID string `json:"id,required"`
BlockFilters []AffectedBlockBlockFilter `json:"block_filters,required,nullable"`
ExpiryDate time.Time `json:"expiry_date,required,nullable" format:"date-time"`
PerUnitCostBasis string `json:"per_unit_cost_basis,required,nullable"`
JSON affectedBlockJSON `json:"-"`
}

// affectedBlockJSON contains the JSON metadata for the struct [AffectedBlock]
type affectedBlockJSON struct {
ID apijson.Field
BlockFilters apijson.Field
ExpiryDate apijson.Field
PerUnitCostBasis apijson.Field
raw string
Expand All @@ -693,6 +695,69 @@ func (r affectedBlockJSON) RawJSON() string {
return r.raw
}

type AffectedBlockBlockFilter struct {
// The property of the price to filter on.
Field AffectedBlockBlockFiltersField `json:"field,required"`
// Should prices that match the filter be included or excluded.
Operator AffectedBlockBlockFiltersOperator `json:"operator,required"`
// The IDs or values that match this filter.
Values []string `json:"values,required"`
JSON affectedBlockBlockFilterJSON `json:"-"`
}

// affectedBlockBlockFilterJSON contains the JSON metadata for the struct
// [AffectedBlockBlockFilter]
type affectedBlockBlockFilterJSON struct {
Field apijson.Field
Operator apijson.Field
Values apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AffectedBlockBlockFilter) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r affectedBlockBlockFilterJSON) RawJSON() string {
return r.raw
}

// The property of the price to filter on.
type AffectedBlockBlockFiltersField string

const (
AffectedBlockBlockFiltersFieldPriceID AffectedBlockBlockFiltersField = "price_id"
AffectedBlockBlockFiltersFieldItemID AffectedBlockBlockFiltersField = "item_id"
AffectedBlockBlockFiltersFieldPriceType AffectedBlockBlockFiltersField = "price_type"
AffectedBlockBlockFiltersFieldCurrency AffectedBlockBlockFiltersField = "currency"
AffectedBlockBlockFiltersFieldPricingUnitID AffectedBlockBlockFiltersField = "pricing_unit_id"
)

func (r AffectedBlockBlockFiltersField) IsKnown() bool {
switch r {
case AffectedBlockBlockFiltersFieldPriceID, AffectedBlockBlockFiltersFieldItemID, AffectedBlockBlockFiltersFieldPriceType, AffectedBlockBlockFiltersFieldCurrency, AffectedBlockBlockFiltersFieldPricingUnitID:
return true
}
return false
}

// Should prices that match the filter be included or excluded.
type AffectedBlockBlockFiltersOperator string

const (
AffectedBlockBlockFiltersOperatorIncludes AffectedBlockBlockFiltersOperator = "includes"
AffectedBlockBlockFiltersOperatorExcludes AffectedBlockBlockFiltersOperator = "excludes"
)

func (r AffectedBlockBlockFiltersOperator) IsKnown() bool {
switch r {
case AffectedBlockBlockFiltersOperatorIncludes, AffectedBlockBlockFiltersOperatorExcludes:
return true
}
return false
}

type AmendmentLedgerEntry struct {
ID string `json:"id,required"`
Amount float64 `json:"amount,required"`
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "1.29.0" // x-release-please-version
const PackageVersion = "1.30.0" // x-release-please-version
7 changes: 6 additions & 1 deletion invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,12 @@ type InvoiceFetchUpcomingResponseLineItemsAdjustment struct {
Amount string `json:"amount,required"`
// This field can have the runtime type of [[]string].
AppliesToPriceIDs interface{} `json:"applies_to_price_ids,required"`
// This field can have the runtime type of [[]shared.TransformPriceFilter].
// This field can have the runtime type of
// [[]shared.MonetaryUsageDiscountAdjustmentFilter],
// [[]shared.MonetaryAmountDiscountAdjustmentFilter],
// [[]shared.MonetaryPercentageDiscountAdjustmentFilter],
// [[]shared.MonetaryMinimumAdjustmentFilter],
// [[]shared.MonetaryMaximumAdjustmentFilter].
Filters interface{} `json:"filters,required"`
// True for adjustments that apply to an entire invoice, false for adjustments that
// apply to only one price.
Expand Down
6 changes: 3 additions & 3 deletions invoice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func TestInvoiceNewWithOptionalParams(t *testing.T) {
DiscountType: orb.F(shared.PercentageDiscountDiscountTypePercentage),
PercentageDiscount: orb.F(0.150000),
AppliesToPriceIDs: orb.F([]string{"h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"}),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.PercentageDiscountFilterParam{{
Field: orb.F(shared.PercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.PercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
Reason: orb.F("reason"),
Expand Down
7 changes: 6 additions & 1 deletion invoicelineitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ type InvoiceLineItemNewResponseAdjustment struct {
Amount string `json:"amount,required"`
// This field can have the runtime type of [[]string].
AppliesToPriceIDs interface{} `json:"applies_to_price_ids,required"`
// This field can have the runtime type of [[]shared.TransformPriceFilter].
// This field can have the runtime type of
// [[]shared.MonetaryUsageDiscountAdjustmentFilter],
// [[]shared.MonetaryAmountDiscountAdjustmentFilter],
// [[]shared.MonetaryPercentageDiscountAdjustmentFilter],
// [[]shared.MonetaryMinimumAdjustmentFilter],
// [[]shared.MonetaryMaximumAdjustmentFilter].
Filters interface{} `json:"filters,required"`
// True for adjustments that apply to an entire invoice, false for adjustments that
// apply to only one price.
Expand Down
11 changes: 10 additions & 1 deletion plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ type PlanAdjustment struct {
AdjustmentType PlanAdjustmentsAdjustmentType `json:"adjustment_type,required"`
// This field can have the runtime type of [[]string].
AppliesToPriceIDs interface{} `json:"applies_to_price_ids,required"`
// This field can have the runtime type of [[]shared.TransformPriceFilter].
// This field can have the runtime type of
// [[]shared.PlanPhaseUsageDiscountAdjustmentFilter],
// [[]shared.PlanPhaseAmountDiscountAdjustmentFilter],
// [[]shared.PlanPhasePercentageDiscountAdjustmentFilter],
// [[]shared.PlanPhaseMinimumAdjustmentFilter],
// [[]shared.PlanPhaseMaximumAdjustmentFilter].
Filters interface{} `json:"filters,required"`
// True for adjustments that apply to an entire invoice, false for adjustments that
// apply to only one price.
Expand Down Expand Up @@ -1360,6 +1365,10 @@ func (r PlanNewParamsPricesPriceNewPlanEventOutputPriceCadence) IsKnown() bool {
type PlanNewParamsPricesPriceNewPlanEventOutputPriceEventOutputConfig struct {
// The key in the event data to extract the unit rate from.
UnitRatingKey param.Field[string] `json:"unit_rating_key,required"`
// If provided, this amount will be used as the unit rate when an event does not
// have a value for the `unit_rating_key`. If not provided, events missing a unit
// rate will be ignored.
DefaultUnitRate param.Field[string] `json:"default_unit_rate"`
// An optional key in the event data to group by (e.g., event ID). All events will
// also be grouped by their unit rate.
GroupingKey param.Field[string] `json:"grouping_key"`
Expand Down
6 changes: 3 additions & 3 deletions plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func TestPlanNewWithOptionalParams(t *testing.T) {
AppliesToItemIDs: orb.F([]string{"item_1", "item_2"}),
AppliesToPriceIDs: orb.F([]string{"price_1", "price_2"}),
Currency: orb.F("currency"),
Filters: orb.F([]shared.TransformPriceFilterParam{{
Field: orb.F(shared.TransformPriceFilterFieldPriceID),
Operator: orb.F(shared.TransformPriceFilterOperatorIncludes),
Filters: orb.F([]shared.NewPercentageDiscountFilterParam{{
Field: orb.F(shared.NewPercentageDiscountFiltersFieldPriceID),
Operator: orb.F(shared.NewPercentageDiscountFiltersOperatorIncludes),
Values: orb.F([]string{"string"}),
}}),
IsInvoiceLevel: orb.F(true),
Expand Down
Loading