/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LinkedFolder, LinkedFolder$inboundSchema } from "./linkedfolder.js"; import { Owner, Owner$inboundSchema } from "./owner.js"; export type Folder = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; /** * The name of the folder */ name: string; /** * Optional description of the folder */ description?: string | null | undefined; /** * The full path of the folder (includes the folder name) */ path?: string | null | undefined; /** * The size of the folder in bytes */ size?: number | null | undefined; /** * Whether the current user can download the contents of this folder */ downloadable?: boolean | null | undefined; owner?: Owner | undefined; /** * The parent folders of the file, starting from the root */ parentFolders: Array; /** * Whether the list of parent folder is complete. Some connectors only return the direct parent of a folder */ parentFoldersComplete?: boolean | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; }; /** @internal */ export const Folder$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), name: types.string(), description: z.nullable(types.string()).optional(), path: z.nullable(types.string()).optional(), size: z.nullable(types.number()).optional(), downloadable: z.nullable(types.boolean()).optional(), owner: types.optional(Owner$inboundSchema), parent_folders: z.array(LinkedFolder$inboundSchema), parent_folders_complete: types.optional(types.boolean()), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "parent_folders": "parentFolders", "parent_folders_complete": "parentFoldersComplete", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function folderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Folder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Folder' from JSON`, ); }