/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * An individual metric about usage of a user. * * @remarks */ export type UsageMetric = { /** * The user ID associated with the metric */ userID?: string | undefined; /** * The creator ID associated with the metric */ creatorID?: string | undefined; /** * Total minutes of delivery usage. */ deliveryUsageMins?: number | undefined; /** * Total transcoded minutes. */ totalUsageMins?: number | undefined; /** * Total minutes of storage usage. */ storageUsageMins?: number | undefined; }; /** @internal */ export const UsageMetric$inboundSchema: z.ZodType< UsageMetric, z.ZodTypeDef, unknown > = z.object({ UserID: z.string().optional(), CreatorID: z.string().optional(), DeliveryUsageMins: z.number().optional(), TotalUsageMins: z.number().optional(), StorageUsageMins: z.number().optional(), }).transform((v) => { return remap$(v, { "UserID": "userID", "CreatorID": "creatorID", "DeliveryUsageMins": "deliveryUsageMins", "TotalUsageMins": "totalUsageMins", "StorageUsageMins": "storageUsageMins", }); }); /** @internal */ export type UsageMetric$Outbound = { UserID?: string | undefined; CreatorID?: string | undefined; DeliveryUsageMins?: number | undefined; TotalUsageMins?: number | undefined; StorageUsageMins?: number | undefined; }; /** @internal */ export const UsageMetric$outboundSchema: z.ZodType< UsageMetric$Outbound, z.ZodTypeDef, UsageMetric > = z.object({ userID: z.string().optional(), creatorID: z.string().optional(), deliveryUsageMins: z.number().optional(), totalUsageMins: z.number().optional(), storageUsageMins: z.number().optional(), }).transform((v) => { return remap$(v, { userID: "UserID", creatorID: "CreatorID", deliveryUsageMins: "DeliveryUsageMins", totalUsageMins: "TotalUsageMins", storageUsageMins: "StorageUsageMins", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UsageMetric$ { /** @deprecated use `UsageMetric$inboundSchema` instead. */ export const inboundSchema = UsageMetric$inboundSchema; /** @deprecated use `UsageMetric$outboundSchema` instead. */ export const outboundSchema = UsageMetric$outboundSchema; /** @deprecated use `UsageMetric$Outbound` instead. */ export type Outbound = UsageMetric$Outbound; } export function usageMetricToJSON(usageMetric: UsageMetric): string { return JSON.stringify(UsageMetric$outboundSchema.parse(usageMetric)); } export function usageMetricFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UsageMetric$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UsageMetric' from JSON`, ); }