/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 6b7ae89f7516 */ import * as z from "zod/v3"; import { 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Collection, Collection$inboundSchema } from "./collection.js"; import { CollectionError, CollectionError$inboundSchema, } from "./collectionerror.js"; import { CollectionItem, CollectionItem$inboundSchema, } from "./collectionitem.js"; import { CollectionPinnedMetadata, CollectionPinnedMetadata$inboundSchema, } from "./collectionpinnedmetadata.js"; import { FacetFilter, FacetFilter$inboundSchema } from "./facetfilter.js"; import { ObjectPermissions, ObjectPermissions$inboundSchema, } from "./objectpermissions.js"; import { Person, Person$inboundSchema } from "./person.js"; import { Thumbnail, Thumbnail$inboundSchema } from "./thumbnail.js"; import { UserRoleSpecification, UserRoleSpecification$inboundSchema, } from "./userrolespecification.js"; export const EditCollectionResponseErrorCode = { NameExists: "NAME_EXISTS", NotFound: "NOT_FOUND", CollectionPinned: "COLLECTION_PINNED", ConcurrentHierarchyEdit: "CONCURRENT_HIERARCHY_EDIT", HeightViolation: "HEIGHT_VIOLATION", WidthViolation: "WIDTH_VIOLATION", NoPermissions: "NO_PERMISSIONS", } as const; export type EditCollectionResponseErrorCode = OpenEnum< typeof EditCollectionResponseErrorCode >; export type EditCollectionResponse = { /** * The unique name of the Collection. */ name: string; /** * A brief summary of the Collection's contents. */ description: string; /** * A list of added user roles for the Collection. */ addedRoles?: Array | undefined; /** * A list of removed user roles for the Collection. */ removedRoles?: Array | undefined; /** * Filters which restrict who should see this Collection. Values are taken from the corresponding filters in people search. */ audienceFilters?: Array | undefined; /** * The emoji icon of this Collection. */ icon?: string | undefined; /** * Indicates whether edits are allowed for everyone or only admins. */ adminLocked?: boolean | undefined; /** * The parent of this Collection, or 0 if it's a top-level Collection. */ parentId?: number | undefined; thumbnail?: Thumbnail | undefined; /** * The datasource type this Collection can hold. */ allowedDatasource?: string | undefined; permissions?: ObjectPermissions | undefined; /** * The unique ID of the Collection. */ id: number; createTime?: Date | undefined; updateTime?: Date | undefined; creator?: Person | undefined; updatedBy?: Person | undefined; /** * The number of items currently in the Collection. Separated from the actual items so we can grab the count without items. */ itemCount?: number | undefined; /** * The number of children Collections. Separated from the actual children so we can grab the count without children. */ childCount?: number | undefined; /** * The items in this Collection. */ items?: Array | undefined; pinMetadata?: CollectionPinnedMetadata | undefined; /** * The names of the shortcuts (Go Links) that point to this Collection. */ shortcuts?: Array | undefined; /** * The children Collections of this Collection. */ children?: Array | undefined; /** * A list of user roles for the Collection. */ roles?: Array | undefined; errorCode: EditCollectionResponseErrorCode; collection?: Collection | undefined; error?: CollectionError | undefined; }; /** @internal */ export const EditCollectionResponseErrorCode$inboundSchema: z.ZodType< EditCollectionResponseErrorCode, z.ZodTypeDef, unknown > = openEnums.inboundSchema(EditCollectionResponseErrorCode); /** @internal */ export const EditCollectionResponse$inboundSchema: z.ZodType< EditCollectionResponse, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.string(), addedRoles: z.array(UserRoleSpecification$inboundSchema).optional(), removedRoles: z.array(UserRoleSpecification$inboundSchema).optional(), audienceFilters: z.array(FacetFilter$inboundSchema).optional(), icon: z.string().optional(), adminLocked: z.boolean().optional(), parentId: z.number().int().optional(), thumbnail: Thumbnail$inboundSchema.optional(), allowedDatasource: z.string().optional(), permissions: ObjectPermissions$inboundSchema.optional(), id: z.number().int(), createTime: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updateTime: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), creator: Person$inboundSchema.optional(), updatedBy: Person$inboundSchema.optional(), itemCount: z.number().int().optional(), childCount: z.number().int().optional(), items: z.array(CollectionItem$inboundSchema).optional(), pinMetadata: CollectionPinnedMetadata$inboundSchema.optional(), shortcuts: z.array(z.string()).optional(), children: z.array(Collection$inboundSchema).optional(), roles: z.array(UserRoleSpecification$inboundSchema).optional(), errorCode: EditCollectionResponseErrorCode$inboundSchema, collection: Collection$inboundSchema.optional(), error: CollectionError$inboundSchema.optional(), }); export function editCollectionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EditCollectionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EditCollectionResponse' from JSON`, ); }