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 .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
]
},
"originGitCommit": "ba014d4647e50fa5b7a5eefb6a2a4bdff847b683",
"originGitCommit": "067e0ade1fa8f371bf795e252e5c2f5049e8756d",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "1.4.2",
Expand Down
8 changes: 7 additions & 1 deletion .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6680,7 +6680,7 @@ client.credits.acquire_credit_lease(
<dl>
<dd>

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

</dd>
</dl>
Expand Down Expand Up @@ -6756,7 +6756,7 @@ client.credits.extend_credit_lease(
<dl>
<dd>

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

</dd>
</dl>
Expand Down Expand Up @@ -21950,15 +21950,23 @@ client.features.check_and_reserve_flag(
<dl>
<dd>

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

</dd>
</dl>

<dl>
<dd>

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

</dd>
</dl>

<dl>
<dd>

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

</dd>
</dl>
Expand Down
3 changes: 3 additions & 0 deletions src/schematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
CreditReservationResponseData,
CreditSpendPolicyResponseData,
CreditSpendPolicyScope,
CreditTransferReason,
CreditTransferResponseData,
CreditTransferView,
CreditTriggerConfig,
Expand Down Expand Up @@ -1228,6 +1229,7 @@
"CreditReservationResponseData": ".types",
"CreditSpendPolicyResponseData": ".types",
"CreditSpendPolicyScope": ".types",
"CreditTransferReason": ".types",
"CreditTransferResponseData": ".types",
"CreditTransferView": ".types",
"CreditTriggerConfig": ".types",
Expand Down Expand Up @@ -2159,6 +2161,7 @@ def __dir__():
"CreditReservationResponseData",
"CreditSpendPolicyResponseData",
"CreditSpendPolicyScope",
"CreditTransferReason",
"CreditTransferResponseData",
"CreditTransferView",
"CreditTriggerConfig",
Expand Down
4 changes: 4 additions & 0 deletions src/schematic/credits/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/schematic/credits/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions src/schematic/features/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]]

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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]]

Expand Down Expand Up @@ -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,
Expand Down
18 changes: 14 additions & 4 deletions src/schematic/features/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]]

Expand All @@ -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"
),
Expand Down Expand Up @@ -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,
Expand All @@ -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]]

Expand All @@ -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"
),
Expand Down
3 changes: 3 additions & 0 deletions src/schematic/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1171,6 +1173,7 @@ def __dir__():
"CreditReservationResponseData",
"CreditSpendPolicyResponseData",
"CreditSpendPolicyScope",
"CreditTransferReason",
"CreditTransferResponseData",
"CreditTransferView",
"CreditTriggerConfig",
Expand Down
10 changes: 9 additions & 1 deletion src/schematic/types/billing_credit_grant_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
2 changes: 2 additions & 0 deletions src/schematic/types/billing_credit_response_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading
Loading