Skip to content

Commit 0ccfd37

Browse files
feat(api): api update
1 parent b86c8d9 commit 0ccfd37

File tree

8 files changed

+134
-10
lines changed

8 files changed

+134
-10
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: 126
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-90b631890d57a96df99cc973fedfb48e6278b025dcb6262519eb064044d47efe.yml
3-
openapi_spec_hash: b17b00ef11d479516d6f1e5a323aef28
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c92fb451e13f157b3735f188acc8d57aa3adfbaac1683645e1ba4f432dd7a4f8.yml
3+
openapi_spec_hash: dbcd87ecfbd3976eb3b99ec6f9fbc606
44
config_hash: bcf82bddb691f6be773ac6cae8c03b9a

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Union, Optional
6+
from datetime import datetime
67

78
import httpx
89

@@ -71,6 +72,10 @@ def list(
7172
*,
7273
currency: Optional[str] | Omit = omit,
7374
cursor: Optional[str] | Omit = omit,
75+
effective_date_gt: Union[str, datetime, None] | Omit = omit,
76+
effective_date_gte: Union[str, datetime, None] | Omit = omit,
77+
effective_date_lt: Union[str, datetime, None] | Omit = omit,
78+
effective_date_lte: Union[str, datetime, None] | Omit = omit,
7479
include_all_blocks: bool | Omit = omit,
7580
limit: int | Omit = omit,
7681
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -89,6 +94,11 @@ def list(
8994
Note that `currency` defaults to credits if not specified. To use a real world
9095
currency, set `currency` to an ISO 4217 string.
9196
97+
Results can be filtered by the block's `effective_date` using the
98+
`effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
99+
`effective_date[lte]` query parameters. This filters on when the credit block
100+
becomes effective, which may differ from creation time for backdated credits.
101+
92102
Args:
93103
currency: The ledger currency or custom pricing unit to use.
94104
@@ -122,6 +132,10 @@ def list(
122132
{
123133
"currency": currency,
124134
"cursor": cursor,
135+
"effective_date_gt": effective_date_gt,
136+
"effective_date_gte": effective_date_gte,
137+
"effective_date_lt": effective_date_lt,
138+
"effective_date_lte": effective_date_lte,
125139
"include_all_blocks": include_all_blocks,
126140
"limit": limit,
127141
},
@@ -137,6 +151,10 @@ def list_by_external_id(
137151
*,
138152
currency: Optional[str] | Omit = omit,
139153
cursor: Optional[str] | Omit = omit,
154+
effective_date_gt: Union[str, datetime, None] | Omit = omit,
155+
effective_date_gte: Union[str, datetime, None] | Omit = omit,
156+
effective_date_lt: Union[str, datetime, None] | Omit = omit,
157+
effective_date_lte: Union[str, datetime, None] | Omit = omit,
140158
include_all_blocks: bool | Omit = omit,
141159
limit: int | Omit = omit,
142160
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -155,6 +173,11 @@ def list_by_external_id(
155173
Note that `currency` defaults to credits if not specified. To use a real world
156174
currency, set `currency` to an ISO 4217 string.
157175
176+
Results can be filtered by the block's `effective_date` using the
177+
`effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
178+
`effective_date[lte]` query parameters. This filters on when the credit block
179+
becomes effective, which may differ from creation time for backdated credits.
180+
158181
Args:
159182
currency: The ledger currency or custom pricing unit to use.
160183
@@ -190,6 +213,10 @@ def list_by_external_id(
190213
{
191214
"currency": currency,
192215
"cursor": cursor,
216+
"effective_date_gt": effective_date_gt,
217+
"effective_date_gte": effective_date_gte,
218+
"effective_date_lt": effective_date_lt,
219+
"effective_date_lte": effective_date_lte,
193220
"include_all_blocks": include_all_blocks,
194221
"limit": limit,
195222
},
@@ -234,6 +261,10 @@ def list(
234261
*,
235262
currency: Optional[str] | Omit = omit,
236263
cursor: Optional[str] | Omit = omit,
264+
effective_date_gt: Union[str, datetime, None] | Omit = omit,
265+
effective_date_gte: Union[str, datetime, None] | Omit = omit,
266+
effective_date_lt: Union[str, datetime, None] | Omit = omit,
267+
effective_date_lte: Union[str, datetime, None] | Omit = omit,
237268
include_all_blocks: bool | Omit = omit,
238269
limit: int | Omit = omit,
239270
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -252,6 +283,11 @@ def list(
252283
Note that `currency` defaults to credits if not specified. To use a real world
253284
currency, set `currency` to an ISO 4217 string.
254285
286+
Results can be filtered by the block's `effective_date` using the
287+
`effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
288+
`effective_date[lte]` query parameters. This filters on when the credit block
289+
becomes effective, which may differ from creation time for backdated credits.
290+
255291
Args:
256292
currency: The ledger currency or custom pricing unit to use.
257293
@@ -285,6 +321,10 @@ def list(
285321
{
286322
"currency": currency,
287323
"cursor": cursor,
324+
"effective_date_gt": effective_date_gt,
325+
"effective_date_gte": effective_date_gte,
326+
"effective_date_lt": effective_date_lt,
327+
"effective_date_lte": effective_date_lte,
288328
"include_all_blocks": include_all_blocks,
289329
"limit": limit,
290330
},
@@ -300,6 +340,10 @@ def list_by_external_id(
300340
*,
301341
currency: Optional[str] | Omit = omit,
302342
cursor: Optional[str] | Omit = omit,
343+
effective_date_gt: Union[str, datetime, None] | Omit = omit,
344+
effective_date_gte: Union[str, datetime, None] | Omit = omit,
345+
effective_date_lt: Union[str, datetime, None] | Omit = omit,
346+
effective_date_lte: Union[str, datetime, None] | Omit = omit,
303347
include_all_blocks: bool | Omit = omit,
304348
limit: int | Omit = omit,
305349
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -318,6 +362,11 @@ def list_by_external_id(
318362
Note that `currency` defaults to credits if not specified. To use a real world
319363
currency, set `currency` to an ISO 4217 string.
320364
365+
Results can be filtered by the block's `effective_date` using the
366+
`effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
367+
`effective_date[lte]` query parameters. This filters on when the credit block
368+
becomes effective, which may differ from creation time for backdated credits.
369+
321370
Args:
322371
currency: The ledger currency or custom pricing unit to use.
323372
@@ -353,6 +402,10 @@ def list_by_external_id(
353402
{
354403
"currency": currency,
355404
"cursor": cursor,
405+
"effective_date_gt": effective_date_gt,
406+
"effective_date_gte": effective_date_gte,
407+
"effective_date_lt": effective_date_lt,
408+
"effective_date_lte": effective_date_lte,
356409
"include_all_blocks": include_all_blocks,
357410
"limit": limit,
358411
},

src/orb/types/credit_block_retrieve_response.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import Dict, List, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

@@ -35,6 +35,14 @@ class CreditBlockRetrieveResponse(BaseModel):
3535

3636
maximum_initial_balance: Optional[float] = None
3737

38+
metadata: Dict[str, str]
39+
"""User specified key-value pairs for the resource.
40+
41+
If not present, this defaults to an empty dictionary. Individual keys can be
42+
removed by setting the value to `null`, and the entire metadata mapping can be
43+
cleared by setting `metadata` to `null`.
44+
"""
45+
3846
per_unit_cost_basis: Optional[str] = None
3947

4048
status: Literal["active", "pending_payment"]

src/orb/types/customers/credit_list_by_external_id_params.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import TypedDict
5+
from typing import Union, Optional
6+
from datetime import datetime
7+
from typing_extensions import Annotated, TypedDict
8+
9+
from ..._utils import PropertyInfo
710

811
__all__ = ["CreditListByExternalIDParams"]
912

@@ -19,6 +22,18 @@ class CreditListByExternalIDParams(TypedDict, total=False):
1922
request.
2023
"""
2124

25+
effective_date_gt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[gt]", format="iso8601")]
26+
27+
effective_date_gte: Annotated[
28+
Union[str, datetime, None], PropertyInfo(alias="effective_date[gte]", format="iso8601")
29+
]
30+
31+
effective_date_lt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[lt]", format="iso8601")]
32+
33+
effective_date_lte: Annotated[
34+
Union[str, datetime, None], PropertyInfo(alias="effective_date[lte]", format="iso8601")
35+
]
36+
2237
include_all_blocks: bool
2338
"""
2439
If set to True, all expired and depleted blocks, as well as active block will be

src/orb/types/customers/credit_list_by_external_id_response.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import Dict, List, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

@@ -35,6 +35,14 @@ class CreditListByExternalIDResponse(BaseModel):
3535

3636
maximum_initial_balance: Optional[float] = None
3737

38+
metadata: Dict[str, str]
39+
"""User specified key-value pairs for the resource.
40+
41+
If not present, this defaults to an empty dictionary. Individual keys can be
42+
removed by setting the value to `null`, and the entire metadata mapping can be
43+
cleared by setting `metadata` to `null`.
44+
"""
45+
3846
per_unit_cost_basis: Optional[str] = None
3947

4048
status: Literal["active", "pending_payment"]

src/orb/types/customers/credit_list_params.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import TypedDict
5+
from typing import Union, Optional
6+
from datetime import datetime
7+
from typing_extensions import Annotated, TypedDict
8+
9+
from ..._utils import PropertyInfo
710

811
__all__ = ["CreditListParams"]
912

@@ -19,6 +22,18 @@ class CreditListParams(TypedDict, total=False):
1922
request.
2023
"""
2124

25+
effective_date_gt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[gt]", format="iso8601")]
26+
27+
effective_date_gte: Annotated[
28+
Union[str, datetime, None], PropertyInfo(alias="effective_date[gte]", format="iso8601")
29+
]
30+
31+
effective_date_lt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[lt]", format="iso8601")]
32+
33+
effective_date_lte: Annotated[
34+
Union[str, datetime, None], PropertyInfo(alias="effective_date[lte]", format="iso8601")
35+
]
36+
2237
include_all_blocks: bool
2338
"""
2439
If set to True, all expired and depleted blocks, as well as active block will be

src/orb/types/customers/credit_list_response.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import Dict, List, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

@@ -35,6 +35,14 @@ class CreditListResponse(BaseModel):
3535

3636
maximum_initial_balance: Optional[float] = None
3737

38+
metadata: Dict[str, str]
39+
"""User specified key-value pairs for the resource.
40+
41+
If not present, this defaults to an empty dictionary. Individual keys can be
42+
removed by setting the value to `null`, and the entire metadata mapping can be
43+
cleared by setting `metadata` to `null`.
44+
"""
45+
3846
per_unit_cost_basis: Optional[str] = None
3947

4048
status: Literal["active", "pending_payment"]

tests/api_resources/customers/test_credits.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from orb import Orb, AsyncOrb
11+
from orb._utils import parse_datetime
1112
from tests.utils import assert_matches_type
1213
from orb.pagination import SyncPage, AsyncPage
1314
from orb.types.customers import (
@@ -34,6 +35,10 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
3435
customer_id="customer_id",
3536
currency="currency",
3637
cursor="cursor",
38+
effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
39+
effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
40+
effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
41+
effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
3742
include_all_blocks=True,
3843
limit=1,
3944
)
@@ -83,6 +88,10 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None:
8388
external_customer_id="external_customer_id",
8489
currency="currency",
8590
cursor="cursor",
91+
effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
92+
effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
93+
effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
94+
effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
8695
include_all_blocks=True,
8796
limit=1,
8897
)
@@ -138,6 +147,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
138147
customer_id="customer_id",
139148
currency="currency",
140149
cursor="cursor",
150+
effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
151+
effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
152+
effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
153+
effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
141154
include_all_blocks=True,
142155
limit=1,
143156
)
@@ -187,6 +200,10 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As
187200
external_customer_id="external_customer_id",
188201
currency="currency",
189202
cursor="cursor",
203+
effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
204+
effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
205+
effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
206+
effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
190207
include_all_blocks=True,
191208
limit=1,
192209
)

0 commit comments

Comments
 (0)