Credits
Usage credit benefit schema and validated constructor; construction does not credit a balance.
Declaration
Section titled “Declaration”const Credits: Schema.Union<readonly [Schema.Struct<{ unit: Schema.brand<Schema.String, "UsageUnitKey">; quantity: Schema.brand<Schema.BigInt, "UsageCreditQuantity">; expiry: Schema.Literal<"never">; type: Schema.tag<"usage_credits">;}>]> & { discriminants: readonly ["usage_credits"]; cases: { usage_credits: Schema.Struct<{ unit: Schema.brand<Schema.String, "UsageUnitKey">; quantity: Schema.brand<Schema.BigInt, "UsageCreditQuantity">; expiry: Schema.Literal<"never">; type: Schema.tag<"usage_credits">; }>; }; isAnyOf: <Keys>(keys) => (value) => value is Extract<{ unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" }, { type: Keys }>; guards: { usage_credits: (u) => u is { unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" }; }; match: { <Cases> (value, cases): Cases[keyof Cases] extends (value) => R ? any : never; <Cases> (cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never; };} & { pack: (input) => Effect.Effect<typeof CreditBenefit.Type, Schema.SchemaError>;};Type Declaration
Section titled “Type Declaration”discriminants
Section titled “discriminants”readonly discriminants: readonly ["usage_credits"];readonly cases: { usage_credits: Schema.Struct<{ unit: Schema.brand<Schema.String, "UsageUnitKey">; quantity: Schema.brand<Schema.BigInt, "UsageCreditQuantity">; expiry: Schema.Literal<"never">; type: Schema.tag<"usage_credits">; }>;};cases.usage_credits
Section titled “cases.usage_credits”usage_credits: Schema.Struct<{ unit: Schema.brand<Schema.String, "UsageUnitKey">; quantity: Schema.brand<Schema.BigInt, "UsageCreditQuantity">; expiry: Schema.Literal<"never">; type: Schema.tag<"usage_credits">;}>;isAnyOf
Section titled “isAnyOf”readonly isAnyOf: <Keys>(keys) => (value) => value is Extract<{ unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" }, { type: Keys }>;Type Parameters
Section titled “Type Parameters”Keys
Parameters
Section titled “Parameters”readonly Keys[]
Returns
Section titled “Returns”(value) => value is Extract<{ unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" }, { type: Keys }>
guards
Section titled “guards”readonly guards: { usage_credits: (u) => u is { unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" };};guards.usage_credits
Section titled “guards.usage_credits”usage_credits: (u) => u is { unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" };Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”u is { unit: string & any; quantity: bigint & any; expiry: "never"; type: "usage_credits" }
readonly match: {<Cases> (value, cases): Cases[keyof Cases] extends (value) => R ? any : never;<Cases> (cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never;};Call Signature
Section titled “Call Signature”<Cases>(value, cases): Cases[keyof Cases] extends (value) => R ? any : never;Type Parameters
Section titled “Type Parameters”Cases extends {
[key: string]: (value) => any;
}
Parameters
Section titled “Parameters”string & any
quantity
Section titled “quantity”bigint & any
expiry
Section titled “expiry”"never"
"usage_credits"
Cases
Returns
Section titled “Returns”Cases[keyof Cases] extends (value) => R ? any : never
Call Signature
Section titled “Call Signature”<Cases>(cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never;Type Parameters
Section titled “Type Parameters”Cases extends {
[key: string]: (value) => any;
}
Parameters
Section titled “Parameters”Cases
Returns
Section titled “Returns”(value) => Cases[keyof Cases] extends (value) => R ? any : never
Type Declaration
Section titled “Type Declaration”pack: (input) => Effect.Effect<typeof CreditBenefit.Type, Schema.SchemaError>;Parses a non-expiring usage credit pack without fixed wire-format fields.
Parameters
Section titled “Parameters”Omit<typeof CreditBenefit.Encoded, "type" | "expiry">
Returns
Section titled “Returns”Effect.Effect<typeof CreditBenefit.Type, Schema.SchemaError>