Skip to content

feat(api): api update #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2025
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-43a4d1d907fd25faa99fef58ba7afb3dd39fae36f955b29bfe27b4bfdaa0ee54.yml
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_close_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillCloseResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillCreateResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_fetch_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillFetchResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillListResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_revert_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillRevertResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
112 changes: 58 additions & 54 deletions src/orb/types/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"CustomerTaxID",
"LineItem",
"LineItemAdjustment",
"LineItemAdjustmentAmountDiscountAdjustment",
"LineItemAdjustmentPercentageDiscountAdjustment",
"LineItemAdjustmentUsageDiscountAdjustment",
"LineItemAdjustmentMinimumAdjustment",
"LineItemAdjustmentMaximumAdjustment",
"LineItemAdjustmentMonetaryUsageDiscountAdjustment",
"LineItemAdjustmentMonetaryAmountDiscountAdjustment",
"LineItemAdjustmentMonetaryPercentageDiscountAdjustment",
"LineItemAdjustmentMonetaryMinimumAdjustment",
"LineItemAdjustmentMonetaryMaximumAdjustment",
"LineItemMaximum",
"LineItemMinimum",
"LineItemSubLineItem",
Expand Down Expand Up @@ -325,16 +325,13 @@ class CustomerTaxID(BaseModel):
value: str


class LineItemAdjustmentAmountDiscountAdjustment(BaseModel):
class LineItemAdjustmentMonetaryUsageDiscountAdjustment(BaseModel):
id: str

adjustment_type: Literal["amount_discount"]
adjustment_type: Literal["usage_discount"]

amount_discount: str
"""
The amount by which to discount the prices this adjustment applies to in a given
billing period.
"""
amount: str
"""The value applied by an adjustment."""

applies_to_price_ids: List[str]
"""The price IDs that this adjustment applies to."""
Expand All @@ -345,17 +342,29 @@ class LineItemAdjustmentAmountDiscountAdjustment(BaseModel):
that apply to only one price.
"""

plan_phase_order: Optional[int] = None
"""The plan phase in which this adjustment is active."""

reason: Optional[str] = None
"""The reason for the adjustment."""

usage_discount: float
"""
The number of usage units by which to discount the price this adjustment applies
to in a given billing period.
"""


class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel):
class LineItemAdjustmentMonetaryAmountDiscountAdjustment(BaseModel):
id: str

adjustment_type: Literal["percentage_discount"]
adjustment_type: Literal["amount_discount"]

amount: str
"""The value applied by an adjustment."""

amount_discount: str
"""
The amount by which to discount the prices this adjustment applies to in a given
billing period.
"""

applies_to_price_ids: List[str]
"""The price IDs that this adjustment applies to."""
Expand All @@ -366,23 +375,17 @@ class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel):
that apply to only one price.
"""

percentage_discount: float
"""
The percentage (as a value between 0 and 1) by which to discount the price
intervals this adjustment applies to in a given billing period.
"""

plan_phase_order: Optional[int] = None
"""The plan phase in which this adjustment is active."""

reason: Optional[str] = None
"""The reason for the adjustment."""


class LineItemAdjustmentUsageDiscountAdjustment(BaseModel):
class LineItemAdjustmentMonetaryPercentageDiscountAdjustment(BaseModel):
id: str

adjustment_type: Literal["usage_discount"]
adjustment_type: Literal["percentage_discount"]

amount: str
"""The value applied by an adjustment."""

applies_to_price_ids: List[str]
"""The price IDs that this adjustment applies to."""
Expand All @@ -393,24 +396,24 @@ class LineItemAdjustmentUsageDiscountAdjustment(BaseModel):
that apply to only one price.
"""

plan_phase_order: Optional[int] = None
"""The plan phase in which this adjustment is active."""
percentage_discount: float
"""
The percentage (as a value between 0 and 1) by which to discount the price
intervals this adjustment applies to in a given billing period.
"""

reason: Optional[str] = None
"""The reason for the adjustment."""

usage_discount: float
"""
The number of usage units by which to discount the price this adjustment applies
to in a given billing period.
"""


class LineItemAdjustmentMinimumAdjustment(BaseModel):
class LineItemAdjustmentMonetaryMinimumAdjustment(BaseModel):
id: str

adjustment_type: Literal["minimum"]

amount: str
"""The value applied by an adjustment."""

applies_to_price_ids: List[str]
"""The price IDs that this adjustment applies to."""

Expand All @@ -429,18 +432,18 @@ class LineItemAdjustmentMinimumAdjustment(BaseModel):
adjustment applies to.
"""

plan_phase_order: Optional[int] = None
"""The plan phase in which this adjustment is active."""

reason: Optional[str] = None
"""The reason for the adjustment."""


class LineItemAdjustmentMaximumAdjustment(BaseModel):
class LineItemAdjustmentMonetaryMaximumAdjustment(BaseModel):
id: str

adjustment_type: Literal["maximum"]

amount: str
"""The value applied by an adjustment."""

applies_to_price_ids: List[str]
"""The price IDs that this adjustment applies to."""

Expand All @@ -456,20 +459,17 @@ class LineItemAdjustmentMaximumAdjustment(BaseModel):
adjustment applies to.
"""

plan_phase_order: Optional[int] = None
"""The plan phase in which this adjustment is active."""

reason: Optional[str] = None
"""The reason for the adjustment."""


LineItemAdjustment: TypeAlias = Annotated[
Union[
LineItemAdjustmentAmountDiscountAdjustment,
LineItemAdjustmentPercentageDiscountAdjustment,
LineItemAdjustmentUsageDiscountAdjustment,
LineItemAdjustmentMinimumAdjustment,
LineItemAdjustmentMaximumAdjustment,
LineItemAdjustmentMonetaryUsageDiscountAdjustment,
LineItemAdjustmentMonetaryAmountDiscountAdjustment,
LineItemAdjustmentMonetaryPercentageDiscountAdjustment,
LineItemAdjustmentMonetaryMinimumAdjustment,
LineItemAdjustmentMonetaryMaximumAdjustment,
],
PropertyInfo(discriminator="adjustment_type"),
]
Expand Down Expand Up @@ -599,18 +599,21 @@ class LineItem(BaseModel):

adjusted_subtotal: str
"""
The line amount after any adjustments, before overage conversion, credits and
The line amount after any adjustments and before overage conversion, credits and
partial invoicing.
"""

adjustments: List[LineItemAdjustment]
"""All adjustments applied to the line item."""
"""All adjustments (ie. maximums, minimums, discounts) applied to the line item."""

amount: str
"""The final amount after any discounts or minimums."""
"""
The final amount for a line item after all adjustments and pre paid credits have
been applied.
"""

credits_applied: str
"""The number of credits used"""
"""The number of prepaid credits applied."""

discount: Optional[Discount] = None

Expand Down Expand Up @@ -657,6 +660,7 @@ class LineItem(BaseModel):
"""

quantity: float
"""Either the fixed fee quantity or the usage during the service period."""

start_date: datetime
"""The start date of the range of time applied for this line item's price."""
Expand All @@ -668,7 +672,7 @@ class LineItem(BaseModel):
"""

subtotal: str
"""The line amount before any line item-specific discounts or minimums."""
"""The line amount before before any adjustments."""

tax_amounts: List[LineItemTaxAmount]
"""An array of tax rates and their incurred tax amounts.
Expand Down
Loading