Skip to content

Commit 7ac3e7d

Browse files
feat(api): api update (#526)
1 parent 6110e12 commit 7ac3e7d

23 files changed

+644
-599
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-43a4d1d907fd25faa99fef58ba7afb3dd39fae36f955b29bfe27b4bfdaa0ee54.yml

src/orb/types/events/backfill_close_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class BackfillCloseResponse(BaseModel):
2929
events_ingested: int
3030
"""The number of events ingested in this backfill."""
3131

32+
replace_existing_events: bool
33+
"""
34+
If `true`, existing events in the backfill's timeframe will be replaced with the
35+
newly ingested events associated with the backfill. If `false`, newly ingested
36+
events will be added to the existing events.
37+
"""
38+
3239
reverted_at: Optional[datetime] = None
3340
"""The time at which this backfill was reverted."""
3441

src/orb/types/events/backfill_create_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class BackfillCreateResponse(BaseModel):
2929
events_ingested: int
3030
"""The number of events ingested in this backfill."""
3131

32+
replace_existing_events: bool
33+
"""
34+
If `true`, existing events in the backfill's timeframe will be replaced with the
35+
newly ingested events associated with the backfill. If `false`, newly ingested
36+
events will be added to the existing events.
37+
"""
38+
3239
reverted_at: Optional[datetime] = None
3340
"""The time at which this backfill was reverted."""
3441

src/orb/types/events/backfill_fetch_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class BackfillFetchResponse(BaseModel):
2929
events_ingested: int
3030
"""The number of events ingested in this backfill."""
3131

32+
replace_existing_events: bool
33+
"""
34+
If `true`, existing events in the backfill's timeframe will be replaced with the
35+
newly ingested events associated with the backfill. If `false`, newly ingested
36+
events will be added to the existing events.
37+
"""
38+
3239
reverted_at: Optional[datetime] = None
3340
"""The time at which this backfill was reverted."""
3441

src/orb/types/events/backfill_list_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class BackfillListResponse(BaseModel):
2929
events_ingested: int
3030
"""The number of events ingested in this backfill."""
3131

32+
replace_existing_events: bool
33+
"""
34+
If `true`, existing events in the backfill's timeframe will be replaced with the
35+
newly ingested events associated with the backfill. If `false`, newly ingested
36+
events will be added to the existing events.
37+
"""
38+
3239
reverted_at: Optional[datetime] = None
3340
"""The time at which this backfill was reverted."""
3441

src/orb/types/events/backfill_revert_response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class BackfillRevertResponse(BaseModel):
2929
events_ingested: int
3030
"""The number of events ingested in this backfill."""
3131

32+
replace_existing_events: bool
33+
"""
34+
If `true`, existing events in the backfill's timeframe will be replaced with the
35+
newly ingested events associated with the backfill. If `false`, newly ingested
36+
events will be added to the existing events.
37+
"""
38+
3239
reverted_at: Optional[datetime] = None
3340
"""The time at which this backfill was reverted."""
3441

src/orb/types/invoice.py

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"CustomerTaxID",
2323
"LineItem",
2424
"LineItemAdjustment",
25-
"LineItemAdjustmentAmountDiscountAdjustment",
26-
"LineItemAdjustmentPercentageDiscountAdjustment",
27-
"LineItemAdjustmentUsageDiscountAdjustment",
28-
"LineItemAdjustmentMinimumAdjustment",
29-
"LineItemAdjustmentMaximumAdjustment",
25+
"LineItemAdjustmentMonetaryUsageDiscountAdjustment",
26+
"LineItemAdjustmentMonetaryAmountDiscountAdjustment",
27+
"LineItemAdjustmentMonetaryPercentageDiscountAdjustment",
28+
"LineItemAdjustmentMonetaryMinimumAdjustment",
29+
"LineItemAdjustmentMonetaryMaximumAdjustment",
3030
"LineItemMaximum",
3131
"LineItemMinimum",
3232
"LineItemSubLineItem",
@@ -325,16 +325,13 @@ class CustomerTaxID(BaseModel):
325325
value: str
326326

327327

328-
class LineItemAdjustmentAmountDiscountAdjustment(BaseModel):
328+
class LineItemAdjustmentMonetaryUsageDiscountAdjustment(BaseModel):
329329
id: str
330330

331-
adjustment_type: Literal["amount_discount"]
331+
adjustment_type: Literal["usage_discount"]
332332

333-
amount_discount: str
334-
"""
335-
The amount by which to discount the prices this adjustment applies to in a given
336-
billing period.
337-
"""
333+
amount: str
334+
"""The value applied by an adjustment."""
338335

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

348-
plan_phase_order: Optional[int] = None
349-
"""The plan phase in which this adjustment is active."""
350-
351345
reason: Optional[str] = None
352346
"""The reason for the adjustment."""
353347

348+
usage_discount: float
349+
"""
350+
The number of usage units by which to discount the price this adjustment applies
351+
to in a given billing period.
352+
"""
353+
354354

355-
class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel):
355+
class LineItemAdjustmentMonetaryAmountDiscountAdjustment(BaseModel):
356356
id: str
357357

