Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 29
configured_endpoints: 34
53 changes: 50 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,57 @@ from codex.types.organizations import (

Methods:

- <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>
- <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>
- <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>
- <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>

### CardDetails

Types:

```python
from codex.types.organizations.billing import OrganizationBillingCardDetails
```

Methods:

- <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>

### SetupIntent

Types:

```python
from codex.types.organizations.billing import OrganizationBillingSetupIntent
```

Methods:

- <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>

### PlanDetails

Types:

```python
from codex.types.organizations.billing import OrganizationBillingPlanDetails
```

Methods:

- <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>

# Users

Types:

```python
from codex.types import User
```

Methods:

- <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>

## Myself

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

Methods:

- <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>
- <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>

### APIKey

Methods:

- <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>
- <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>

### Organizations
Expand Down
61 changes: 61 additions & 0 deletions src/codex/resources/organizations/billing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .billing import (
BillingResource,
AsyncBillingResource,
BillingResourceWithRawResponse,
AsyncBillingResourceWithRawResponse,
BillingResourceWithStreamingResponse,
AsyncBillingResourceWithStreamingResponse,
)
from .card_details import (
CardDetailsResource,
AsyncCardDetailsResource,
CardDetailsResourceWithRawResponse,
AsyncCardDetailsResourceWithRawResponse,
CardDetailsResourceWithStreamingResponse,
AsyncCardDetailsResourceWithStreamingResponse,
)
from .plan_details import (
PlanDetailsResource,
AsyncPlanDetailsResource,
PlanDetailsResourceWithRawResponse,
AsyncPlanDetailsResourceWithRawResponse,
PlanDetailsResourceWithStreamingResponse,
AsyncPlanDetailsResourceWithStreamingResponse,
)
from .setup_intent import (
SetupIntentResource,
AsyncSetupIntentResource,
SetupIntentResourceWithRawResponse,
AsyncSetupIntentResourceWithRawResponse,
SetupIntentResourceWithStreamingResponse,
AsyncSetupIntentResourceWithStreamingResponse,
)

__all__ = [
"CardDetailsResource",
"AsyncCardDetailsResource",
"CardDetailsResourceWithRawResponse",
"AsyncCardDetailsResourceWithRawResponse",
"CardDetailsResourceWithStreamingResponse",
"AsyncCardDetailsResourceWithStreamingResponse",
"SetupIntentResource",
"AsyncSetupIntentResource",
"SetupIntentResourceWithRawResponse",
"AsyncSetupIntentResourceWithRawResponse",
"SetupIntentResourceWithStreamingResponse",
"AsyncSetupIntentResourceWithStreamingResponse",
"PlanDetailsResource",
"AsyncPlanDetailsResource",
"PlanDetailsResourceWithRawResponse",
"AsyncPlanDetailsResourceWithRawResponse",
"PlanDetailsResourceWithStreamingResponse",
"AsyncPlanDetailsResourceWithStreamingResponse",
"BillingResource",
"AsyncBillingResource",
"BillingResourceWithRawResponse",
"AsyncBillingResourceWithRawResponse",
"BillingResourceWithStreamingResponse",
"AsyncBillingResourceWithStreamingResponse",
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,59 @@

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options
from ...types.organizations.organization_billing_usage_schema import OrganizationBillingUsageSchema
from ...types.organizations.organization_billing_invoices_schema import OrganizationBillingInvoicesSchema
from .card_details import (
CardDetailsResource,
AsyncCardDetailsResource,
CardDetailsResourceWithRawResponse,
AsyncCardDetailsResourceWithRawResponse,
CardDetailsResourceWithStreamingResponse,
AsyncCardDetailsResourceWithStreamingResponse,
)
from .plan_details import (
PlanDetailsResource,
AsyncPlanDetailsResource,
PlanDetailsResourceWithRawResponse,
AsyncPlanDetailsResourceWithRawResponse,
PlanDetailsResourceWithStreamingResponse,
AsyncPlanDetailsResourceWithStreamingResponse,
)
from .setup_intent import (
SetupIntentResource,
AsyncSetupIntentResource,
SetupIntentResourceWithRawResponse,
AsyncSetupIntentResourceWithRawResponse,
SetupIntentResourceWithStreamingResponse,
AsyncSetupIntentResourceWithStreamingResponse,
)
from ...._base_client import make_request_options
from ....types.organizations.organization_billing_usage_schema import OrganizationBillingUsageSchema
from ....types.organizations.organization_billing_invoices_schema import OrganizationBillingInvoicesSchema

__all__ = ["BillingResource", "AsyncBillingResource"]


class BillingResource(SyncAPIResource):
@cached_property
def card_details(self) -> CardDetailsResource:
return CardDetailsResource(self._client)

@cached_property
def setup_intent(self) -> SetupIntentResource:
return SetupIntentResource(self._client)

@cached_property
def plan_details(self) -> PlanDetailsResource:
return PlanDetailsResource(self._client)

@cached_property
def with_raw_response(self) -> BillingResourceWithRawResponse:
"""
Expand Down Expand Up @@ -108,6 +144,18 @@ def usage(


class AsyncBillingResource(AsyncAPIResource):
@cached_property
def card_details(self) -> AsyncCardDetailsResource:
return AsyncCardDetailsResource(self._client)

@cached_property
def setup_intent(self) -> AsyncSetupIntentResource:
return AsyncSetupIntentResource(self._client)

@cached_property
def plan_details(self) -> AsyncPlanDetailsResource:
return AsyncPlanDetailsResource(self._client)

@cached_property
def with_raw_response(self) -> AsyncBillingResourceWithRawResponse:
"""
Expand Down Expand Up @@ -205,6 +253,18 @@ def __init__(self, billing: BillingResource) -> None:
billing.usage,
)

@cached_property
def card_details(self) -> CardDetailsResourceWithRawResponse:
return CardDetailsResourceWithRawResponse(self._billing.card_details)

@cached_property
def setup_intent(self) -> SetupIntentResourceWithRawResponse:
return SetupIntentResourceWithRawResponse(self._billing.setup_intent)

@cached_property
def plan_details(self) -> PlanDetailsResourceWithRawResponse:
return PlanDetailsResourceWithRawResponse(self._billing.plan_details)


class AsyncBillingResourceWithRawResponse:
def __init__(self, billing: AsyncBillingResource) -> None:
Expand All @@ -217,6 +277,18 @@ def __init__(self, billing: AsyncBillingResource) -> None:
billing.usage,
)

