/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Input data for creating or updating a subfolder. */ export type PostFoldersFolderIdSubfoldersRequestBody = { /** * The display name of the subfolder. */ name: string; /** * A description for the subfolder. */ description?: string | null | undefined; }; export type PostFoldersFolderIdSubfoldersRequest = { /** * The hashed ID of the folder */ folderId: string; /** * Subfolder data */ requestBody: PostFoldersFolderIdSubfoldersRequestBody; }; /** * A subfolder within a folder that contains media. */ export type PostFoldersFolderIdSubfoldersResponse = { /** * A unique alphanumeric identifier for this subfolder. */ hashedId: string; /** * The display name of the subfolder. */ name?: string | null | undefined; /** * A description for the subfolder. */ description?: string | null | undefined; /** * The position of this subfolder within its folder, used for ordering. */ position: number | null; /** * The date when the subfolder was created. */ created: Date | null; /** * The date when the subfolder was last modified. */ updated: Date | null; /** * A cursor for stable pagination based on current `sort_by` order. You can pass this to `cursor[before]` or `cursor[after]` as a parameter to fetch the records before or after this record in the same sort order. This is only populated if records were fetched with `cursor[enabled]`, or `cursor[before]` or `cursor[after]`. */ cursor?: string | null | undefined; }; /** @internal */ export type PostFoldersFolderIdSubfoldersRequestBody$Outbound = { name: string; description?: string | null | undefined; }; /** @internal */ export const PostFoldersFolderIdSubfoldersRequestBody$outboundSchema: z.ZodType< PostFoldersFolderIdSubfoldersRequestBody$Outbound, z.ZodTypeDef, PostFoldersFolderIdSubfoldersRequestBody > = z.object({ name: z.string(), description: z.nullable(z.string()).optional(), }); export function postFoldersFolderIdSubfoldersRequestBodyToJSON( postFoldersFolderIdSubfoldersRequestBody: PostFoldersFolderIdSubfoldersRequestBody, ): string { return JSON.stringify( PostFoldersFolderIdSubfoldersRequestBody$outboundSchema.parse( postFoldersFolderIdSubfoldersRequestBody, ), ); } /** @internal */ export type PostFoldersFolderIdSubfoldersRequest$Outbound = { folderId: string; RequestBody: PostFoldersFolderIdSubfoldersRequestBody$Outbound; }; /** @internal */ export const PostFoldersFolderIdSubfoldersRequest$outboundSchema: z.ZodType< PostFoldersFolderIdSubfoldersRequest$Outbound, z.ZodTypeDef, PostFoldersFolderIdSubfoldersRequest > = z.object({ folderId: z.string(), requestBody: z.lazy(() => PostFoldersFolderIdSubfoldersRequestBody$outboundSchema ), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function postFoldersFolderIdSubfoldersRequestToJSON( postFoldersFolderIdSubfoldersRequest: PostFoldersFolderIdSubfoldersRequest, ): string { return JSON.stringify( PostFoldersFolderIdSubfoldersRequest$outboundSchema.parse( postFoldersFolderIdSubfoldersRequest, ), ); } /** @internal */ export const PostFoldersFolderIdSubfoldersResponse$inboundSchema: z.ZodType< PostFoldersFolderIdSubfoldersResponse, z.ZodTypeDef, unknown > = z.object({ hashed_id: z.string(), name: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), position: z.nullable(z.number().int()), created: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), updated: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), cursor: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", }); }); export function postFoldersFolderIdSubfoldersResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostFoldersFolderIdSubfoldersResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostFoldersFolderIdSubfoldersResponse' from JSON`, ); }