/* * 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"; /** * Response model for individual dataset with feature count. */ export type DatasetResponse = { id: string; createdAt: Date; updatedAt: Date; key: string; name: string; description: string; type: string; publisherName: string; publisherId: string | null; startDate: Date | null; endDate: Date | null; frequency: string | null; /** * Number of features associated with this dataset */ featureCount: number; }; /** @internal */ export const DatasetResponse$inboundSchema: z.ZodType< DatasetResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), key: z.string(), name: z.string(), description: z.string(), type: z.string(), publisher_name: z.string(), publisher_id: z.nullable(z.string()), start_date: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), end_date: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), frequency: z.nullable(z.string()), feature_count: z.number().int(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "updated_at": "updatedAt", "publisher_name": "publisherName", "publisher_id": "publisherId", "start_date": "startDate", "end_date": "endDate", "feature_count": "featureCount", }); }); /** @internal */ export type DatasetResponse$Outbound = { id: string; created_at: string; updated_at: string; key: string; name: string; description: string; type: string; publisher_name: string; publisher_id: string | null; start_date: string | null; end_date: string | null; frequency: string | null; feature_count: number; }; /** @internal */ export const DatasetResponse$outboundSchema: z.ZodType< DatasetResponse$Outbound, z.ZodTypeDef, DatasetResponse > = z.object({ id: z.string(), createdAt: z.date().transform(v => v.toISOString()), updatedAt: z.date().transform(v => v.toISOString()), key: z.string(), name: z.string(), description: z.string(), type: z.string(), publisherName: z.string(), publisherId: z.nullable(z.string()), startDate: z.nullable(z.date().transform(v => v.toISOString())), endDate: z.nullable(z.date().transform(v => v.toISOString())), frequency: z.nullable(z.string()), featureCount: z.number().int(), }).transform((v) => { return remap$(v, { createdAt: "created_at", updatedAt: "updated_at", publisherName: "publisher_name", publisherId: "publisher_id", startDate: "start_date", endDate: "end_date", featureCount: "feature_count", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DatasetResponse$ { /** @deprecated use `DatasetResponse$inboundSchema` instead. */ export const inboundSchema = DatasetResponse$inboundSchema; /** @deprecated use `DatasetResponse$outboundSchema` instead. */ export const outboundSchema = DatasetResponse$outboundSchema; /** @deprecated use `DatasetResponse$Outbound` instead. */ export type Outbound = DatasetResponse$Outbound; } export function datasetResponseToJSON( datasetResponse: DatasetResponse, ): string { return JSON.stringify(DatasetResponse$outboundSchema.parse(datasetResponse)); } export function datasetResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DatasetResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DatasetResponse' from JSON`, ); }