Skip to content

Commit f0089bf

Browse files
feat(api): api update (#520)
1 parent 1c1242c commit f0089bf

10 files changed

+2187
-3
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-8663e8fc543041d9694eddcd2f7e9784611369606700f99340e6dc80607b2dfa.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml

src/orb/resources/prices/prices.py

Lines changed: 382 additions & 2 deletions
Large diffs are not rendered by default.

src/orb/types/invoice.py

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
"CustomerBalanceTransactionInvoice",
2222
"CustomerTaxID",
2323
"LineItem",
24+
"LineItemAdjustment",
25+
"LineItemAdjustmentAmountDiscountAdjustment",
26+
"LineItemAdjustmentPercentageDiscountAdjustment",
27+
"LineItemAdjustmentUsageDiscountAdjustment",
28+
"LineItemAdjustmentMinimumAdjustment",
29+
"LineItemAdjustmentMaximumAdjustment",
2430
"LineItemMaximum",
2531
"LineItemMinimum",
2632
"LineItemSubLineItem",
@@ -319,6 +325,156 @@ class CustomerTaxID(BaseModel):
319325
value: str
320326

321327

328+
class LineItemAdjustmentAmountDiscountAdjustment(BaseModel):
329+
id: str
330+
331+
adjustment_type: Literal["amount_discount"]
332+
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+
"""
338+
339+
applies_to_price_ids: List[str]
340+
"""The price IDs that this adjustment applies to."""
341+
342+
is_invoice_level: bool
343+
"""
344+
True for adjustments that apply to an entire invocice, false for adjustments
345+
that apply to only one price.
346+
"""
347+
348+
plan_phase_order: Optional[int] = None
349+
"""The plan phase in which this adjustment is active."""
350+
351+
reason: Optional[str] = None
352+
"""The reason for the adjustment."""
353+
354+
355+
class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel):
356+
id: str
357+
358+
adjustment_type: Literal["percentage_discount"]
359+
360+
applies_to_price_ids: List[str]
361+
"""The price IDs that this adjustment applies to."""
362+
363+
is_invoice_level: bool
364+
"""
365+
True for adjustments that apply to an entire invocice, false for adjustments
366+
that apply to only one price.
367+
"""
368+
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+
378+
reason: Optional[str] = None
379+
"""The reason for the adjustment."""
380+
381+
382+
class LineItemAdjustmentUsageDiscountAdjustment(BaseModel):
383+
id: str
384+
385+
adjustment_type: Literal["usage_discount"]
386+
387+
applies_to_price_ids: List[str]
388+
"""The price IDs that this adjustment applies to."""
389+
390+
is_invoice_level: bool
391+
"""
392+
True for adjustments that apply to an entire invocice, false for adjustments
393+
that apply to only one price.
394+
"""
395+
396+
plan_phase_order: Optional[int] = None
397+
"""The plan phase in which this adjustment is active."""
398+
399+
reason: Optional[str] = None
400+
"""The reason for the adjustment."""
401+
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+
"""
407+
408+
409+
class LineItemAdjustmentMinimumAdjustment(BaseModel):
410+
id: str
411+
412+
adjustment_type: Literal["minimum"]
413+
414+
applies_to_price_ids: List[str]
415+
"""The price IDs that this adjustment applies to."""
416+
417+
is_invoice_level: bool
418+
"""
419+
True for adjustments that apply to an entire invocice, false for adjustments
420+
that apply to only one price.
421+
"""
422+
423+
item_id: str
424+
"""The item ID that revenue from this minimum will be attributed to."""
425+
426+
minimum_amount: str
427+
"""
428+
The minimum amount to charge in a given billing period for the prices this
429+
adjustment applies to.
430+
"""
431+
432+
plan_phase_order: Optional[int] = None
433+
"""The plan phase in which this adjustment is active."""
434+
435+
reason: Optional[str] = None
436+
"""The reason for the adjustment."""
437+
438+
439+
class LineItemAdjustmentMaximumAdjustment(BaseModel):
440+
id: str
441+
442+
adjustment_type: Literal["maximum"]
443+
444+
applies_to_price_ids: List[str]
445+
"""The price IDs that this adjustment applies to."""
446+
447+
is_invoice_level: bool
448+
"""
449+
True for adjustments that apply to an entire invocice, false for adjustments
450+
that apply to only one price.
451+
"""
452+
453+
maximum_amount: str
454+
"""
455+
The maximum amount to charge in a given billing period for the prices this
456+
adjustment applies to.
457+
"""
458+
459+
plan_phase_order: Optional[int] = None
460+
"""The plan phase in which this adjustment is active."""
461+
462+
reason: Optional[str] = None
463+
"""The reason for the adjustment."""
464+
465+
466+
LineItemAdjustment: TypeAlias = Annotated[
467+
Union[
468+
LineItemAdjustmentAmountDiscountAdjustment,
469+
LineItemAdjustmentPercentageDiscountAdjustment,
470+
LineItemAdjustmentUsageDiscountAdjustment,
471+
LineItemAdjustmentMinimumAdjustment,
472+
LineItemAdjustmentMaximumAdjustment,
473+
],
474+
PropertyInfo(discriminator="adjustment_type"),
475+
]
476+
477+
322478
class LineItemMaximum(BaseModel):
323479
applies_to_price_ids: List[str]
324480
"""List of price_ids that this maximum amount applies to.
@@ -441,9 +597,21 @@ class LineItem(BaseModel):
441597
id: str
442598
"""A unique ID for this line item."""
443599

600+
adjusted_subtotal: str
601+
"""
602+
The line amount after any adjustments, before overage conversion, credits and
603+
partial invoicing.
604+
"""
605+
606+
adjustments: List[LineItemAdjustment]
607+
"""All adjustments applied to the line item."""
608+
444609
amount: str
445610
"""The final amount after any discounts or minimums."""
446611

612+
credits_applied: str
613+
"""The number of credits used"""
614+
447615
discount: Optional[Discount] = None
448616

449617
end_date: datetime
@@ -457,16 +625,23 @@ class LineItem(BaseModel):
457625
"""
458626

459627
maximum: Optional[LineItemMaximum] = None
628+
"""This field is deprecated in favor of `adjustments`."""
460629

461630
maximum_amount: Optional[str] = None
631+
"""This field is deprecated in favor of `adjustments`."""
462632

463633
minimum: Optional[LineItemMinimum] = None
634+
"""This field is deprecated in favor of `adjustments`."""
464635

465636
minimum_amount: Optional[str] = None
637+
"""This field is deprecated in favor of `adjustments`."""
466638

467639
name: str
468640
"""The name of the price associated with this line item."""
469641

642+
partially_invoiced_amount: str
643+
"""Any amount applied from a partial invoice"""
644+
470645
price: Optional[Price] = None
471646
"""
472647
The Price resource represents a price that can be billed on a subscription,

0 commit comments

Comments
 (0)