diff --git a/.fern/metadata.json b/.fern/metadata.json index b96f139..2585cf0 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -23,7 +23,7 @@ } ] }, - "originGitCommit": "ba014d4647e50fa5b7a5eefb6a2a4bdff847b683", + "originGitCommit": "067e0ade1fa8f371bf795e252e5c2f5049e8756d", "originGitCommitIsDirty": false, "invokedBy": "ci", "requestedVersion": "1.4.2", diff --git a/.fern/replay.lock b/.fern/replay.lock index f89a26b..679290f 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -78,7 +78,13 @@ generations: cli_version: unknown generator_versions: fernapi/fern-python-sdk: 5.30.2 -current_generation: 07924e45c1a82934b1eea5e9d6baa5040be2d75e + - commit_sha: 327aac7aebaacaf9719bc0e06c4b301bf6a44c65 + tree_hash: 29ad558de40b18f4a5702e47cf4ab03b071e95a3 + timestamp: 2026-09-17T06:10:04.087Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 5.30.2 +current_generation: 327aac7aebaacaf9719bc0e06c4b301bf6a44c65 patches: - id: patch-f12c60b5 content_hash: sha256:6c96b67cf4cbf01cc998bf8c619fff93390263de2730f6c1c4e4a0359b5dd214 diff --git a/reference.md b/reference.md index 3d061aa..a3d9214 100644 --- a/reference.md +++ b/reference.md @@ -6680,7 +6680,7 @@ client.credits.acquire_credit_lease(
-**expires_at:** `typing.Optional[datetime.datetime]` +**expires_at:** `typing.Optional[datetime.datetime]` — When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry
@@ -6756,7 +6756,7 @@ client.credits.extend_credit_lease(
-**expires_at:** `typing.Optional[datetime.datetime]` +**expires_at:** `typing.Optional[datetime.datetime]` — Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has
@@ -21950,7 +21950,15 @@ client.features.check_and_reserve_flag(
-**preflight:** `typing.Optional[PreflightRequestBody]` — Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate +**idempotency_key:** `typing.Optional[str]` — A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold + +
+
+ +
+
+ +**preflight:** `typing.Optional[PreflightRequestBody]` — Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here
@@ -21958,7 +21966,7 @@ client.features.check_and_reserve_flag(
-**quantity:** `typing.Optional[float]` — Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event +**quantity:** `typing.Optional[float]` — Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1
diff --git a/src/schematic/__init__.py b/src/schematic/__init__.py index bfe8c86..136b60c 100644 --- a/src/schematic/__init__.py +++ b/src/schematic/__init__.py @@ -182,6 +182,7 @@ CreditReservationResponseData, CreditSpendPolicyResponseData, CreditSpendPolicyScope, + CreditTransferReason, CreditTransferResponseData, CreditTransferView, CreditTriggerConfig, @@ -1228,6 +1229,7 @@ "CreditReservationResponseData": ".types", "CreditSpendPolicyResponseData": ".types", "CreditSpendPolicyScope": ".types", + "CreditTransferReason": ".types", "CreditTransferResponseData": ".types", "CreditTransferView": ".types", "CreditTriggerConfig": ".types", @@ -2159,6 +2161,7 @@ def __dir__(): "CreditReservationResponseData", "CreditSpendPolicyResponseData", "CreditSpendPolicyScope", + "CreditTransferReason", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", diff --git a/src/schematic/credits/client.py b/src/schematic/credits/client.py index 112fb6c..5942eab 100644 --- a/src/schematic/credits/client.py +++ b/src/schematic/credits/client.py @@ -1152,6 +1152,7 @@ def acquire_credit_lease( requested_amount : float expires_at : typing.Optional[dt.datetime] + When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1201,6 +1202,7 @@ def extend_credit_lease( additional_amount : float expires_at : typing.Optional[dt.datetime] + Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has idempotency_key : typing.Optional[str] A caller-chosen key for safe retries: a second request with the same key returns the lease as it stands instead of growing it again. Keys are unique per environment across every extend @@ -3589,6 +3591,7 @@ async def acquire_credit_lease( requested_amount : float expires_at : typing.Optional[dt.datetime] + When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -3646,6 +3649,7 @@ async def extend_credit_lease( additional_amount : float expires_at : typing.Optional[dt.datetime] + Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has idempotency_key : typing.Optional[str] A caller-chosen key for safe retries: a second request with the same key returns the lease as it stands instead of growing it again. Keys are unique per environment across every extend diff --git a/src/schematic/credits/raw_client.py b/src/schematic/credits/raw_client.py index 773675d..278c031 100644 --- a/src/schematic/credits/raw_client.py +++ b/src/schematic/credits/raw_client.py @@ -2472,6 +2472,7 @@ def acquire_credit_lease( requested_amount : float expires_at : typing.Optional[dt.datetime] + When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -2603,6 +2604,7 @@ def extend_credit_lease( additional_amount : float expires_at : typing.Optional[dt.datetime] + Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has idempotency_key : typing.Optional[str] A caller-chosen key for safe retries: a second request with the same key returns the lease as it stands instead of growing it again. Keys are unique per environment across every extend @@ -7359,6 +7361,7 @@ async def acquire_credit_lease( requested_amount : float expires_at : typing.Optional[dt.datetime] + When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -7490,6 +7493,7 @@ async def extend_credit_lease( additional_amount : float expires_at : typing.Optional[dt.datetime] + Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has idempotency_key : typing.Optional[str] A caller-chosen key for safe retries: a second request with the same key returns the lease as it stands instead of growing it again. Keys are unique per environment across every extend diff --git a/src/schematic/features/client.py b/src/schematic/features/client.py index d531926..4ccc4ac 100644 --- a/src/schematic/features/client.py +++ b/src/schematic/features/client.py @@ -897,6 +897,7 @@ def check_and_reserve_flag( *, company: typing.Optional[typing.Dict[str, str]] = OMIT, expires_at: typing.Optional[dt.datetime] = OMIT, + idempotency_key: typing.Optional[str] = OMIT, preflight: typing.Optional[PreflightRequestBody] = OMIT, quantity: typing.Optional[float] = OMIT, user: typing.Optional[typing.Dict[str, str]] = OMIT, @@ -913,11 +914,14 @@ def check_and_reserve_flag( expires_at : typing.Optional[dt.datetime] When the hold lapses if no track event settles it; defaults to one minute from now and may be at most one hour out. The unspent hold is refunded on expiry + idempotency_key : typing.Optional[str] + A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold + preflight : typing.Optional[PreflightRequestBody] - Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate + Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here quantity : typing.Optional[float] - Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event + Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1 user : typing.Optional[typing.Dict[str, str]] @@ -944,6 +948,7 @@ def check_and_reserve_flag( key, company=company, expires_at=expires_at, + idempotency_key=idempotency_key, preflight=preflight, quantity=quantity, user=user, @@ -2054,6 +2059,7 @@ async def check_and_reserve_flag( *, company: typing.Optional[typing.Dict[str, str]] = OMIT, expires_at: typing.Optional[dt.datetime] = OMIT, + idempotency_key: typing.Optional[str] = OMIT, preflight: typing.Optional[PreflightRequestBody] = OMIT, quantity: typing.Optional[float] = OMIT, user: typing.Optional[typing.Dict[str, str]] = OMIT, @@ -2070,11 +2076,14 @@ async def check_and_reserve_flag( expires_at : typing.Optional[dt.datetime] When the hold lapses if no track event settles it; defaults to one minute from now and may be at most one hour out. The unspent hold is refunded on expiry + idempotency_key : typing.Optional[str] + A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold + preflight : typing.Optional[PreflightRequestBody] - Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate + Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here quantity : typing.Optional[float] - Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event + Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1 user : typing.Optional[typing.Dict[str, str]] @@ -2109,6 +2118,7 @@ async def main() -> None: key, company=company, expires_at=expires_at, + idempotency_key=idempotency_key, preflight=preflight, quantity=quantity, user=user, diff --git a/src/schematic/features/raw_client.py b/src/schematic/features/raw_client.py index bc9f376..d1938b2 100644 --- a/src/schematic/features/raw_client.py +++ b/src/schematic/features/raw_client.py @@ -1829,6 +1829,7 @@ def check_and_reserve_flag( *, company: typing.Optional[typing.Dict[str, str]] = OMIT, expires_at: typing.Optional[dt.datetime] = OMIT, + idempotency_key: typing.Optional[str] = OMIT, preflight: typing.Optional[PreflightRequestBody] = OMIT, quantity: typing.Optional[float] = OMIT, user: typing.Optional[typing.Dict[str, str]] = OMIT, @@ -1845,11 +1846,14 @@ def check_and_reserve_flag( expires_at : typing.Optional[dt.datetime] When the hold lapses if no track event settles it; defaults to one minute from now and may be at most one hour out. The unspent hold is refunded on expiry + idempotency_key : typing.Optional[str] + A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold + preflight : typing.Optional[PreflightRequestBody] - Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate + Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here quantity : typing.Optional[float] - Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event + Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1 user : typing.Optional[typing.Dict[str, str]] @@ -1867,6 +1871,7 @@ def check_and_reserve_flag( json={ "company": company, "expires_at": expires_at, + "idempotency_key": idempotency_key, "preflight": convert_and_respect_annotation_metadata( object_=preflight, annotation=PreflightRequestBody, direction="write" ), @@ -4093,6 +4098,7 @@ async def check_and_reserve_flag( *, company: typing.Optional[typing.Dict[str, str]] = OMIT, expires_at: typing.Optional[dt.datetime] = OMIT, + idempotency_key: typing.Optional[str] = OMIT, preflight: typing.Optional[PreflightRequestBody] = OMIT, quantity: typing.Optional[float] = OMIT, user: typing.Optional[typing.Dict[str, str]] = OMIT, @@ -4109,11 +4115,14 @@ async def check_and_reserve_flag( expires_at : typing.Optional[dt.datetime] When the hold lapses if no track event settles it; defaults to one minute from now and may be at most one hour out. The unspent hold is refunded on expiry + idempotency_key : typing.Optional[str] + A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold + preflight : typing.Optional[PreflightRequestBody] - Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate + Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here quantity : typing.Optional[float] - Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event + Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1 user : typing.Optional[typing.Dict[str, str]] @@ -4131,6 +4140,7 @@ async def check_and_reserve_flag( json={ "company": company, "expires_at": expires_at, + "idempotency_key": idempotency_key, "preflight": convert_and_respect_annotation_metadata( object_=preflight, annotation=PreflightRequestBody, direction="write" ), diff --git a/src/schematic/types/__init__.py b/src/schematic/types/__init__.py index f1015e2..b2e6cba 100644 --- a/src/schematic/types/__init__.py +++ b/src/schematic/types/__init__.py @@ -185,6 +185,7 @@ from .credit_reservation_response_data import CreditReservationResponseData from .credit_spend_policy_response_data import CreditSpendPolicyResponseData from .credit_spend_policy_scope import CreditSpendPolicyScope + from .credit_transfer_reason import CreditTransferReason from .credit_transfer_response_data import CreditTransferResponseData from .credit_transfer_view import CreditTransferView from .credit_trigger_config import CreditTriggerConfig @@ -668,6 +669,7 @@ "CreditReservationResponseData": ".credit_reservation_response_data", "CreditSpendPolicyResponseData": ".credit_spend_policy_response_data", "CreditSpendPolicyScope": ".credit_spend_policy_scope", + "CreditTransferReason": ".credit_transfer_reason", "CreditTransferResponseData": ".credit_transfer_response_data", "CreditTransferView": ".credit_transfer_view", "CreditTriggerConfig": ".credit_trigger_config", @@ -1171,6 +1173,7 @@ def __dir__(): "CreditReservationResponseData", "CreditSpendPolicyResponseData", "CreditSpendPolicyScope", + "CreditTransferReason", "CreditTransferResponseData", "CreditTransferView", "CreditTriggerConfig", diff --git a/src/schematic/types/billing_credit_grant_reason.py b/src/schematic/types/billing_credit_grant_reason.py index fdaf1c2..e7e8f11 100644 --- a/src/schematic/types/billing_credit_grant_reason.py +++ b/src/schematic/types/billing_credit_grant_reason.py @@ -4,7 +4,15 @@ BillingCreditGrantReason = typing.Union[ typing.Literal[ - "adjustment", "billing_credit_auto_topup", "free", "plan", "postpaid_overdraft", "purchased", "rollover" + "adjustment", + "billing_credit_auto_topup", + "free", + "plan", + "postpaid_forgiven", + "postpaid_overdraft", + "postpaid_settlement", + "purchased", + "rollover", ], typing.Any, ] diff --git a/src/schematic/types/billing_credit_response_data.py b/src/schematic/types/billing_credit_response_data.py index 2f0e6fc..e80dbc1 100644 --- a/src/schematic/types/billing_credit_response_data.py +++ b/src/schematic/types/billing_credit_response_data.py @@ -7,6 +7,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .billing_credit_burn_strategy import BillingCreditBurnStrategy from .billing_credit_expiry_unit import BillingCreditExpiryUnit +from .billing_credit_ledger_authority import BillingCreditLedgerAuthority from .billing_credit_rollover_policy import BillingCreditRolloverPolicy from .billing_price_response_data import BillingPriceResponseData from .billing_product_response_data import BillingProductResponseData @@ -24,6 +25,7 @@ class BillingCreditResponseData(UniversalBaseModel): description: str icon: typing.Optional[str] = None id: str + ledger_authority: BillingCreditLedgerAuthority name: str plural_name: typing.Optional[str] = None price: typing.Optional[BillingPriceResponseData] = None diff --git a/src/schematic/types/credit_event_ledger_response_data.py b/src/schematic/types/credit_event_ledger_response_data.py index 5c35c6f..58271c1 100644 --- a/src/schematic/types/credit_event_ledger_response_data.py +++ b/src/schematic/types/credit_event_ledger_response_data.py @@ -12,6 +12,7 @@ from .billing_credit_ledger_response_data import BillingCreditLedgerResponseData from .company_ledger_response_data import CompanyLedgerResponseData from .credit_event_type import CreditEventType +from .credit_transfer_reason import CreditTransferReason from .credit_usage_reason import CreditUsageReason from .feature_ledger_response_data import FeatureLedgerResponseData @@ -46,6 +47,7 @@ class CreditEventLedgerResponseData(UniversalBaseModel): quantity_remaining_at_zero_out: typing.Optional[float] = None source_id: int to_grant_id: typing.Optional[str] = None + transfer_reason: typing.Optional[CreditTransferReason] = None usage_event_id: typing.Optional[str] = None usage_reason: typing.Optional[CreditUsageReason] = None zeroed_out_reason: typing.Optional[BillingCreditGrantZeroedOutReason] = None diff --git a/src/schematic/types/credit_transfer_reason.py b/src/schematic/types/credit_transfer_reason.py new file mode 100644 index 0000000..2ff779c --- /dev/null +++ b/src/schematic/types/credit_transfer_reason.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreditTransferReason = typing.Union[ + typing.Literal["overdraft_recovery", "postpaid_debt_moved", "postpaid_forgiven", "postpaid_paid"], typing.Any +]