@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
36 lines • 1.4 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
/**
* How often credits are automatically refilled.
*/
export const KeyCreditsRefillInterval = {
Daily: "daily",
Monthly: "monthly",
};
/** @internal */
export const KeyCreditsRefillInterval$inboundSchema = openEnums.inboundSchema(KeyCreditsRefillInterval);
/** @internal */
export const KeyCreditsRefillInterval$outboundSchema = openEnums.outboundSchema(KeyCreditsRefillInterval);
/** @internal */
export const KeyCreditsRefill$inboundSchema = z.object({
interval: KeyCreditsRefillInterval$inboundSchema,
amount: z.number().int(),
refillDay: z.number().int().optional(),
});
/** @internal */
export const KeyCreditsRefill$outboundSchema = z.object({
interval: KeyCreditsRefillInterval$outboundSchema,
amount: z.number().int(),
refillDay: z.number().int().optional(),
});
export function keyCreditsRefillToJSON(keyCreditsRefill) {
return JSON.stringify(KeyCreditsRefill$outboundSchema.parse(keyCreditsRefill));
}
export function keyCreditsRefillFromJSON(jsonString) {
return safeParse(jsonString, (x) => KeyCreditsRefill$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'KeyCreditsRefill' from JSON`);
}
//# sourceMappingURL=keycreditsrefill.js.map