@cached_property
def card_details(self) -> AsyncCardDetailsResourceWithRawResponse:
return AsyncCardDetailsResourceWithRawResponse(self._billing.card_details)

@cached_property
def setup_intent(self) -> AsyncSetupIntentResourceWithRawResponse:
return AsyncSetupIntentResourceWithRawResponse(self._billing.setup_intent)

@cached_property
def plan_details(self) -> AsyncPlanDetailsResourceWithRawResponse:
return AsyncPlanDetailsResourceWithRawResponse(self._billing.plan_details)


class BillingResourceWithStreamingResponse:
def __init__(self, billing: BillingResource) -> None:
Expand All @@ -229,6 +301,18 @@ def __init__(self, billing: BillingResource) -> None:
billing.usage,
)

@cached_property
def card_details(self) -> CardDetailsResourceWithStreamingResponse:
return CardDetailsResourceWithStreamingResponse(self._billing.card_details)

@cached_property
def setup_intent(self) -> SetupIntentResourceWithStreamingResponse:
return SetupIntentResourceWithStreamingResponse(self._billing.setup_intent)

@cached_property
def plan_details(self) -> PlanDetailsResourceWithStreamingResponse:
return PlanDetailsResourceWithStreamingResponse(self._billing.plan_details)


class AsyncBillingResourceWithStreamingResponse:
def __init__(self, billing: AsyncBillingResource) -> None:
Expand All @@ -240,3 +324,15 @@ def __init__(self, billing: AsyncBillingResource) -> None:
self.usage = async_to_streamed_response_wrapper(
billing.usage,
)

@cached_property
def card_details(self) -> AsyncCardDetailsResourceWithStreamingResponse:
return AsyncCardDetailsResourceWithStreamingResponse(self._billing.card_details)

@cached_property
def setup_intent(self) -> AsyncSetupIntentResourceWithStreamingResponse:
return AsyncSetupIntentResourceWithStreamingResponse(self._billing.setup_intent)

@cached_property
def plan_details(self) -> AsyncPlanDetailsResourceWithStreamingResponse:
return AsyncPlanDetailsResourceWithStreamingResponse(self._billing.plan_details)
Loading