Skip to content

Commit 10d67cd

Browse files
feat: add projects billing fields list methods (#621)
* SDK regeneration * test: add unit tests for projects billing fields list methods - Add comprehensive unit tests for ListBillingFieldsV1Response model - Test model validation with full, minimal, and empty data scenarios - Test individual fields: accessors, deployments, tags, line_items - Test serialization, deserialization, and immutability - Test edge cases: large datasets, special characters, unicode - Test deployment types and integration scenarios - 26 passing tests with full coverage of billing fields endpoint --------- Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Luke Oliff <luke@lukeoliff.com>
1 parent 876fc73 commit 10d67cd

File tree

13 files changed

+1000
-2
lines changed

13 files changed

+1000
-2
lines changed

reference.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,6 +2912,93 @@ client.manage.v1.projects.billing.breakdown.list(
29122912
</dl>
29132913

29142914

2915+
</dd>
2916+
</dl>
2917+
</details>
2918+
2919+
## Manage V1 Projects Billing Fields
2920+
<details><summary><code>client.manage.v1.projects.billing.fields.<a href="src/deepgram/manage/v1/projects/billing/fields/client.py">list</a>(...)</code></summary>
2921+
<dl>
2922+
<dd>
2923+
2924+
#### 📝 Description
2925+
2926+
<dl>
2927+
<dd>
2928+
2929+
<dl>
2930+
<dd>
2931+
2932+
Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available.
2933+
</dd>
2934+
</dl>
2935+
</dd>
2936+
</dl>
2937+
2938+
#### 🔌 Usage
2939+
2940+
<dl>
2941+
<dd>
2942+
2943+
<dl>
2944+
<dd>
2945+
2946+
```python
2947+
from deepgram import DeepgramClient
2948+
2949+
client = DeepgramClient(
2950+
api_key="YOUR_API_KEY",
2951+
)
2952+
client.manage.v1.projects.billing.fields.list(
2953+
project_id="123456-7890-1234-5678-901234",
2954+
)
2955+
2956+
```
2957+
</dd>
2958+
</dl>
2959+
</dd>
2960+
</dl>
2961+
2962+
#### ⚙️ Parameters
2963+
2964+
<dl>
2965+
<dd>
2966+
2967+
<dl>
2968+
<dd>
2969+
2970+
**project_id:** `str` — The unique identifier of the project
2971+
2972+
</dd>
2973+
</dl>
2974+
2975+
<dl>
2976+
<dd>
2977+
2978+
**start:** `typing.Optional[str]` — Start date of the requested date range. Format accepted is YYYY-MM-DD
2979+
2980+
</dd>
2981+
</dl>
2982+
2983+
<dl>
2984+
<dd>
2985+
2986+
**end:** `typing.Optional[str]` — End date of the requested date range. Format accepted is YYYY-MM-DD
2987+
2988+
</dd>
2989+
</dl>
2990+
2991+
<dl>
2992+
<dd>
2993+
2994+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
2995+
2996+
</dd>
2997+
</dl>
2998+
</dd>
2999+
</dl>
3000+
3001+
29153002
</dd>
29163003
</dl>
29173004
</details>

src/deepgram/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
GetProjectV1Response,
5252
GrantV1Response,
5353
LeaveProjectV1Response,
54+
ListBillingFieldsV1Response,
55+
ListBillingFieldsV1ResponseDeploymentsItem,
5456
ListModelsV1Response,
5557
ListModelsV1ResponseSttModels,
5658
ListModelsV1ResponseTtsModels,
@@ -223,6 +225,7 @@
223225
GetProjectV1ResponseParams,
224226
GrantV1ResponseParams,
225227
LeaveProjectV1ResponseParams,
228+
ListBillingFieldsV1ResponseParams,
226229
ListModelsV1ResponseParams,
227230
ListModelsV1ResponseSttModelsParams,
228231
ListModelsV1ResponseTtsModelsMetadataParams,
@@ -399,6 +402,9 @@
399402
"GrantV1ResponseParams": ".requests",
400403
"LeaveProjectV1Response": ".types",
401404
"LeaveProjectV1ResponseParams": ".requests",
405+
"ListBillingFieldsV1Response": ".types",
406+
"ListBillingFieldsV1ResponseDeploymentsItem": ".types",
407+
"ListBillingFieldsV1ResponseParams": ".requests",
402408
"ListModelsV1Response": ".types",
403409
"ListModelsV1ResponseParams": ".requests",
404410
"ListModelsV1ResponseSttModels": ".types",
@@ -732,6 +738,9 @@ def __dir__():
732738
"GrantV1ResponseParams",
733739
"LeaveProjectV1Response",
734740
"LeaveProjectV1ResponseParams",
741+
"ListBillingFieldsV1Response",
742+
"ListBillingFieldsV1ResponseDeploymentsItem",
743+
"ListBillingFieldsV1ResponseParams",
735744
"ListModelsV1Response",
736745
"ListModelsV1ResponseParams",
737746
"ListModelsV1ResponseSttModels",

src/deepgram/manage/v1/projects/billing/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
from importlib import import_module
77

88
if typing.TYPE_CHECKING:
9-
from . import balances, breakdown, purchases
9+
from . import balances, breakdown, fields, purchases
1010
from .breakdown import BreakdownListRequestDeployment, BreakdownListRequestGroupingItem
1111
_dynamic_imports: typing.Dict[str, str] = {
1212
"BreakdownListRequestDeployment": ".breakdown",
1313
"BreakdownListRequestGroupingItem": ".breakdown",
1414
"balances": ".balances",
1515
"breakdown": ".breakdown",
16+
"fields": ".fields",
1617
"purchases": ".purchases",
1718
}
1819

@@ -38,4 +39,11 @@ def __dir__():
3839
return sorted(lazy_attrs)
3940

4041

41-
__all__ = ["BreakdownListRequestDeployment", "BreakdownListRequestGroupingItem", "balances", "breakdown", "purchases"]
42+
__all__ = [
43+
"BreakdownListRequestDeployment",
44+
"BreakdownListRequestGroupingItem",
45+
"balances",
46+
"breakdown",
47+
"fields",
48+
"purchases",
49+
]

src/deepgram/manage/v1/projects/billing/client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
if typing.TYPE_CHECKING:
1111
from .balances.client import AsyncBalancesClient, BalancesClient
1212
from .breakdown.client import AsyncBreakdownClient, BreakdownClient
13+
from .fields.client import AsyncFieldsClient, FieldsClient
1314
from .purchases.client import AsyncPurchasesClient, PurchasesClient
1415

1516

@@ -19,6 +20,7 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):
1920
self._client_wrapper = client_wrapper
2021
self._balances: typing.Optional[BalancesClient] = None
2122
self._breakdown: typing.Optional[BreakdownClient] = None
23+
self._fields: typing.Optional[FieldsClient] = None
2224
self._purchases: typing.Optional[PurchasesClient] = None
2325

2426
@property
@@ -48,6 +50,14 @@ def breakdown(self):
4850
self._breakdown = BreakdownClient(client_wrapper=self._client_wrapper)
4951
return self._breakdown
5052

53+
@property
54+
def fields(self):
55+
if self._fields is None:
56+
from .fields.client import FieldsClient # noqa: E402
57+
58+
self._fields = FieldsClient(client_wrapper=self._client_wrapper)
59+
return self._fields
60+
5161
@property
5262
def purchases(self):
5363
if self._purchases is None:
@@ -63,6 +73,7 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):
6373
self._client_wrapper = client_wrapper
6474
self._balances: typing.Optional[AsyncBalancesClient] = None
6575
self._breakdown: typing.Optional[AsyncBreakdownClient] = None
76+
self._fields: typing.Optional[AsyncFieldsClient] = None
6677
self._purchases: typing.Optional[AsyncPurchasesClient] = None
6778

