/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomField, CustomField$inboundSchema } from "./customfield.js"; /** * Whether the List is static (a fixed set of records) or dynamic (a saved segment that is automatically kept up to date based on filter criteria). */ export const ListType = { Static: "static", Dynamic: "dynamic", } as const; /** * Whether the List is static (a fixed set of records) or dynamic (a saved segment that is automatically kept up to date based on filter criteria). */ export type ListType = OpenEnum; /** * The visibility of the List. Which of these values a given connector can return depends on its native sharing model — see the connector-specific gotchas below for details. */ export const ListVisibility = { Private: "private", Shared: "shared", Public: "public", } as const; /** * The visibility of the List. Which of these values a given connector can return depends on its native sharing model — see the connector-specific gotchas below for details. */ export type ListVisibility = OpenEnum; export type List = { /** * The unique identifier of the List. */ id: string; /** * The name of the List. */ name: string; /** * The description of the List. */ description?: string | null | undefined; /** * Whether the List is static (a fixed set of records) or dynamic (a saved segment that is automatically kept up to date based on filter criteria). */ type?: ListType | null | undefined; /** * The visibility of the List. Which of these values a given connector can return depends on its native sharing model — see the connector-specific gotchas below for details. */ visibility?: ListVisibility | null | undefined; /** * The unique identifier of the user who owns the List. */ ownerId?: string | null | undefined; /** * The filter criteria used to determine which records belong to a dynamic List. Shape is connector-native and passed through largely as-is (e.g. Close returns its own nested query-tree structure) rather than normalized to a common format. */ filterCriteria?: { [k: string]: any } | null | undefined; /** * The number of records currently in the List. */ recordCount?: number | null | undefined; /** * The unique identifier of the folder the List is organized under. */ folderId?: string | null | undefined; /** * The type of CRM records the List contains. Normalized to a lowercase plural noun for the vendor's standard object types (e.g. contacts, companies, opportunities, leads, tickets, campaigns, tasks, events); for vendor-specific or custom object types the raw downstream identifier is passed through unchanged, following the connector's native casing (e.g. a HubSpot custom objectTypeId like 2-12345 or a Salesforce custom object API name), so a raw value may not always be distinguishable from a normalized one. This field is intentionally open-ended — no closed enum is enforced. */ objectType?: string | null | undefined; /** * Whether the List is dynamic, meaning its records are automatically kept up to date based on filter criteria. This is a boolean mirror of `type` (`true` when `type` is `dynamic`, `false` when `static`), provided for callers that prefer a boolean check over a string comparison. */ isDynamic?: boolean | null | undefined; /** * Whether the List has been marked as a favorite. */ isFavorite?: boolean | null | undefined; /** * Whether the List is a default List. */ isDefault?: boolean | null | undefined; /** * Whether the List is a system-generated List. */ isSystem?: boolean | null | undefined; customFields?: Array | undefined; tags?: Array | null | undefined; /** * The unique identifier of the user who last updated the List. */ updatedBy?: string | null | undefined; /** * The unique identifier of the user who created the List. */ createdBy?: string | null | undefined; /** * The date and time when the List was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the List was created. */ createdAt?: Date | null | undefined; }; /** @internal */ export const ListType$inboundSchema: z.ZodType< ListType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ListType)); /** @internal */ export const ListVisibility$inboundSchema: z.ZodType< ListVisibility, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(ListVisibility)); /** @internal */ export const List$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.string(), name: types.string(), description: z.nullable(types.string()).optional(), type: z.nullable(ListType$inboundSchema).optional(), visibility: z.nullable(ListVisibility$inboundSchema).optional(), owner_id: z.nullable(types.string()).optional(), filter_criteria: z.nullable(z.record(z.any())).optional(), record_count: z.nullable(types.number()).optional(), folder_id: z.nullable(types.string()).optional(), object_type: z.nullable(types.string()).optional(), is_dynamic: z.nullable(types.boolean()).optional(), is_favorite: z.nullable(types.boolean()).optional(), is_default: z.nullable(types.boolean()).optional(), is_system: z.nullable(types.boolean()).optional(), custom_fields: types.optional(z.array(CustomField$inboundSchema)), tags: z.nullable(z.array(types.string())).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, { "owner_id": "ownerId", "filter_criteria": "filterCriteria", "record_count": "recordCount", "folder_id": "folderId", "object_type": "objectType", "is_dynamic": "isDynamic", "is_favorite": "isFavorite", "is_default": "isDefault", "is_system": "isSystem", "custom_fields": "customFields", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function listFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => List$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'List' from JSON`, ); }