/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetStatsAccountByDateRequest = { /** * The start date for the stats, formatted YYYY-MM-DD */ startDate?: RFCDate | undefined; /** * The end date for the stats, formatted YYYY-MM-DD */ endDate?: RFCDate | undefined; }; export type GetStatsAccountByDateResponse = { date?: RFCDate | undefined; loadCount?: number | undefined; playCount?: number | undefined; hoursWatched?: number | undefined; }; /** @internal */ export type GetStatsAccountByDateRequest$Outbound = { start_date?: string | undefined; end_date?: string | undefined; }; /** @internal */ export const GetStatsAccountByDateRequest$outboundSchema: z.ZodType< GetStatsAccountByDateRequest$Outbound, z.ZodTypeDef, GetStatsAccountByDateRequest > = z.object({ startDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), endDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", }); }); export function getStatsAccountByDateRequestToJSON( getStatsAccountByDateRequest: GetStatsAccountByDateRequest, ): string { return JSON.stringify( GetStatsAccountByDateRequest$outboundSchema.parse( getStatsAccountByDateRequest, ), ); } /** @internal */ export const GetStatsAccountByDateResponse$inboundSchema: z.ZodType< GetStatsAccountByDateResponse, z.ZodTypeDef, unknown > = z.object({ date: z.string().transform(v => new RFCDate(v)).optional(), load_count: z.number().int().optional(), play_count: z.number().int().optional(), hours_watched: z.number().optional(), }).transform((v) => { return remap$(v, { "load_count": "loadCount", "play_count": "playCount", "hours_watched": "hoursWatched", }); }); export function getStatsAccountByDateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetStatsAccountByDateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStatsAccountByDateResponse' from JSON`, ); }