diff --git a/.fern/metadata.json b/.fern/metadata.json
index d6ba897..ace9110 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -23,6 +23,6 @@
}
]
},
- "originGitCommit": "c7ae462826a6e814bff92fd1ae9fc8c18b8359ba",
- "sdkVersion": "1.2.5"
+ "originGitCommit": "deb8532a1f84f6daa08b5c611a66a5ec92f53f0e",
+ "sdkVersion": "1.2.6"
}
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 900d0e3..3a7d35a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ dynamic = ["version"]
[tool.poetry]
name = "schematichq"
-version = "1.2.5"
+version = "1.2.6"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index decafbd..f8d39e9 100644
--- a/reference.md
+++ b/reference.md
@@ -1670,6 +1670,124 @@ client.billing.upsert_billing_coupon(
+
+
+
+
+client.billing.delete_billing_coupon(...) -> DeleteBillingCouponResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from schematic import Schematic
+from schematic.environment import SchematicEnvironment
+
+client = Schematic(
+ api_key="",
+ environment=SchematicEnvironment.DEFAULT,
+)
+
+client.billing.delete_billing_coupon(
+ billing_id="billing_id",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `str` — billing_id
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.billing.delete_billing_customer(...) -> DeleteBillingCustomerResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from schematic import Schematic
+from schematic.environment import SchematicEnvironment
+
+client = Schematic(
+ api_key="",
+ environment=SchematicEnvironment.DEFAULT,
+)
+
+client.billing.delete_billing_customer(
+ billing_id="billing_id",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `str` — billing_id
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
@@ -2250,6 +2368,65 @@ client.billing.upsert_invoice(
+
+
+
+
+client.billing.delete_billing_invoice(...) -> DeleteBillingInvoiceResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from schematic import Schematic
+from schematic.environment import SchematicEnvironment
+
+client = Schematic(
+ api_key="",
+ environment=SchematicEnvironment.DEFAULT,
+)
+
+client.billing.delete_billing_invoice(
+ billing_id="billing_id",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `str` — billing_id
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
@@ -7110,6 +7287,14 @@ client.checkout.get_checkout_data(
-
+**currency:** `typing.Optional[str]`
+
+
+
+
+
+-
+
**selected_plan_id:** `typing.Optional[str]`
@@ -15238,6 +15423,14 @@ client.plans.publish_plan_version(
-
+**coupon_external_id:** `typing.Optional[str]`
+
+
+
+
+
+-
+
**customer_email:** `typing.Optional[str]`
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py
index 1072af4..25b656f 100644
--- a/src/schematic/__init__.py
+++ b/src/schematic/__init__.py
@@ -450,6 +450,9 @@
CountBillingProductsResponse,
CountCustomersParams,
CountCustomersResponse,
+ DeleteBillingCouponResponse,
+ DeleteBillingCustomerResponse,
+ DeleteBillingInvoiceResponse,
DeleteBillingProductResponse,
DeletePaymentMethodByExternalIdResponse,
DeleteProductPriceResponse,
@@ -1023,6 +1026,9 @@
"DataExportType": ".types",
"DatastreamCompanyPlan": ".types",
"DeleteApiKeyResponse": ".accounts",
+ "DeleteBillingCouponResponse": ".billing",
+ "DeleteBillingCustomerResponse": ".billing",
+ "DeleteBillingInvoiceResponse": ".billing",
"DeleteBillingPlanCreditGrantParams": ".credits",
"DeleteBillingPlanCreditGrantRequestBody": ".types",
"DeleteBillingPlanCreditGrantResponse": ".credits",
@@ -1787,6 +1793,9 @@ def __dir__():
"DataExportType",
"DatastreamCompanyPlan",
"DeleteApiKeyResponse",
+ "DeleteBillingCouponResponse",
+ "DeleteBillingCustomerResponse",
+ "DeleteBillingInvoiceResponse",
"DeleteBillingPlanCreditGrantParams",
"DeleteBillingPlanCreditGrantRequestBody",
"DeleteBillingPlanCreditGrantResponse",
diff --git a/src/schematic/billing/__init__.py b/src/schematic/billing/__init__.py
index e983952..08537a0 100644
--- a/src/schematic/billing/__init__.py
+++ b/src/schematic/billing/__init__.py
@@ -11,6 +11,9 @@
CountBillingProductsResponse,
CountCustomersParams,
CountCustomersResponse,
+ DeleteBillingCouponResponse,
+ DeleteBillingCustomerResponse,
+ DeleteBillingInvoiceResponse,
DeleteBillingProductResponse,
DeletePaymentMethodByExternalIdResponse,
DeleteProductPriceResponse,
@@ -44,6 +47,9 @@
"CountBillingProductsResponse": ".types",
"CountCustomersParams": ".types",
"CountCustomersResponse": ".types",
+ "DeleteBillingCouponResponse": ".types",
+ "DeleteBillingCustomerResponse": ".types",
+ "DeleteBillingInvoiceResponse": ".types",
"DeleteBillingProductResponse": ".types",
"DeletePaymentMethodByExternalIdResponse": ".types",
"DeleteProductPriceResponse": ".types",
@@ -100,6 +106,9 @@ def __dir__():
"CountBillingProductsResponse",
"CountCustomersParams",
"CountCustomersResponse",
+ "DeleteBillingCouponResponse",
+ "DeleteBillingCustomerResponse",
+ "DeleteBillingInvoiceResponse",
"DeleteBillingProductResponse",
"DeletePaymentMethodByExternalIdResponse",
"DeleteProductPriceResponse",
diff --git a/src/schematic/billing/client.py b/src/schematic/billing/client.py
index 28cadde..1b732ef 100644
--- a/src/schematic/billing/client.py
+++ b/src/schematic/billing/client.py
@@ -17,6 +17,9 @@
from .raw_client import AsyncRawBillingClient, RawBillingClient
from .types.count_billing_products_response import CountBillingProductsResponse
from .types.count_customers_response import CountCustomersResponse
+from .types.delete_billing_coupon_response import DeleteBillingCouponResponse
+from .types.delete_billing_customer_response import DeleteBillingCustomerResponse
+from .types.delete_billing_invoice_response import DeleteBillingInvoiceResponse
from .types.delete_billing_product_response import DeleteBillingProductResponse
from .types.delete_payment_method_by_external_id_response import DeletePaymentMethodByExternalIdResponse
from .types.delete_product_price_response import DeleteProductPriceResponse
@@ -180,6 +183,68 @@ def upsert_billing_coupon(
)
return _response.data
+ def delete_billing_coupon(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingCouponResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingCouponResponse
+ OK
+
+ Examples
+ --------
+ from schematic import Schematic
+
+ client = Schematic(
+ api_key="YOUR_API_KEY",
+ )
+ client.billing.delete_billing_coupon(
+ billing_id="billing_id",
+ )
+ """
+ _response = self._raw_client.delete_billing_coupon(billing_id, request_options=request_options)
+ return _response.data
+
+ def delete_billing_customer(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingCustomerResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingCustomerResponse
+ OK
+
+ Examples
+ --------
+ from schematic import Schematic
+
+ client = Schematic(
+ api_key="YOUR_API_KEY",
+ )
+ client.billing.delete_billing_customer(
+ billing_id="billing_id",
+ )
+ """
+ _response = self._raw_client.delete_billing_customer(billing_id, request_options=request_options)
+ return _response.data
+
def upsert_billing_customer(
self,
*,
@@ -517,6 +582,37 @@ def upsert_invoice(
)
return _response.data
+ def delete_billing_invoice(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingInvoiceResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingInvoiceResponse
+ OK
+
+ Examples
+ --------
+ from schematic import Schematic
+
+ client = Schematic(
+ api_key="YOUR_API_KEY",
+ )
+ client.billing.delete_billing_invoice(
+ billing_id="billing_id",
+ )
+ """
+ _response = self._raw_client.delete_billing_invoice(billing_id, request_options=request_options)
+ return _response.data
+
def list_meters(
self,
*,
@@ -1769,6 +1865,84 @@ async def main() -> None:
)
return _response.data
+ async def delete_billing_coupon(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingCouponResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingCouponResponse
+ OK
+
+ Examples
+ --------
+ import asyncio
+
+ from schematic import AsyncSchematic
+
+ client = AsyncSchematic(
+ api_key="YOUR_API_KEY",
+ )
+
+
+ async def main() -> None:
+ await client.billing.delete_billing_coupon(
+ billing_id="billing_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_billing_coupon(billing_id, request_options=request_options)
+ return _response.data
+
+ async def delete_billing_customer(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingCustomerResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingCustomerResponse
+ OK
+
+ Examples
+ --------
+ import asyncio
+
+ from schematic import AsyncSchematic
+
+ client = AsyncSchematic(
+ api_key="YOUR_API_KEY",
+ )
+
+
+ async def main() -> None:
+ await client.billing.delete_billing_customer(
+ billing_id="billing_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_billing_customer(billing_id, request_options=request_options)
+ return _response.data
+
async def upsert_billing_customer(
self,
*,
@@ -2146,6 +2320,45 @@ async def main() -> None:
)
return _response.data
+ async def delete_billing_invoice(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteBillingInvoiceResponse:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteBillingInvoiceResponse
+ OK
+
+ Examples
+ --------
+ import asyncio
+
+ from schematic import AsyncSchematic
+
+ client = AsyncSchematic(
+ api_key="YOUR_API_KEY",
+ )
+
+
+ async def main() -> None:
+ await client.billing.delete_billing_invoice(
+ billing_id="billing_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_billing_invoice(billing_id, request_options=request_options)
+ return _response.data
+
async def list_meters(
self,
*,
diff --git a/src/schematic/billing/raw_client.py b/src/schematic/billing/raw_client.py
index b485cdf..418abca 100644
--- a/src/schematic/billing/raw_client.py
+++ b/src/schematic/billing/raw_client.py
@@ -29,6 +29,9 @@
from ..types.invoice_status import InvoiceStatus
from .types.count_billing_products_response import CountBillingProductsResponse
from .types.count_customers_response import CountCustomersResponse
+from .types.delete_billing_coupon_response import DeleteBillingCouponResponse
+from .types.delete_billing_customer_response import DeleteBillingCustomerResponse
+from .types.delete_billing_invoice_response import DeleteBillingInvoiceResponse
from .types.delete_billing_product_response import DeleteBillingProductResponse
from .types.delete_payment_method_by_external_id_response import DeletePaymentMethodByExternalIdResponse
from .types.delete_product_price_response import DeleteProductPriceResponse
@@ -318,6 +321,206 @@ def upsert_billing_coupon(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
+ def delete_billing_coupon(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteBillingCouponResponse]:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteBillingCouponResponse]
+ OK
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"billing/coupons/{jsonable_encoder(billing_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteBillingCouponResponse,
+ parse_obj_as(
+ type_=DeleteBillingCouponResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
+ def delete_billing_customer(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteBillingCustomerResponse]:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[DeleteBillingCustomerResponse]
+ OK
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ f"billing/customer/{jsonable_encoder(billing_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteBillingCustomerResponse,
+ parse_obj_as(
+ type_=DeleteBillingCustomerResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
def upsert_billing_customer(
self,
*,
@@ -985,49 +1188,34 @@ def upsert_invoice(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
- def list_meters(
- self,
- *,
- display_name: typing.Optional[str] = None,
- limit: typing.Optional[int] = None,
- offset: typing.Optional[int] = None,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[ListMetersResponse]:
+ def delete_billing_invoice(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteBillingInvoiceResponse]:
"""
Parameters
----------
- display_name : typing.Optional[str]
-
- limit : typing.Optional[int]
- Page limit (default 100)
-
- offset : typing.Optional[int]
- Page offset (default 0)
+ billing_id : str
+ billing_id
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[ListMetersResponse]
+ HttpResponse[DeleteBillingInvoiceResponse]
OK
"""
_response = self._client_wrapper.httpx_client.request(
- "billing/meter",
- method="GET",
- params={
- "display_name": display_name,
- "limit": limit,
- "offset": offset,
- },
+ f"billing/invoices/{jsonable_encoder(billing_id)}",
+ method="DELETE",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- ListMetersResponse,
+ DeleteBillingInvoiceResponse,
parse_obj_as(
- type_=ListMetersResponse, # type: ignore
+ type_=DeleteBillingInvoiceResponse, # type: ignore
object_=_response.json(),
),
)
@@ -1100,47 +1288,162 @@ def list_meters(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
- def upsert_billing_meter(
+ def list_meters(
self,
*,
- display_name: str,
- event_name: str,
- event_payload_key: str,
- external_id: str,
- provider_type: typing.Optional[BillingProviderType] = OMIT,
+ display_name: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[UpsertBillingMeterResponse]:
+ ) -> HttpResponse[ListMetersResponse]:
"""
Parameters
----------
- display_name : str
-
- event_name : str
-
- event_payload_key : str
+ display_name : typing.Optional[str]
- external_id : str
+ limit : typing.Optional[int]
+ Page limit (default 100)
- provider_type : typing.Optional[BillingProviderType]
+ offset : typing.Optional[int]
+ Page offset (default 0)
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[UpsertBillingMeterResponse]
- Created
+ HttpResponse[ListMetersResponse]
+ OK
"""
_response = self._client_wrapper.httpx_client.request(
- "billing/meter/upsert",
- method="POST",
- json={
+ "billing/meter",
+ method="GET",
+ params={
"display_name": display_name,
- "event_name": event_name,
- "event_payload_key": event_payload_key,
- "external_id": external_id,
- "provider_type": provider_type,
- },
+ "limit": limit,
+ "offset": offset,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListMetersResponse,
+ parse_obj_as(
+ type_=ListMetersResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
+ def upsert_billing_meter(
+ self,
+ *,
+ display_name: str,
+ event_name: str,
+ event_payload_key: str,
+ external_id: str,
+ provider_type: typing.Optional[BillingProviderType] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpsertBillingMeterResponse]:
+ """
+ Parameters
+ ----------
+ display_name : str
+
+ event_name : str
+
+ event_payload_key : str
+
+ external_id : str
+
+ provider_type : typing.Optional[BillingProviderType]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertBillingMeterResponse]
+ Created
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "billing/meter/upsert",
+ method="POST",
+ json={
+ "display_name": display_name,
+ "event_name": event_name,
+ "event_payload_key": event_payload_key,
+ "external_id": external_id,
+ "provider_type": provider_type,
+ },
headers={
"content-type": "application/json",
},
@@ -2827,58 +3130,323 @@ def upsert_billing_subscription(
default_payment_method_id : typing.Optional[str]
- interval : typing.Optional[str]
+ interval : typing.Optional[str]
+
+ metadata : typing.Optional[typing.Dict[str, typing.Any]]
+
+ period_end : typing.Optional[int]
+
+ period_start : typing.Optional[int]
+
+ provider_type : typing.Optional[BillingProviderType]
+
+ status : typing.Optional[str]
+
+ trial_end : typing.Optional[int]
+
+ trial_end_setting : typing.Optional[BillingSubscriptionTrialEndSetting]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpsertBillingSubscriptionResponse]
+ Created
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "billing/subscription/upsert",
+ method="POST",
+ json={
+ "application_id": application_id,
+ "cancel_at": cancel_at,
+ "cancel_at_period_end": cancel_at_period_end,
+ "currency": currency,
+ "customer_external_id": customer_external_id,
+ "default_payment_method_external_id": default_payment_method_external_id,
+ "default_payment_method_id": default_payment_method_id,
+ "discounts": convert_and_respect_annotation_metadata(
+ object_=discounts, annotation=typing.Sequence[BillingSubscriptionDiscount], direction="write"
+ ),
+ "expired_at": expired_at,
+ "interval": interval,
+ "metadata": metadata,
+ "period_end": period_end,
+ "period_start": period_start,
+ "product_external_ids": convert_and_respect_annotation_metadata(
+ object_=product_external_ids, annotation=typing.Sequence[BillingProductPricing], direction="write"
+ ),
+ "provider_type": provider_type,
+ "status": status,
+ "subscription_external_id": subscription_external_id,
+ "total_price": total_price,
+ "trial_end": trial_end,
+ "trial_end_setting": trial_end_setting,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpsertBillingSubscriptionResponse,
+ parse_obj_as(
+ type_=UpsertBillingSubscriptionResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
+
+class AsyncRawBillingClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list_coupons(
+ self,
+ *,
+ is_active: typing.Optional[bool] = None,
+ q: typing.Optional[str] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ListCouponsResponse]:
+ """
+ Parameters
+ ----------
+ is_active : typing.Optional[bool]
+
+ q : typing.Optional[str]
+
+ limit : typing.Optional[int]
+ Page limit (default 100)
+
+ offset : typing.Optional[int]
+ Page offset (default 0)
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[ListCouponsResponse]
+ OK
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "billing/coupons",
+ method="GET",
+ params={
+ "is_active": is_active,
+ "q": q,
+ "limit": limit,
+ "offset": offset,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ ListCouponsResponse,
+ parse_obj_as(
+ type_=ListCouponsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
+ async def upsert_billing_coupon(
+ self,
+ *,
+ amount_off: int,
+ duration: str,
+ duration_in_months: int,
+ external_id: str,
+ max_redemptions: int,
+ name: str,
+ percent_off: float,
+ times_redeemed: int,
+ currency: typing.Optional[str] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpsertBillingCouponResponse]:
+ """
+ Parameters
+ ----------
+ amount_off : int
+
+ duration : str
- metadata : typing.Optional[typing.Dict[str, typing.Any]]
+ duration_in_months : int
- period_end : typing.Optional[int]
+ external_id : str
- period_start : typing.Optional[int]
+ max_redemptions : int
- provider_type : typing.Optional[BillingProviderType]
+ name : str
- status : typing.Optional[str]
+ percent_off : float
- trial_end : typing.Optional[int]
+ times_redeemed : int
- trial_end_setting : typing.Optional[BillingSubscriptionTrialEndSetting]
+ currency : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[UpsertBillingSubscriptionResponse]
+ AsyncHttpResponse[UpsertBillingCouponResponse]
Created
"""
- _response = self._client_wrapper.httpx_client.request(
- "billing/subscription/upsert",
+ _response = await self._client_wrapper.httpx_client.request(
+ "billing/coupons",
method="POST",
json={
- "application_id": application_id,
- "cancel_at": cancel_at,
- "cancel_at_period_end": cancel_at_period_end,
+ "amount_off": amount_off,
"currency": currency,
- "customer_external_id": customer_external_id,
- "default_payment_method_external_id": default_payment_method_external_id,
- "default_payment_method_id": default_payment_method_id,
- "discounts": convert_and_respect_annotation_metadata(
- object_=discounts, annotation=typing.Sequence[BillingSubscriptionDiscount], direction="write"
- ),
- "expired_at": expired_at,
- "interval": interval,
- "metadata": metadata,
- "period_end": period_end,
- "period_start": period_start,
- "product_external_ids": convert_and_respect_annotation_metadata(
- object_=product_external_ids, annotation=typing.Sequence[BillingProductPricing], direction="write"
- ),
- "provider_type": provider_type,
- "status": status,
- "subscription_external_id": subscription_external_id,
- "total_price": total_price,
- "trial_end": trial_end,
- "trial_end_setting": trial_end_setting,
+ "duration": duration,
+ "duration_in_months": duration_in_months,
+ "external_id": external_id,
+ "max_redemptions": max_redemptions,
+ "name": name,
+ "percent_off": percent_off,
+ "times_redeemed": times_redeemed,
},
headers={
"content-type": "application/json",
@@ -2889,13 +3457,13 @@ def upsert_billing_subscription(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- UpsertBillingSubscriptionResponse,
+ UpsertBillingCouponResponse,
parse_obj_as(
- type_=UpsertBillingSubscriptionResponse, # type: ignore
+ type_=UpsertBillingCouponResponse, # type: ignore
object_=_response.json(),
),
)
- return HttpResponse(response=_response, data=_data)
+ return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 400:
raise BadRequestError(
headers=dict(_response.headers),
@@ -2964,58 +3532,34 @@ def upsert_billing_subscription(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
-
-class AsyncRawBillingClient:
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
- self._client_wrapper = client_wrapper
-
- async def list_coupons(
- self,
- *,
- is_active: typing.Optional[bool] = None,
- q: typing.Optional[str] = None,
- limit: typing.Optional[int] = None,
- offset: typing.Optional[int] = None,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> AsyncHttpResponse[ListCouponsResponse]:
+ async def delete_billing_coupon(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteBillingCouponResponse]:
"""
Parameters
----------
- is_active : typing.Optional[bool]
-
- q : typing.Optional[str]
-
- limit : typing.Optional[int]
- Page limit (default 100)
-
- offset : typing.Optional[int]
- Page offset (default 0)
+ billing_id : str
+ billing_id
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- AsyncHttpResponse[ListCouponsResponse]
+ AsyncHttpResponse[DeleteBillingCouponResponse]
OK
"""
_response = await self._client_wrapper.httpx_client.request(
- "billing/coupons",
- method="GET",
- params={
- "is_active": is_active,
- "q": q,
- "limit": limit,
- "offset": offset,
- },
+ f"billing/coupons/{jsonable_encoder(billing_id)}",
+ method="DELETE",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- ListCouponsResponse,
+ DeleteBillingCouponResponse,
parse_obj_as(
- type_=ListCouponsResponse, # type: ignore
+ type_=DeleteBillingCouponResponse, # type: ignore
object_=_response.json(),
),
)
@@ -3088,75 +3632,34 @@ async def list_coupons(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
- async def upsert_billing_coupon(
- self,
- *,
- amount_off: int,
- duration: str,
- duration_in_months: int,
- external_id: str,
- max_redemptions: int,
- name: str,
- percent_off: float,
- times_redeemed: int,
- currency: typing.Optional[str] = OMIT,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> AsyncHttpResponse[UpsertBillingCouponResponse]:
+ async def delete_billing_customer(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteBillingCustomerResponse]:
"""
Parameters
----------
- amount_off : int
-
- duration : str
-
- duration_in_months : int
-
- external_id : str
-
- max_redemptions : int
-
- name : str
-
- percent_off : float
-
- times_redeemed : int
-
- currency : typing.Optional[str]
+ billing_id : str
+ billing_id
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- AsyncHttpResponse[UpsertBillingCouponResponse]
- Created
+ AsyncHttpResponse[DeleteBillingCustomerResponse]
+ OK
"""
_response = await self._client_wrapper.httpx_client.request(
- "billing/coupons",
- method="POST",
- json={
- "amount_off": amount_off,
- "currency": currency,
- "duration": duration,
- "duration_in_months": duration_in_months,
- "external_id": external_id,
- "max_redemptions": max_redemptions,
- "name": name,
- "percent_off": percent_off,
- "times_redeemed": times_redeemed,
- },
- headers={
- "content-type": "application/json",
- },
+ f"billing/customer/{jsonable_encoder(billing_id)}",
+ method="DELETE",
request_options=request_options,
- omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- UpsertBillingCouponResponse,
+ DeleteBillingCustomerResponse,
parse_obj_as(
- type_=UpsertBillingCouponResponse, # type: ignore
+ type_=DeleteBillingCustomerResponse, # type: ignore
object_=_response.json(),
),
)
@@ -3896,6 +4399,106 @@ async def upsert_invoice(
status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
)
+ async def delete_billing_invoice(
+ self, billing_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteBillingInvoiceResponse]:
+ """
+ Parameters
+ ----------
+ billing_id : str
+ billing_id
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[DeleteBillingInvoiceResponse]
+ OK
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ f"billing/invoices/{jsonable_encoder(billing_id)}",
+ method="DELETE",
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ DeleteBillingInvoiceResponse,
+ parse_obj_as(
+ type_=DeleteBillingInvoiceResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 500:
+ raise InternalServerError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ types_api_error_ApiError,
+ parse_obj_as(
+ type_=types_api_error_ApiError, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
+ )
+ except ValidationError as e:
+ raise ParsingError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
+ )
+ raise core_api_error_ApiError(
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response_json
+ )
+
async def list_meters(
self,
*,
diff --git a/src/schematic/billing/types/__init__.py b/src/schematic/billing/types/__init__.py
index 6752589..ddb5b49 100644
--- a/src/schematic/billing/types/__init__.py
+++ b/src/schematic/billing/types/__init__.py
@@ -10,6 +10,9 @@
from .count_billing_products_response import CountBillingProductsResponse
from .count_customers_params import CountCustomersParams
from .count_customers_response import CountCustomersResponse
+ from .delete_billing_coupon_response import DeleteBillingCouponResponse
+ from .delete_billing_customer_response import DeleteBillingCustomerResponse
+ from .delete_billing_invoice_response import DeleteBillingInvoiceResponse
from .delete_billing_product_response import DeleteBillingProductResponse
from .delete_payment_method_by_external_id_response import DeletePaymentMethodByExternalIdResponse
from .delete_product_price_response import DeleteProductPriceResponse
@@ -42,6 +45,9 @@
"CountBillingProductsResponse": ".count_billing_products_response",
"CountCustomersParams": ".count_customers_params",
"CountCustomersResponse": ".count_customers_response",
+ "DeleteBillingCouponResponse": ".delete_billing_coupon_response",
+ "DeleteBillingCustomerResponse": ".delete_billing_customer_response",
+ "DeleteBillingInvoiceResponse": ".delete_billing_invoice_response",
"DeleteBillingProductResponse": ".delete_billing_product_response",
"DeletePaymentMethodByExternalIdResponse": ".delete_payment_method_by_external_id_response",
"DeleteProductPriceResponse": ".delete_product_price_response",
@@ -98,6 +104,9 @@ def __dir__():
"CountBillingProductsResponse",
"CountCustomersParams",
"CountCustomersResponse",
+ "DeleteBillingCouponResponse",
+ "DeleteBillingCustomerResponse",
+ "DeleteBillingInvoiceResponse",
"DeleteBillingProductResponse",
"DeletePaymentMethodByExternalIdResponse",
"DeleteProductPriceResponse",
diff --git a/src/schematic/billing/types/delete_billing_coupon_response.py b/src/schematic/billing/types/delete_billing_coupon_response.py
new file mode 100644
index 0000000..c7ce68f
--- /dev/null
+++ b/src/schematic/billing/types/delete_billing_coupon_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
+from ...types.delete_response import DeleteResponse
+
+
+class DeleteBillingCouponResponse(UniversalBaseModel):
+ data: DeleteResponse
+ params: typing.Dict[str, typing.Any] = pydantic.Field()
+ """
+ Input parameters
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/schematic/billing/types/delete_billing_customer_response.py b/src/schematic/billing/types/delete_billing_customer_response.py
new file mode 100644
index 0000000..491db43
--- /dev/null
+++ b/src/schematic/billing/types/delete_billing_customer_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
+from ...types.delete_response import DeleteResponse
+
+
+class DeleteBillingCustomerResponse(UniversalBaseModel):
+ data: DeleteResponse
+ params: typing.Dict[str, typing.Any] = pydantic.Field()
+ """
+ Input parameters
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/schematic/billing/types/delete_billing_invoice_response.py b/src/schematic/billing/types/delete_billing_invoice_response.py
new file mode 100644
index 0000000..67ddf3b
--- /dev/null
+++ b/src/schematic/billing/types/delete_billing_invoice_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
+from ...types.delete_response import DeleteResponse
+
+
+class DeleteBillingInvoiceResponse(UniversalBaseModel):
+ data: DeleteResponse
+ params: typing.Dict[str, typing.Any] = pydantic.Field()
+ """
+ Input parameters
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/schematic/checkout/client.py b/src/schematic/checkout/client.py
index dd87008..0f9468c 100644
--- a/src/schematic/checkout/client.py
+++ b/src/schematic/checkout/client.py
@@ -166,6 +166,7 @@ def get_checkout_data(
self,
*,
company_id: str,
+ currency: typing.Optional[str] = OMIT,
selected_plan_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> GetCheckoutDataResponse:
@@ -174,6 +175,8 @@ def get_checkout_data(
----------
company_id : str
+ currency : typing.Optional[str]
+
selected_plan_id : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
@@ -196,7 +199,7 @@ def get_checkout_data(
)
"""
_response = self._raw_client.get_checkout_data(
- company_id=company_id, selected_plan_id=selected_plan_id, request_options=request_options
+ company_id=company_id, currency=currency, selected_plan_id=selected_plan_id, request_options=request_options
)
return _response.data
@@ -797,6 +800,7 @@ async def get_checkout_data(
self,
*,
company_id: str,
+ currency: typing.Optional[str] = OMIT,
selected_plan_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> GetCheckoutDataResponse:
@@ -805,6 +809,8 @@ async def get_checkout_data(
----------
company_id : str
+ currency : typing.Optional[str]
+
selected_plan_id : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
@@ -835,7 +841,7 @@ async def main() -> None:
asyncio.run(main())
"""
_response = await self._raw_client.get_checkout_data(
- company_id=company_id, selected_plan_id=selected_plan_id, request_options=request_options
+ company_id=company_id, currency=currency, selected_plan_id=selected_plan_id, request_options=request_options
)
return _response.data
diff --git a/src/schematic/checkout/raw_client.py b/src/schematic/checkout/raw_client.py
index 80c6e6c..06fad08 100644
--- a/src/schematic/checkout/raw_client.py
+++ b/src/schematic/checkout/raw_client.py
@@ -214,6 +214,7 @@ def get_checkout_data(
self,
*,
company_id: str,
+ currency: typing.Optional[str] = OMIT,
selected_plan_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetCheckoutDataResponse]:
@@ -222,6 +223,8 @@ def get_checkout_data(
----------
company_id : str
+ currency : typing.Optional[str]
+
selected_plan_id : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
@@ -237,6 +240,7 @@ def get_checkout_data(
method="POST",
json={
"company_id": company_id,
+ "currency": currency,
"selected_plan_id": selected_plan_id,
},
headers={
@@ -1248,6 +1252,7 @@ async def get_checkout_data(
self,
*,
company_id: str,
+ currency: typing.Optional[str] = OMIT,
selected_plan_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetCheckoutDataResponse]:
@@ -1256,6 +1261,8 @@ async def get_checkout_data(
----------
company_id : str
+ currency : typing.Optional[str]
+
selected_plan_id : typing.Optional[str]
request_options : typing.Optional[RequestOptions]
@@ -1271,6 +1278,7 @@ async def get_checkout_data(
method="POST",
json={
"company_id": company_id,
+ "currency": currency,
"selected_plan_id": selected_plan_id,
},
headers={
diff --git a/src/schematic/core/client_wrapper.py b/src/schematic/core/client_wrapper.py
index 376eaa0..65f068b 100644
--- a/src/schematic/core/client_wrapper.py
+++ b/src/schematic/core/client_wrapper.py
@@ -27,12 +27,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform
headers: typing.Dict[str, str] = {
- "User-Agent": "schematichq/1.2.5",
+ "User-Agent": "schematichq/1.2.6",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "schematichq",
- "X-Fern-SDK-Version": "1.2.5",
+ "X-Fern-SDK-Version": "1.2.6",
**(self.get_custom_headers() or {}),
}
headers["X-Schematic-Api-Key"] = self.api_key
diff --git a/src/schematic/plans/client.py b/src/schematic/plans/client.py
index cf4a98b..35be75c 100644
--- a/src/schematic/plans/client.py
+++ b/src/schematic/plans/client.py
@@ -1082,6 +1082,7 @@ def publish_plan_version(
excluded_company_ids: typing.Sequence[str],
migration_strategy: PlanVersionMigrationStrategy,
activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT,
+ coupon_external_id: typing.Optional[str] = OMIT,
customer_email: typing.Optional[str] = OMIT,
days_until_due: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -1098,6 +1099,8 @@ def publish_plan_version(
activation_strategy : typing.Optional[CustomPlanActivationStrategy]
+ coupon_external_id : typing.Optional[str]
+
customer_email : typing.Optional[str]
days_until_due : typing.Optional[int]
@@ -1128,6 +1131,7 @@ def publish_plan_version(
excluded_company_ids=excluded_company_ids,
migration_strategy=migration_strategy,
activation_strategy=activation_strategy,
+ coupon_external_id=coupon_external_id,
customer_email=customer_email,
days_until_due=days_until_due,
request_options=request_options,
@@ -2317,6 +2321,7 @@ async def publish_plan_version(
excluded_company_ids: typing.Sequence[str],
migration_strategy: PlanVersionMigrationStrategy,
activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT,
+ coupon_external_id: typing.Optional[str] = OMIT,
customer_email: typing.Optional[str] = OMIT,
days_until_due: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -2333,6 +2338,8 @@ async def publish_plan_version(
activation_strategy : typing.Optional[CustomPlanActivationStrategy]
+ coupon_external_id : typing.Optional[str]
+
customer_email : typing.Optional[str]
days_until_due : typing.Optional[int]
@@ -2371,6 +2378,7 @@ async def main() -> None:
excluded_company_ids=excluded_company_ids,
migration_strategy=migration_strategy,
activation_strategy=activation_strategy,
+ coupon_external_id=coupon_external_id,
customer_email=customer_email,
days_until_due=days_until_due,
request_options=request_options,
diff --git a/src/schematic/plans/raw_client.py b/src/schematic/plans/raw_client.py
index 05202db..f2688f3 100644
--- a/src/schematic/plans/raw_client.py
+++ b/src/schematic/plans/raw_client.py
@@ -2240,6 +2240,7 @@ def publish_plan_version(
excluded_company_ids: typing.Sequence[str],
migration_strategy: PlanVersionMigrationStrategy,
activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT,
+ coupon_external_id: typing.Optional[str] = OMIT,
customer_email: typing.Optional[str] = OMIT,
days_until_due: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -2256,6 +2257,8 @@ def publish_plan_version(
activation_strategy : typing.Optional[CustomPlanActivationStrategy]
+ coupon_external_id : typing.Optional[str]
+
customer_email : typing.Optional[str]
days_until_due : typing.Optional[int]
@@ -2273,6 +2276,7 @@ def publish_plan_version(
method="PUT",
json={
"activation_strategy": activation_strategy,
+ "coupon_external_id": coupon_external_id,
"customer_email": customer_email,
"days_until_due": days_until_due,
"excluded_company_ids": excluded_company_ids,
@@ -4552,6 +4556,7 @@ async def publish_plan_version(
excluded_company_ids: typing.Sequence[str],
migration_strategy: PlanVersionMigrationStrategy,
activation_strategy: typing.Optional[CustomPlanActivationStrategy] = OMIT,
+ coupon_external_id: typing.Optional[str] = OMIT,
customer_email: typing.Optional[str] = OMIT,
days_until_due: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -4568,6 +4573,8 @@ async def publish_plan_version(
activation_strategy : typing.Optional[CustomPlanActivationStrategy]
+ coupon_external_id : typing.Optional[str]
+
customer_email : typing.Optional[str]
days_until_due : typing.Optional[int]
@@ -4585,6 +4592,7 @@ async def publish_plan_version(
method="PUT",
json={
"activation_strategy": activation_strategy,
+ "coupon_external_id": coupon_external_id,
"customer_email": customer_email,
"days_until_due": days_until_due,
"excluded_company_ids": excluded_company_ids,
diff --git a/src/schematic/types/billing_credit_grant_response_data.py b/src/schematic/types/billing_credit_grant_response_data.py
index 504db3a..0042655 100644
--- a/src/schematic/types/billing_credit_grant_response_data.py
+++ b/src/schematic/types/billing_credit_grant_response_data.py
@@ -26,7 +26,7 @@ class BillingCreditGrantResponseData(UniversalBaseModel):
plan_id: typing.Optional[str] = None
plan_name: typing.Optional[str] = None
price: typing.Optional[BillingPriceResponseData] = None
- quantity: int
+ quantity: float
quantity_remaining: float
quantity_used: float
renewal_enabled: bool
diff --git a/src/schematic/types/credit_company_grant_view.py b/src/schematic/types/credit_company_grant_view.py
index d038a95..3b4db6e 100644
--- a/src/schematic/types/credit_company_grant_view.py
+++ b/src/schematic/types/credit_company_grant_view.py
@@ -35,7 +35,7 @@ class CreditCompanyGrantView(UniversalBaseModel):
plan_name: typing.Optional[str] = None
plural_name: typing.Optional[str] = None
price: typing.Optional[BillingProductPriceResponseData] = None
- quantity: int
+ quantity: float
quantity_remaining: float
quantity_used: float
renewal_enabled: bool
diff --git a/src/schematic/types/credit_event_ledger_response_data.py b/src/schematic/types/credit_event_ledger_response_data.py
index 4bff320..5c35c6f 100644
--- a/src/schematic/types/credit_event_ledger_response_data.py
+++ b/src/schematic/types/credit_event_ledger_response_data.py
@@ -37,7 +37,7 @@ class CreditEventLedgerResponseData(UniversalBaseModel):
from_grant_id: typing.Optional[str] = None
grant_expires_at: typing.Optional[dt.datetime] = None
grant_id: typing.Optional[str] = None
- grant_quantity: typing.Optional[int] = None
+ grant_quantity: typing.Optional[float] = None
grant_quantity_remaining: typing.Optional[float] = None
grant_reason: typing.Optional[BillingCreditGrantReason] = None
grant_valid_from: typing.Optional[dt.datetime] = None
diff --git a/src/schematic/types/plan_change_response_data.py b/src/schematic/types/plan_change_response_data.py
index 2808efe..1c3a9df 100644
--- a/src/schematic/types/plan_change_response_data.py
+++ b/src/schematic/types/plan_change_response_data.py
@@ -9,6 +9,7 @@
from .api_key_response_data import ApiKeyResponseData
from .audit_log_list_response_data import AuditLogListResponseData
from .company_response_data import CompanyResponseData
+from .integration_response_data import IntegrationResponseData
from .plan_change_action import PlanChangeAction
from .plan_change_base_plan_action import PlanChangeBasePlanAction
from .plan_change_subscription_action import PlanChangeSubscriptionAction
@@ -40,6 +41,11 @@ class PlanChangeResponseData(UniversalBaseModel):
created_at: dt.datetime
environment_id: str
id: str
+ integration: typing.Optional[IntegrationResponseData] = pydantic.Field(default=None)
+ """
+ The integration that performed this change, when the actor is an integration-owned API key (e.g. a billing-provider sync).
+ """
+
is_version_upgrade: bool = pydantic.Field()
"""
True when this change moved the company to a different version of the same plan (e.g. a plan version migration) rather than to a different plan.
diff --git a/src/schematic/types/rules_engine_schema_version.py b/src/schematic/types/rules_engine_schema_version.py
index 9cca674..69b0d3e 100644
--- a/src/schematic/types/rules_engine_schema_version.py
+++ b/src/schematic/types/rules_engine_schema_version.py
@@ -2,4 +2,4 @@
import typing
-RulesEngineSchemaVersion = typing.Union[typing.Literal["v97288f60", "placeholder-for-fern-compatibility"], typing.Any]
+RulesEngineSchemaVersion = typing.Union[typing.Literal["v5b3e7220", "placeholder-for-fern-compatibility"], typing.Any]