Skip to content

Commit 1efff31

Browse files
feat(api): add new endpoints (#43)
1 parent 0907089 commit 1efff31

26 files changed

+1535
-35
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 29
1+
configured_endpoints: 34

api.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,57 @@ from codex.types.organizations import (
3737

3838
Methods:
3939

40-
- <code title="get /api/organizations/{organization_id}/billing/invoices">client.organizations.billing.<a href="./src/codex/resources/organizations/billing.py">invoices</a>(organization_id) -> <a href="./src/codex/types/organizations/organization_billing_invoices_schema.py">OrganizationBillingInvoicesSchema</a></code>
41-
- <code title="get /api/organizations/{organization_id}/billing/usage">client.organizations.billing.<a href="./src/codex/resources/organizations/billing.py">usage</a>(organization_id) -> <a href="./src/codex/types/organizations/organization_billing_usage_schema.py">OrganizationBillingUsageSchema</a></code>
40+
- <code title="get /api/organizations/{organization_id}/billing/invoices">client.organizations.billing.<a href="./src/codex/resources/organizations/billing/billing.py">invoices</a>(organization_id) -> <a href="./src/codex/types/organizations/organization_billing_invoices_schema.py">OrganizationBillingInvoicesSchema</a></code>
41+
- <code title="get /api/organizations/{organization_id}/billing/usage">client.organizations.billing.<a href="./src/codex/resources/organizations/billing/billing.py">usage</a>(organization_id) -> <a href="./src/codex/types/organizations/organization_billing_usage_schema.py">OrganizationBillingUsageSchema</a></code>
42+
43+
### CardDetails
44+
45+
Types:
46+
47+
```python
48+
from codex.types.organizations.billing import OrganizationBillingCardDetails
49+
```
50+
51+
Methods:
52+
53+
- <code title="get /api/organizations/{organization_id}/billing/card-details">client.organizations.billing.card_details.<a href="./src/codex/resources/organizations/billing/card_details.py">retrieve</a>(organization_id) -> <a href="./src/codex/types/organizations/billing/organization_billing_card_details.py">Optional[OrganizationBillingCardDetails]</a></code>
54+
55+
### SetupIntent
56+
57+
Types:
58+
59+
```python
60+
from codex.types.organizations.billing import OrganizationBillingSetupIntent
61+
```
62+
63+
Methods:
64+
65+
- <code title="post /api/organizations/{organization_id}/billing/setup-intent">client.organizations.billing.setup_intent.<a href="./src/codex/resources/organizations/billing/setup_intent.py">create</a>(organization_id) -> <a href="./src/codex/types/organizations/billing/organization_billing_setup_intent.py">OrganizationBillingSetupIntent</a></code>
66+
67+
### PlanDetails
68+
69+
Types:
70+
71+
```python
72+
from codex.types.organizations.billing import OrganizationBillingPlanDetails
73+
```
74+
75+
Methods:
76+
77+
- <code title="get /api/organizations/{organization_id}/billing/plan-details">client.organizations.billing.plan_details.<a href="./src/codex/resources/organizations/billing/plan_details.py">retrieve</a>(organization_id) -> <a href="./src/codex/types/organizations/billing/organization_billing_plan_details.py">OrganizationBillingPlanDetails</a></code>
4278

4379
# Users
4480

81+
Types:
82+
83+
```python
84+
from codex.types import User
85+
```
86+
87+
Methods:
88+
89+
- <code title="patch /api/users/activate_account">client.users.<a href="./src/codex/resources/users/users.py">activate_account</a>(\*\*<a href="src/codex/types/user_activate_account_params.py">params</a>) -> <a href="./src/codex/types/user.py">User</a></code>
90+
4591
## Myself
4692

4793
Types:
@@ -52,12 +98,13 @@ from codex.types.users import UserSchema, UserSchemaPublic
5298

5399
Methods:
54100

55-
- <code title="get /api/users/myself">client.users.myself.<a href="./src/codex/resources/users/myself/myself.py">retrieve</a>() -> <a href="./src/codex/types/users/user_schema_public.py">UserSchemaPublic</a></code>
101+
- <code title="get /api/users/myself">client.users.myself.<a href="./src/codex/resources/users/myself/myself.py">retrieve</a>() -> <a href="./src/codex/types/user.py">User</a></code>
56102

57103
### APIKey
58104

59105
Methods:
60106

107+
- <code title="get /api/users/myself/api-key">client.users.myself.api_key.<a href="./src/codex/resources/users/myself/api_key.py">retrieve</a>() -> <a href="./src/codex/types/user.py">User</a></code>
61108
- <code title="post /api/users/myself/api-key/refresh">client.users.myself.api_key.<a href="./src/codex/resources/users/myself/api_key.py">refresh</a>() -> <a href="./src/codex/types/users/user_schema.py">UserSchema</a></code>
62109

63110
### Organizations
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .billing import (
4+
BillingResource,
5+
AsyncBillingResource,
6+
BillingResourceWithRawResponse,
7+
AsyncBillingResourceWithRawResponse,
8+
BillingResourceWithStreamingResponse,
9+
AsyncBillingResourceWithStreamingResponse,
10+
)
11+
from .card_details import (
12+
CardDetailsResource,
13+
AsyncCardDetailsResource,
14+
CardDetailsResourceWithRawResponse,
15+
AsyncCardDetailsResourceWithRawResponse,
16+
CardDetailsResourceWithStreamingResponse,
17+
AsyncCardDetailsResourceWithStreamingResponse,
18+
)
19+
from .plan_details import (
20+
PlanDetailsResource,
21+
AsyncPlanDetailsResource,
22+
PlanDetailsResourceWithRawResponse,
23+
AsyncPlanDetailsResourceWithRawResponse,
24+
PlanDetailsResourceWithStreamingResponse,
25+
AsyncPlanDetailsResourceWithStreamingResponse,
26+
)
27+
from .setup_intent import (
28+
SetupIntentResource,
29+
AsyncSetupIntentResource,
30+
SetupIntentResourceWithRawResponse,
31+
AsyncSetupIntentResourceWithRawResponse,
32+
SetupIntentResourceWithStreamingResponse,
33+
AsyncSetupIntentResourceWithStreamingResponse,
34+
)
35+
36+
__all__ = [
37+
"CardDetailsResource",
38+
"AsyncCardDetailsResource",
39+
"CardDetailsResourceWithRawResponse",
40+
"AsyncCardDetailsResourceWithRawResponse",
41+
"CardDetailsResourceWithStreamingResponse",
42+
"AsyncCardDetailsResourceWithStreamingResponse",
43+
"SetupIntentResource",
44+
"AsyncSetupIntentResource",
45+
"SetupIntentResourceWithRawResponse",
46+
"AsyncSetupIntentResourceWithRawResponse",
47+
"SetupIntentResourceWithStreamingResponse",
48+
"AsyncSetupIntentResourceWithStreamingResponse",
49+
"PlanDetailsResource",
50+
"AsyncPlanDetailsResource",
51+
"PlanDetailsResourceWithRawResponse",
52+
"AsyncPlanDetailsResourceWithRawResponse",
53+
"PlanDetailsResourceWithStreamingResponse",
54+
"AsyncPlanDetailsResourceWithStreamingResponse",
55+
"BillingResource",
56+
"AsyncBillingResource",
57+
"BillingResourceWithRawResponse",
58+
"AsyncBillingResourceWithRawResponse",
59+
"BillingResourceWithStreamingResponse",
60+
"AsyncBillingResourceWithStreamingResponse",
61+
]

src/codex/resources/organizations/billing.py renamed to src/codex/resources/organizations/billing/billing.py

Lines changed: 103 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,59 @@
44

55
import httpx
66

7-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
8-
from ..._compat import cached_property
9-
from ..._resource import SyncAPIResource, AsyncAPIResource
10-
from ..._response import (
7+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
8+
from ...._compat import cached_property
9+
from ...._resource import SyncAPIResource, AsyncAPIResource
10+
from ...._response import (
1111
to_raw_response_wrapper,
1212
to_streamed_response_wrapper,
1313
async_to_raw_response_wrapper,
1414
async_to_streamed_response_wrapper,
1515
)
16-
from ..._base_client import make_request_options
17-
from ...types.organizations.organization_billing_usage_schema import OrganizationBillingUsageSchema
18-
from ...types.organizations.organization_billing_invoices_schema import OrganizationBillingInvoicesSchema
16+
from .card_details import (
17+
CardDetailsResource,
18+
AsyncCardDetailsResource,
19+
CardDetailsResourceWithRawResponse,
20+
AsyncCardDetailsResourceWithRawResponse,
21+
CardDetailsResourceWithStreamingResponse,
22+
AsyncCardDetailsResourceWithStreamingResponse,
23+
)
24+
from .plan_details import (
25+
PlanDetailsResource,
26+
AsyncPlanDetailsResource,
27+
PlanDetailsResourceWithRawResponse,
28+
AsyncPlanDetailsResourceWithRawResponse,
29+
PlanDetailsResourceWithStreamingResponse,
30+
AsyncPlanDetailsResourceWithStreamingResponse,
31+
)
32+
from .setup_intent import (
33+
SetupIntentResource,
34+
AsyncSetupIntentResource,
35+
SetupIntentResourceWithRawResponse,
36+
AsyncSetupIntentResourceWithRawResponse,
37+
SetupIntentResourceWithStreamingResponse,
38+
AsyncSetupIntentResourceWithStreamingResponse,
39+
)
40+
from ...._base_client import make_request_options
41+
from ....types.organizations.organization_billing_usage_schema import OrganizationBillingUsageSchema
42+
from ....types.organizations.organization_billing_invoices_schema import OrganizationBillingInvoicesSchema
1943

2044
__all__ = ["BillingResource", "AsyncBillingResource"]
2145

2246

2347
class BillingResource(SyncAPIResource):
48+
@cached_property
49+
def card_details(self) -> CardDetailsResource:
50+
return CardDetailsResource(self._client)
51+
52+
@cached_property
53+
def setup_intent(self) -> SetupIntentResource:
54+
return SetupIntentResource(self._client)
55+
56+
@cached_property
57+
def plan_details(self) -> PlanDetailsResource:
58+
return PlanDetailsResource(self._client)
59+
2460
@cached_property
2561
def with_raw_response(self) -> BillingResourceWithRawResponse:
2662
"""
@@ -108,6 +144,18 @@ def usage(
108144

109145

110146
class AsyncBillingResource(AsyncAPIResource):
147+
@cached_property
148+
def card_details(self) -> AsyncCardDetailsResource:
149+
return AsyncCardDetailsResource(self._client)
150+
151+
@cached_property
152+
def setup_intent(self) -> AsyncSetupIntentResource:
153+
return AsyncSetupIntentResource(self._client)
154+
155+
@cached_property
156+
def plan_details(self) -> AsyncPlanDetailsResource:
157+
return AsyncPlanDetailsResource(self._client)
158+
111159
@cached_property
112160
def with_raw_response(self) -> AsyncBillingResourceWithRawResponse:
113161
"""
@@ -205,6 +253,18 @@ def __init__(self, billing: BillingResource) -> None:
205253
billing.usage,
206254
)
207255

256+
@cached_property
257+
def card_details(self) -> CardDetailsResourceWithRawResponse:
258+
return CardDetailsResourceWithRawResponse(self._billing.card_details)
259+
260+
@cached_property
261+
def setup_intent(self) -> SetupIntentResourceWithRawResponse:
262+
return SetupIntentResourceWithRawResponse(self._billing.setup_intent)
263+
264+
@cached_property
265+
def plan_details(self) -> PlanDetailsResourceWithRawResponse:
266+
return PlanDetailsResourceWithRawResponse(self._billing.plan_details)
267+
208268

209269
class AsyncBillingResourceWithRawResponse:
210270
def __init__(self, billing: AsyncBillingResource) -> None:
@@ -217,6 +277,18 @@ def __init__(self, billing: AsyncBillingResource) -> None:
217277
billing.usage,
218278
)
219279

280+
@cached_property
281+
def card_details(self) -> AsyncCardDetailsResourceWithRawResponse:
282+
return AsyncCardDetailsResourceWithRawResponse(self._billing.card_details)
283+
284+
@cached_property
285+
def setup_intent(self) -> AsyncSetupIntentResourceWithRawResponse:
286+
return AsyncSetupIntentResourceWithRawResponse(self._billing.setup_intent)
287+
288+
@cached_property
289+
def plan_details(self) -> AsyncPlanDetailsResourceWithRawResponse:
290+
return AsyncPlanDetailsResourceWithRawResponse(self._billing.plan_details)
291+
220292

221293
class BillingResourceWithStreamingResponse:
222294
def __init__(self, billing: BillingResource) -> None:
@@ -229,6 +301,18 @@ def __init__(self, billing: BillingResource) -> None:
229301
billing.usage,
230302
)
231303

