/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Type = { File: "file", Folder: "folder", } as const; export type Type = ClosedEnum; export type SharepointFileData = { id: string; name: string; path: string; type: Type; driveId: string | null; }; /** @internal */ export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Type, ); /** @internal */ export const Type$outboundSchema: z.ZodNativeEnum = Type$inboundSchema; /** @internal */ export const SharepointFileData$inboundSchema: z.ZodType< SharepointFileData, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), path: z.string(), type: Type$inboundSchema, drive_id: z.nullable(z.string()), }).transform((v) => { return remap$(v, { "drive_id": "driveId", }); }); /** @internal */ export type SharepointFileData$Outbound = { id: string; name: string; path: string; type: string; drive_id: string | null; }; /** @internal */ export const SharepointFileData$outboundSchema: z.ZodType< SharepointFileData$Outbound, z.ZodTypeDef, SharepointFileData > = z.object({ id: z.string(), name: z.string(), path: z.string(), type: Type$outboundSchema, driveId: z.nullable(z.string()), }).transform((v) => { return remap$(v, { driveId: "drive_id", }); }); export function sharepointFileDataToJSON( sharepointFileData: SharepointFileData, ): string { return JSON.stringify( SharepointFileData$outboundSchema.parse(sharepointFileData), ); } export function sharepointFileDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SharepointFileData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SharepointFileData' from JSON`, ); }