6879
@property
@@ -92,6 +103,14 @@ def breakdown(self):
92103
self._breakdown = AsyncBreakdownClient(client_wrapper=self._client_wrapper)
93104
return self._breakdown
94105

106+
@property
107+
def fields(self):
108+
if self._fields is None:
109+
from .fields.client import AsyncFieldsClient # noqa: E402
110+
111+
self._fields = AsyncFieldsClient(client_wrapper=self._client_wrapper)
112+
return self._fields
113+
95114
@property
96115
def purchases(self):
97116
if self._purchases is None:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
# isort: skip_file
4+
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
from ......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6+
from ......core.request_options import RequestOptions
7+
from ......types.list_billing_fields_v1response import ListBillingFieldsV1Response
8+
from .raw_client import AsyncRawFieldsClient, RawFieldsClient
9+
10+
11+
class FieldsClient:
12+
def __init__(self, *, client_wrapper: SyncClientWrapper):
13+
self._raw_client = RawFieldsClient(client_wrapper=client_wrapper)
14+
15+
@property
16+
def with_raw_response(self) -> RawFieldsClient:
17+
"""
18+
Retrieves a raw implementation of this client that returns raw responses.
19+
20+
Returns
21+
-------
22+
RawFieldsClient
23+
"""
24+
return self._raw_client
25+
26+
def list(
27+
self,
28+
project_id: str,
29+
*,
30+
start: typing.Optional[str] = None,
31+
end: typing.Optional[str] = None,
32+
request_options: typing.Optional[RequestOptions] = None,
33+
) -> ListBillingFieldsV1Response:
34+
"""
35+
Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available.
36+
37+
Parameters
38+
----------
39+
project_id : str
40+
The unique identifier of the project
41+
42+
start : typing.Optional[str]
43+
Start date of the requested date range. Format accepted is YYYY-MM-DD
44+
45+
end : typing.Optional[str]
46+
End date of the requested date range. Format accepted is YYYY-MM-DD
47+
48+
request_options : typing.Optional[RequestOptions]
49+
Request-specific configuration.
50+
51+
Returns
52+
-------
53+
ListBillingFieldsV1Response
54+
A list of billing fields for a specific project
55+
56+
Examples
57+
--------
58+
from deepgram import DeepgramClient
59+
60+
client = DeepgramClient(
61+
api_key="YOUR_API_KEY",
62+
)
63+
client.manage.v1.projects.billing.fields.list(
64+
project_id="123456-7890-1234-5678-901234",
65+
)
66+
"""
67+
_response = self._raw_client.list(project_id, start=start, end=end, request_options=request_options)
68+
return _response.data
69+
70+
71+
class AsyncFieldsClient:
72+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
73+
self._raw_client = AsyncRawFieldsClient(client_wrapper=client_wrapper)
74+
75+
@property
76+
def with_raw_response(self) -> AsyncRawFieldsClient:
77+
"""
78+
Retrieves a raw implementation of this client that returns raw responses.
79+
80+
Returns
81+
-------
82+
AsyncRawFieldsClient
83+
"""
84+
return self._raw_client
85+
86+
async def list(
87+
self,
88+
project_id: str,
89+
*,
90+
start: typing.Optional[str] = None,
91+
end: typing.Optional[str] = None,
92+
request_options: typing.Optional[RequestOptions] = None,
93+
) -> ListBillingFieldsV1Response:
94+
"""
95+
Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available.
96+
97+
Parameters
98+
----------
99+
project_id : str
100+
The unique identifier of the project
101+
102+
start : typing.Optional[str]
103+
Start date of the requested date range. Format accepted is YYYY-MM-DD
104+
105+
end : typing.Optional[str]
106+
End date of the requested date range. Format accepted is YYYY-MM-DD
107+
108+
request_options : typing.Optional[RequestOptions]
109+
Request-specific configuration.
110+
111+
Returns
112+
-------
113+
ListBillingFieldsV1Response
114+
A list of billing fields for a specific project
115+
116+
Examples
117+
--------
118+
import asyncio
119+
120+
from deepgram import AsyncDeepgramClient
121+
122+
client = AsyncDeepgramClient(
123+
api_key="YOUR_API_KEY",
124+
)
125+
126+
127+
async def main() -> None:
128+
await client.manage.v1.projects.billing.fields.list(
129+
project_id="123456-7890-1234-5678-901234",
130+
)
131+
132+
133+
asyncio.run(main())
134+
"""
135+
_response = await self._raw_client.list(project_id, start=start, end=end, request_options=request_options)
136+
return _response.data

0 commit comments

Comments
 (0)