304+
@cached_property
305+
def card_details(self) -> CardDetailsResourceWithStreamingResponse:
306+
return CardDetailsResourceWithStreamingResponse(self._billing.card_details)
307+
308+
@cached_property
309+
def setup_intent(self) -> SetupIntentResourceWithStreamingResponse:
310+
return SetupIntentResourceWithStreamingResponse(self._billing.setup_intent)
311+
312+
@cached_property
313+
def plan_details(self) -> PlanDetailsResourceWithStreamingResponse:
314+
return PlanDetailsResourceWithStreamingResponse(self._billing.plan_details)
315+
232316

233317
class AsyncBillingResourceWithStreamingResponse:
234318
def __init__(self, billing: AsyncBillingResource) -> None:
@@ -240,3 +324,15 @@ def __init__(self, billing: AsyncBillingResource) -> None:
240324
self.usage = async_to_streamed_response_wrapper(
241325
billing.usage,
242326
)
327+
328+
@cached_property
329+
def card_details(self) -> AsyncCardDetailsResourceWithStreamingResponse:
330+
return AsyncCardDetailsResourceWithStreamingResponse(self._billing.card_details)
331+
332+
@cached_property
333+
def setup_intent(self) -> AsyncSetupIntentResourceWithStreamingResponse:
334+
return AsyncSetupIntentResourceWithStreamingResponse(self._billing.setup_intent)
335+
336+
@cached_property
337+
def plan_details(self) -> AsyncPlanDetailsResourceWithStreamingResponse:
338+
return AsyncPlanDetailsResourceWithStreamingResponse(self._billing.plan_details)

0 commit comments

Comments
 (0)