Skip to content

Commit a8446ca

Browse files
feat(api): api update
1 parent 4938f6d commit a8446ca

19 files changed

+226
-64
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0db984d367f9ae04249fb6c72789b0a38ef1785d156b438fe03290fa4e262a7d.yml
3-
openapi_spec_hash: c901c8b4fc2b0399a33b1346f8521850
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml
3+
openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e
44
config_hash: 3c3524be9607afb24d2139ce26ce5389

src/orb/resources/credit_notes.py

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Union, Iterable, Optional
6-
from datetime import datetime
6+
from datetime import date, datetime
77
from typing_extensions import Literal
88

99
import httpx
@@ -47,7 +47,9 @@ def create(
4747
*,
4848
line_items: Iterable[credit_note_create_params.LineItem],
4949
reason: Literal["duplicate", "fraudulent", "order_change", "product_unsatisfactory"],
50+
end_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
5051
memo: Optional[str] | NotGiven = NOT_GIVEN,
52+
start_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
5153
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5254
# The extra values given here take precedence over values defined on the client or passed to this method.
5355
extra_headers: Headers | None = None,
@@ -60,11 +62,46 @@ def create(
6062
This endpoint is used to create a single
6163
[`Credit Note`](/invoicing/credit-notes).
6264
65+
The credit note service period configuration supports two explicit modes:
66+
67+
1. Global service periods: Specify start_date and end_date at the credit note
68+
level. These dates will be applied to all line items uniformly.
69+
70+
2. Individual service periods: Specify start_date and end_date for each line
71+
item. When using this mode, ALL line items must have individual periods
72+
specified.
73+
74+
3. Default behavior: If no service periods are specified (neither global nor
75+
individual), the original invoice line item service periods will be used.
76+
77+
Note: Mixing global and individual service periods in the same request is not
78+
allowed to prevent confusion.
79+
80+
Service period dates are normalized to the start of the day in the customer's
81+
timezone to ensure consistent handling across different timezones.
82+
83+
Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
84+
"2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
85+
86+
Note: Both start_date and end_date are inclusive - the service period will cover
87+
both the start date and end date completely (from start of start_date to end of
88+
end_date).
89+
6390
Args:
6491
reason: An optional reason for the credit note.
6592
93+
end_date: A date string to specify the global credit note service period end date in the
94+
customer's timezone. This will be applied to all line items that don't have
95+
their own individual service periods specified. If not provided, line items will
96+
use their original invoice line item service periods. This date is inclusive.
97+
6698
memo: An optional memo to attach to the credit note.
6799
100+
start_date: A date string to specify the global credit note service period start date in the
101+
customer's timezone. This will be applied to all line items that don't have
102+
their own individual service periods specified. If not provided, line items will
103+
use their original invoice line item service periods. This date is inclusive.
104+
68105
extra_headers: Send extra headers
69106
70107
extra_query: Add additional query parameters to the request
@@ -81,7 +118,9 @@ def create(
81118
{
82119
"line_items": line_items,
83120
"reason": reason,
121+
"end_date": end_date,
84122
"memo": memo,
123+
"start_date": start_date,
85124
},
86125
credit_note_create_params.CreditNoteCreateParams,
87126
),
@@ -214,7 +253,9 @@ async def create(
214253
*,
215254
line_items: Iterable[credit_note_create_params.LineItem],
216255
reason: Literal["duplicate", "fraudulent", "order_change", "product_unsatisfactory"],
256+
end_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
217257
memo: Optional[str] | NotGiven = NOT_GIVEN,
258+
start_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
218259
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
219260
# The extra values given here take precedence over values defined on the client or passed to this method.
220261
extra_headers: Headers | None = None,
@@ -227,11 +268,46 @@ async def create(
227268
This endpoint is used to create a single
228269
[`Credit Note`](/invoicing/credit-notes).
229270
271+
The credit note service period configuration supports two explicit modes:
272+
273+
1. Global service periods: Specify start_date and end_date at the credit note
274+
level. These dates will be applied to all line items uniformly.
275+
276+
2. Individual service periods: Specify start_date and end_date for each line
277+
item. When using this mode, ALL line items must have individual periods
278+
specified.
279+
280+
3. Default behavior: If no service periods are specified (neither global nor
281+
individual), the original invoice line item service periods will be used.
282+
283+
Note: Mixing global and individual service periods in the same request is not
284+
allowed to prevent confusion.
285+
286+
Service period dates are normalized to the start of the day in the customer's
287+
timezone to ensure consistent handling across different timezones.
288+
289+
Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
290+
"2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
291+
292+
Note: Both start_date and end_date are inclusive - the service period will cover
293+
both the start date and end date completely (from start of start_date to end of
294+
end_date).
295+
230296
Args:
231297
reason: An optional reason for the credit note.
232298
299+
end_date: A date string to specify the global credit note service period end date in the
300+
customer's timezone. This will be applied to all line items that don't have
301+
their own individual service periods specified. If not provided, line items will
302+
use their original invoice line item service periods. This date is inclusive.
303+
233304
memo: An optional memo to attach to the credit note.
234305
306+
start_date: A date string to specify the global credit note service period start date in the
307+
customer's timezone. This will be applied to all line items that don't have
308+
their own individual service periods specified. If not provided, line items will
309+
use their original invoice line item service periods. This date is inclusive.
310+
235311
extra_headers: Send extra headers
236312
237313
extra_query: Add additional query parameters to the request
@@ -248,7 +324,9 @@ async def create(
248324
{
249325
"line_items": line_items,
250326
"reason": reason,
327+
"end_date": end_date,
251328
"memo": memo,
329+
"start_date": start_date,
252330
},
253331
credit_note_create_params.CreditNoteCreateParams,
254332
),

src/orb/resources/customers/costs.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ def list(
111111
112112
A customer that uses a few API calls a day but has a minimum commitment might
113113
exhibit the following pattern for their subtotal and total in the first few days
114-
of the month. Here, we assume that each API call is $2.50, the customer's plan
115-
has a monthly minimum of $50 for this price, and that the subscription's billing
116-
period bounds are aligned to the first of the month:
114+
of the month. Here, we assume that each API call is \\$$2.50, the customer's plan
115+
has a monthly minimum of \\$$50 for this price, and that the subscription's
116+
billing period bounds are aligned to the first of the month:
117117
118118
| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
119119
| --------------- | ------------- | ---------------- | -------- | ------------------------ |
120-
| 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
121-
| 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
122-
| 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
123-
| 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
124-
| 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
120+
| 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 |
121+
| 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 |
122+
| 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 |
123+
| 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 |
124+
| 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 |
125125
126126
### Periodic values
127127
@@ -287,17 +287,17 @@ def list_by_external_id(
287287
288288
A customer that uses a few API calls a day but has a minimum commitment might
289289
exhibit the following pattern for their subtotal and total in the first few days
290-
of the month. Here, we assume that each API call is $2.50, the customer's plan
291-
has a monthly minimum of $50 for this price, and that the subscription's billing
292-
period bounds are aligned to the first of the month:
290+
of the month. Here, we assume that each API call is \\$$2.50, the customer's plan
291+
has a monthly minimum of \\$$50 for this price, and that the subscription's
292+
billing period bounds are aligned to the first of the month:
293293
294294
| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
295295
| --------------- | ------------- | ---------------- | -------- | ------------------------ |
296-
| 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
297-
| 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
298-
| 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
299-
| 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
300-
| 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
296+
| 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 |
297+
| 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 |
298+
| 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 |
299+
| 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 |
300+
| 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 |
301301
302302
### Periodic values
303303
@@ -486,17 +486,17 @@ async def list(
486486
487487
A customer that uses a few API calls a day but has a minimum commitment might
488488
exhibit the following pattern for their subtotal and total in the first few days
489-
of the month. Here, we assume that each API call is $2.50, the customer's plan
490-
has a monthly minimum of $50 for this price, and that the subscription's billing
491-
period bounds are aligned to the first of the month:
489+
of the month. Here, we assume that each API call is \\$$2.50, the customer's plan
490+
has a monthly minimum of \\$$50 for this price, and that the subscription's
491+
billing period bounds are aligned to the first of the month:
492492
493493
| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
494494
| --------------- | ------------- | ---------------- | -------- | ------------------------ |
495-
| 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
496-
| 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
497-
| 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
498-
| 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
499-
| 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
495+
| 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 |
496+
| 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 |
497+
| 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 |
498+
| 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 |
499+
| 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 |
500500
501501
### Periodic values
502502
@@ -662,17 +662,17 @@ async def list_by_external_id(
662662
663663
A customer that uses a few API calls a day but has a minimum commitment might
664664
exhibit the following pattern for their subtotal and total in the first few days
665-
of the month. Here, we assume that each API call is $2.50, the customer's plan
666-
has a monthly minimum of $50 for this price, and that the subscription's billing
667-
period bounds are aligned to the first of the month:
665+
of the month. Here, we assume that each API call is \\$$2.50, the customer's plan
666+
has a monthly minimum of \\$$50 for this price, and that the subscription's
667+
billing period bounds are aligned to the first of the month:
668668
669669
| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
670670
| --------------- | ------------- | ---------------- | -------- | ------------------------ |
671-
| 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
672-
| 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
673-
| 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
674-
| 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
675-
| 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
671+
| 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 |
672+
| 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 |
673+
| 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 |
674+
| 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 |
675+
| 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 |
676676
677677
### Periodic values
678678

src/orb/resources/customers/credits/ledger.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def list(
123123
deductions take place from a non-expiring credit block.
124124
125125
If there are multiple blocks with the same expiration date, Orb will deduct from
126-
the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
127-
basis before paid credits with a $5.00 cost basis).
126+
the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost
127+
basis before paid credits with a \\$$5.00 cost basis).
128128
129129
It's also possible for a single usage event's deduction to _span_ credit blocks.
130130
In this case, Orb will deduct from the next block, ending at the credit block
@@ -2069,8 +2069,8 @@ def list_by_external_id(
20692069
deductions take place from a non-expiring credit block.
20702070
20712071
If there are multiple blocks with the same expiration date, Orb will deduct from
2072-
the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
2073-
basis before paid credits with a $5.00 cost basis).
2072+
the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost
2073+
basis before paid credits with a \\$$5.00 cost basis).
20742074
20752075
It's also possible for a single usage event's deduction to _span_ credit blocks.
20762076
In this case, Orb will deduct from the next block, ending at the credit block
@@ -2254,8 +2254,8 @@ def list(
22542254
deductions take place from a non-expiring credit block.
22552255
22562256
If there are multiple blocks with the same expiration date, Orb will deduct from
2257-
the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
2258-
basis before paid credits with a $5.00 cost basis).
2257+
the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost
2258+
basis before paid credits with a \\$$5.00 cost basis).
22592259
22602260
It's also possible for a single usage event's deduction to _span_ credit blocks.
22612261
In this case, Orb will deduct from the next block, ending at the credit block
@@ -4200,8 +4200,8 @@ def list_by_external_id(
42004200
deductions take place from a non-expiring credit block.
42014201
42024202
If there are multiple blocks with the same expiration date, Orb will deduct from
4203-
the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
4204-
basis before paid credits with a $5.00 cost basis).
4203+
the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost
4204+
basis before paid credits with a \\$$5.00 cost basis).
42054205
42064206
It's also possible for a single usage event's deduction to _span_ credit blocks.
42074207
In this case, Orb will deduct from the next block, ending at the credit block

src/orb/resources/events/backfills.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ def create(
104104
105105
Args:
106106
timeframe_end: The (exclusive) end of the usage timeframe affected by this backfill. By
107-
default, Orb allows backfills up to 10 days in duration at a time. Reach out to
107+
default, Orb allows backfills up to 31 days in duration at a time. Reach out to
108108
discuss extending this limit and your use case.
109109
110110
timeframe_start: The (inclusive) start of the usage timeframe affected by this backfill. By
111-
default, Orb allows backfills up to 10 days in duration at a time. Reach out to
111+
default, Orb allows backfills up to 31 days in duration at a time. Reach out to
112112
discuss extending this limit and your use case.
113113
114114
close_time: The time at which no more events will be accepted for this backfill. The
@@ -420,11 +420,11 @@ async def create(
420420
421421
Args:
422422
timeframe_end: The (exclusive) end of the usage timeframe affected by this backfill. By
423-
default, Orb allows backfills up to 10 days in duration at a time. Reach out to
423+
default, Orb allows backfills up to 31 days in duration at a time. Reach out to
424424
discuss extending this limit and your use case.
425425
426426
timeframe_start: The (inclusive) start of the usage timeframe affected by this backfill. By
427-
default, Orb allows backfills up to 10 days in duration at a time. Reach out to
427+
default, Orb allows backfills up to 31 days in duration at a time. Reach out to
428428
discuss extending this limit and your use case.
429429
430430
close_time: The time at which no more events will be accepted for this backfill. The

0 commit comments

Comments
 (0)