Skip to content

Commit 4bbd20b

Browse files
feat(api): add param to backfill create (#247)
1 parent 8274660 commit 4bbd20b

16 files changed

Lines changed: 620 additions & 12 deletions

src/orb/resources/prices/prices.py

Lines changed: 100 additions & 0 deletions
Large diffs are not rendered by default.

src/orb/resources/subscriptions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,11 @@ def schedule_plan_change(
14131413
default for the plan. The request format for price overrides, maximums, and
14141414
minimums are the same as those in [subscription creation](create-subscription).
14151415
1416+
## Scheduling multiple plan changes
1417+
1418+
When scheduling multiple plan changes with the same date, the latest plan change
1419+
on that day takes effect.
1420+
14161421
## Prorations for in-advance fees
14171422
14181423
By default, Orb calculates the prorated difference in any fixed fees when making
@@ -3120,6 +3125,11 @@ async def schedule_plan_change(
31203125
default for the plan. The request format for price overrides, maximums, and
31213126
minimums are the same as those in [subscription creation](create-subscription).
31223127
3128+
## Scheduling multiple plan changes
3129+
3130+
When scheduling multiple plan changes with the same date, the latest plan change
3131+
on that day takes effect.
3132+
31233133
## Prorations for in-advance fees
31243134
31253135
By default, Orb calculates the prorated difference in any fixed fees when making

src/orb/types/events/backfill_close_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class BackfillCloseResponse(BaseModel):
2626
If null, this backfill is not scoped to a single customer.
2727
"""
2828

29+
events_ingested: int
30+
"""The number of events ingested in this backfill."""
31+
2932
reverted_at: Optional[datetime] = None
3033
"""The time at which this backfill was reverted."""
3134

src/orb/types/events/backfill_create_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class BackfillCreateResponse(BaseModel):
2626
If null, this backfill is not scoped to a single customer.
2727
"""
2828

29+
events_ingested: int
30+
"""The number of events ingested in this backfill."""
31+
2932
reverted_at: Optional[datetime] = None
3033
"""The time at which this backfill was reverted."""
3134

src/orb/types/events/backfill_fetch_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class BackfillFetchResponse(BaseModel):
2626
If null, this backfill is not scoped to a single customer.
2727
"""
2828

29+
events_ingested: int
30+
"""The number of events ingested in this backfill."""
31+
2932
reverted_at: Optional[datetime] = None
3033
"""The time at which this backfill was reverted."""
3134

src/orb/types/events/backfill_list_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class BackfillListResponse(BaseModel):
2626
If null, this backfill is not scoped to a single customer.
2727
"""
2828

29+
events_ingested: int
30+
"""The number of events ingested in this backfill."""
31+
2932
reverted_at: Optional[datetime] = None
3033
"""The time at which this backfill was reverted."""
3134

src/orb/types/events/backfill_revert_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class BackfillRevertResponse(BaseModel):
2626
If null, this backfill is not scoped to a single customer.
2727
"""
2828

29+
events_ingested: int
30+
"""The number of events ingested in this backfill."""
31+
2932
reverted_at: Optional[datetime] = None
3033
"""The time at which this backfill was reverted."""
3134

src/orb/types/plan_create_params.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ class PriceNewPlanUnitPrice(TypedDict, total=False):
105105
this is true, and in-arrears if this is false.
106106
"""
107107

108+
conversion_rate: Optional[float]
109+
"""The per unit conversion rate of the price currency to the invoicing currency."""
110+
108111
currency: Optional[str]
109112
"""
110113
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -128,7 +131,7 @@ class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False):
128131
package_amount: Required[str]
129132
"""A currency amount to rate usage by"""
130133

131-
package_size: Optional[int]
134+
package_size: Required[int]
132135
"""An integer amount to represent package size.
133136
134137
For example, 1000 here would divide usage by 1000 before multiplying by
@@ -162,6 +165,9 @@ class PriceNewPlanPackagePrice(TypedDict, total=False):
162165
this is true, and in-arrears if this is false.
163166
"""
164167

168+
conversion_rate: Optional[float]
169+
"""The per unit conversion rate of the price currency to the invoicing currency."""
170+
165171
currency: Optional[str]
166172
"""
167173
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -230,6 +236,9 @@ class PriceNewPlanMatrixPrice(TypedDict, total=False):
230236
this is true, and in-arrears if this is false.
231237
"""
232238

239+
conversion_rate: Optional[float]
240+
"""The per unit conversion rate of the price currency to the invoicing currency."""
241+
233242
currency: Optional[str]
234243
"""
235244
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -291,6 +300,9 @@ class PriceNewPlanTieredPrice(TypedDict, total=False):
291300
this is true, and in-arrears if this is false.
292301
"""
293302

303+
conversion_rate: Optional[float]
304+
"""The per unit conversion rate of the price currency to the invoicing currency."""
305+
294306
currency: Optional[str]
295307
"""
296308
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -358,6 +370,9 @@ class PriceNewPlanTieredBpsPrice(TypedDict, total=False):
358370
this is true, and in-arrears if this is false.
359371
"""
360372

373+
conversion_rate: Optional[float]
374+
"""The per unit conversion rate of the price currency to the invoicing currency."""
375+
361376
currency: Optional[str]
362377
"""
363378
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -411,6 +426,9 @@ class PriceNewPlanBpsPrice(TypedDict, total=False):
411426
this is true, and in-arrears if this is false.
412427
"""
413428

429+
conversion_rate: Optional[float]
430+
"""The per unit conversion rate of the price currency to the invoicing currency."""
431+
414432
currency: Optional[str]
415433
"""
416434
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -475,6 +493,9 @@ class PriceNewPlanBulkBpsPrice(TypedDict, total=False):
475493
this is true, and in-arrears if this is false.
476494
"""
477495

496+
conversion_rate: Optional[float]
497+
"""The per unit conversion rate of the price currency to the invoicing currency."""
498+
478499
currency: Optional[str]
479500
"""
480501
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -533,6 +554,9 @@ class PriceNewPlanBulkPrice(TypedDict, total=False):
533554
this is true, and in-arrears if this is false.
534555
"""
535556

557+
conversion_rate: Optional[float]
558+
"""The per unit conversion rate of the price currency to the invoicing currency."""
559+
536560
currency: Optional[str]
537561
"""
538562
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -578,6 +602,9 @@ class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False):
578602
this is true, and in-arrears if this is false.
579603
"""
580604

605+
conversion_rate: Optional[float]
606+
"""The per unit conversion rate of the price currency to the invoicing currency."""
607+
581608
currency: Optional[str]
582609
"""
583610
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -623,6 +650,9 @@ class PriceNewPlanTieredPackagePrice(TypedDict, total=False):
623650
this is true, and in-arrears if this is false.
624651
"""
625652

653+
conversion_rate: Optional[float]
654+
"""The per unit conversion rate of the price currency to the invoicing currency."""
655+
626656
currency: Optional[str]
627657
"""
628658
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -668,6 +698,9 @@ class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False):
668698
this is true, and in-arrears if this is false.
669699
"""
670700

701+
conversion_rate: Optional[float]
702+
"""The per unit conversion rate of the price currency to the invoicing currency."""
703+
671704
currency: Optional[str]
672705
"""
673706
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -713,6 +746,9 @@ class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False):
713746
this is true, and in-arrears if this is false.
714747
"""
715748

749+
conversion_rate: Optional[float]
750+
"""The per unit conversion rate of the price currency to the invoicing currency."""
751+
716752
currency: Optional[str]
717753
"""
718754
An ISO 4217 currency string, or custom pricing unit identifier, in which this
@@ -758,6 +794,9 @@ class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False):
758794
this is true, and in-arrears if this is false.
759795
"""
760796

797+
conversion_rate: Optional[float]
798+
"""The per unit conversion rate of the price currency to the invoicing currency."""
799+
761800
currency: Optional[str]
762801
"""
763802
An ISO 4217 currency string, or custom pricing unit identifier, in which this