358-
adjustment_type: Literal["percentage_discount"]
358+
adjustment_type: Literal["amount_discount"]
359+
360+
amount: str
361+
"""The value applied by an adjustment."""
362+
363+
amount_discount: str
364+
"""
365+
The amount by which to discount the prices this adjustment applies to in a given
366+
billing period.
367+
"""
359368

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

369-
percentage_discount: float
370-
"""
371-
The percentage (as a value between 0 and 1) by which to discount the price
372-
intervals this adjustment applies to in a given billing period.
373-
"""
374-
375-
plan_phase_order: Optional[int] = None
376-
"""The plan phase in which this adjustment is active."""
377-
378378
reason: Optional[str] = None
379379
"""The reason for the adjustment."""
380380

381381

382-
class LineItemAdjustmentUsageDiscountAdjustment(BaseModel):
382+
class LineItemAdjustmentMonetaryPercentageDiscountAdjustment(BaseModel):
383383
id: str
384384

385-
adjustment_type: Literal["usage_discount"]
385+
adjustment_type: Literal["percentage_discount"]
386+
387+
amount: str
388+
"""The value applied by an adjustment."""
386389

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

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

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

402-
usage_discount: float
403-
"""
404-
The number of usage units by which to discount the price this adjustment applies
405-
to in a given billing period.
406-
"""
407408

408-
409-
class LineItemAdjustmentMinimumAdjustment(BaseModel):
409+
class LineItemAdjustmentMonetaryMinimumAdjustment(BaseModel):
410410
id: str
411411

412412
adjustment_type: Literal["minimum"]
413413

414+
amount: str
415+
"""The value applied by an adjustment."""
416+
414417
applies_to_price_ids: List[str]
415418
"""The price IDs that this adjustment applies to."""
416419

@@ -429,18 +432,18 @@ class LineItemAdjustmentMinimumAdjustment(BaseModel):
429432
adjustment applies to.
430433
"""
431434

432-
plan_phase_order: Optional[int] = None
433-
"""The plan phase in which this adjustment is active."""
434-
435435
reason: Optional[str] = None
436436
"""The reason for the adjustment."""
437437

438438

439-
class LineItemAdjustmentMaximumAdjustment(BaseModel):
439+
class LineItemAdjustmentMonetaryMaximumAdjustment(BaseModel):
440440
id: str
441441

442442
adjustment_type: Literal["maximum"]
443443

444+
amount: str
445+
"""The value applied by an adjustment."""
446+
444447
applies_to_price_ids: List[str]
445448
"""The price IDs that this adjustment applies to."""
446449

@@ -456,20 +459,17 @@ class LineItemAdjustmentMaximumAdjustment(BaseModel):
456459
adjustment applies to.
457460
"""
458461

459-
plan_phase_order: Optional[int] = None
460-
"""The plan phase in which this adjustment is active."""
461-
462462
reason: Optional[str] = None
463463
"""The reason for the adjustment."""
464464

465465

466466
LineItemAdjustment: TypeAlias = Annotated[
467467
Union[
468-
LineItemAdjustmentAmountDiscountAdjustment,
469-
LineItemAdjustmentPercentageDiscountAdjustment,
470-
LineItemAdjustmentUsageDiscountAdjustment,
471-
LineItemAdjustmentMinimumAdjustment,
472-
LineItemAdjustmentMaximumAdjustment,
468+
LineItemAdjustmentMonetaryUsageDiscountAdjustment,
469+
LineItemAdjustmentMonetaryAmountDiscountAdjustment,
470+
LineItemAdjustmentMonetaryPercentageDiscountAdjustment,
471+
LineItemAdjustmentMonetaryMinimumAdjustment,
472+
LineItemAdjustmentMonetaryMaximumAdjustment,
473473
],
474474
PropertyInfo(discriminator="adjustment_type"),
475475
]
@@ -599,18 +599,21 @@ class LineItem(BaseModel):
599599

600600
adjusted_subtotal: str
601601
"""
602-
The line amount after any adjustments, before overage conversion, credits and
602+
The line amount after any adjustments and before overage conversion, credits and
603603
partial invoicing.
604604
"""
605605

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

609609
amount: str
610-
"""The final amount after any discounts or minimums."""
610+
"""
611+
The final amount for a line item after all adjustments and pre paid credits have
612+
been applied.
613+
"""
611614

612615
credits_applied: str
613-
"""The number of credits used"""
616+
"""The number of prepaid credits applied."""
614617

615618
discount: Optional[Discount] = None
616619

@@ -657,6 +660,7 @@ class LineItem(BaseModel):
657660
"""
658661

659662
quantity: float
663+
"""Either the fixed fee quantity or the usage during the service period."""
660664

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

670674
subtotal: str
671-
"""The line amount before any line item-specific discounts or minimums."""
675+
"""The line amount before before any adjustments."""
672676

673677
tax_amounts: List[LineItemTaxAmount]
674678
"""An array of tax rates and their incurred tax amounts.

0 commit comments

Comments
 (0)