src/orb/types/price.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ class UnitPrice(BaseModel):
175175

176176
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
177177

178+
conversion_rate: Optional[float] = None
179+
178180
created_at: datetime
179181

180182
credit_allocation: Optional[UnitPriceCreditAllocation] = None
@@ -250,7 +252,7 @@ class PackagePricePackageConfig(BaseModel):
250252
package_amount: str
251253
"""A currency amount to rate usage by"""
252254

253-
package_size: Optional[int] = None
255+
package_size: int
254256
"""An integer amount to represent package size.
255257
256258
For example, 1000 here would divide usage by 1000 before multiplying by
@@ -265,6 +267,8 @@ class PackagePrice(BaseModel):
265267

266268
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
267269

270+
conversion_rate: Optional[float] = None
271+
268272
created_at: datetime
269273

270274
credit_allocation: Optional[PackagePriceCreditAllocation] = None
@@ -366,6 +370,8 @@ class MatrixPrice(BaseModel):
366370

367371
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
368372

373+
conversion_rate: Optional[float] = None
374+
369375
created_at: datetime
370376

371377
credit_allocation: Optional[MatrixPriceCreditAllocation] = None
@@ -460,6 +466,8 @@ class TieredPrice(BaseModel):
460466

461467
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
462468

469+
conversion_rate: Optional[float] = None
470+
463471
created_at: datetime
464472

465473
credit_allocation: Optional[TieredPriceCreditAllocation] = None
@@ -560,6 +568,8 @@ class TieredBpsPrice(BaseModel):
560568

561569
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
562570

571+
conversion_rate: Optional[float] = None
572+
563573
created_at: datetime
564574

565575
credit_allocation: Optional[TieredBpsPriceCreditAllocation] = None
@@ -648,6 +658,8 @@ class BpsPrice(BaseModel):
648658

649659
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
650660

661+
conversion_rate: Optional[float] = None
662+
651663
created_at: datetime
652664

653665
credit_allocation: Optional[BpsPriceCreditAllocation] = None
@@ -745,6 +757,8 @@ class BulkBpsPrice(BaseModel):
745757

746758
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
747759

760+
conversion_rate: Optional[float] = None
761+
748762
created_at: datetime
749763

750764
credit_allocation: Optional[BulkBpsPriceCreditAllocation] = None
@@ -836,6 +850,8 @@ class BulkPrice(BaseModel):
836850

837851
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
838852

853+
conversion_rate: Optional[float] = None
854+
839855
created_at: datetime
840856

841857
credit_allocation: Optional[BulkPriceCreditAllocation] = None
@@ -912,6 +928,8 @@ class ThresholdTotalAmountPrice(BaseModel):
912928

913929
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
914930

931+
conversion_rate: Optional[float] = None
932+
915933
created_at: datetime
916934

917935
credit_allocation: Optional[ThresholdTotalAmountPriceCreditAllocation] = None
@@ -990,6 +1008,8 @@ class TieredPackagePrice(BaseModel):
9901008

9911009
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
9921010

1011+
conversion_rate: Optional[float] = None
1012+
9931013
created_at: datetime
9941014

9951015
credit_allocation: Optional[TieredPackagePriceCreditAllocation] = None
@@ -1068,6 +1088,8 @@ class GroupedTieredPrice(BaseModel):
10681088

10691089
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
10701090

1091+
conversion_rate: Optional[float] = None
1092+
10711093
created_at: datetime
10721094

10731095
credit_allocation: Optional[GroupedTieredPriceCreditAllocation] = None
@@ -1146,6 +1168,8 @@ class TieredWithMinimumPrice(BaseModel):
11461168

11471169
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
11481170

1171+
conversion_rate: Optional[float] = None
1172+
11491173
created_at: datetime
11501174

11511175
credit_allocation: Optional[TieredWithMinimumPriceCreditAllocation] = None
@@ -1224,6 +1248,8 @@ class TieredPackageWithMinimumPrice(BaseModel):
12241248

12251249
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
12261250

1251+
conversion_rate: Optional[float] = None
1252+
12271253
created_at: datetime
12281254

12291255
credit_allocation: Optional[TieredPackageWithMinimumPriceCreditAllocation] = None
@@ -1302,6 +1328,8 @@ class PackageWithAllocationPrice(BaseModel):
13021328

13031329
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
13041330

1331+
conversion_rate: Optional[float] = None
1332+
13051333
created_at: datetime
13061334

13071335
credit_allocation: Optional[PackageWithAllocationPriceCreditAllocation] = None
@@ -1380,6 +1408,8 @@ class UnitWithPercentPrice(BaseModel):
13801408

13811409
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
13821410

1411+
conversion_rate: Optional[float] = None
1412+
13831413
created_at: datetime
13841414

13851415
credit_allocation: Optional[UnitWithPercentPriceCreditAllocation] = None
@@ -1484,6 +1514,8 @@ class MatrixWithAllocationPrice(BaseModel):
14841514

14851515
cadence: Literal["one_time", "monthly", "quarterly", "annual"]
14861516

1517+
conversion_rate: Optional[float] = None
1518+
14871519
created_at: datetime
14881520

14891521
credit_allocation: Optional[MatrixWithAllocationPriceCreditAllocation] = None

0 commit comments

Comments
 (0)