UNPKG

attio-js

Version:

Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.

539 lines (488 loc) 17.2 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; export type PutV2ListsListEntriesDataRequest = { /** * A UUID identifying the record you want to add to the list. The record will become the 'parent' of the created list entry. */ parentRecordId: string; /** * A UUID or slug identifying the object that the added parent record belongs to. */ parentObject: string; /** * An object with an attribute `api_slug` or `attribute_id` as the key, and a single value (for single-select attributes), or an array of values (for single or multi-select attributes) as the values. For complete documentation on values for all attribute types, please see our [attribute type docs](/docs/attribute-types). */ entryValues: { [k: string]: any }; }; export type PutV2ListsListEntriesRequestBody = { data: PutV2ListsListEntriesDataRequest; }; export type PutV2ListsListEntriesRequest = { list: string; requestBody: PutV2ListsListEntriesRequestBody; }; export type PutV2ListsListEntriesId = { /** * A UUID identifying the workspace this entry belongs to. */ workspaceId: string; /** * A UUID identifying the list this entry is in. */ listId: string; /** * A UUID identifying this entry. */ entryId: string; }; /** * A list of attribute values for the list entry (not attribute values for its parent record). */ export type PutV2ListsListEntriesEntryValues = {}; export type PutV2ListsListEntriesDataResponse = { id: PutV2ListsListEntriesId; /** * A UUID identifying the record that is parent of the list entry. */ parentRecordId: string; /** * A UUID or slug identifying the object that the parent record belongs to. */ parentObject: string; /** * When this entry was created. */ createdAt: string; /** * A list of attribute values for the list entry (not attribute values for its parent record). */ entryValues: PutV2ListsListEntriesEntryValues; }; /** * Success */ export type PutV2ListsListEntriesResponse = { data: PutV2ListsListEntriesDataResponse; }; /** @internal */ export const PutV2ListsListEntriesDataRequest$inboundSchema: z.ZodType< PutV2ListsListEntriesDataRequest, z.ZodTypeDef, unknown > = z.object({ parent_record_id: z.string(), parent_object: z.string(), entry_values: z.record(z.any()), }).transform((v) => { return remap$(v, { "parent_record_id": "parentRecordId", "parent_object": "parentObject", "entry_values": "entryValues", }); }); /** @internal */ export type PutV2ListsListEntriesDataRequest$Outbound = { parent_record_id: string; parent_object: string; entry_values: { [k: string]: any }; }; /** @internal */ export const PutV2ListsListEntriesDataRequest$outboundSchema: z.ZodType< PutV2ListsListEntriesDataRequest$Outbound, z.ZodTypeDef, PutV2ListsListEntriesDataRequest > = z.object({ parentRecordId: z.string(), parentObject: z.string(), entryValues: z.record(z.any()), }).transform((v) => { return remap$(v, { parentRecordId: "parent_record_id", parentObject: "parent_object", entryValues: "entry_values", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesDataRequest$ { /** @deprecated use `PutV2ListsListEntriesDataRequest$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesDataRequest$inboundSchema; /** @deprecated use `PutV2ListsListEntriesDataRequest$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesDataRequest$outboundSchema; /** @deprecated use `PutV2ListsListEntriesDataRequest$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesDataRequest$Outbound; } export function putV2ListsListEntriesDataRequestToJSON( putV2ListsListEntriesDataRequest: PutV2ListsListEntriesDataRequest, ): string { return JSON.stringify( PutV2ListsListEntriesDataRequest$outboundSchema.parse( putV2ListsListEntriesDataRequest, ), ); } export function putV2ListsListEntriesDataRequestFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesDataRequest, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesDataRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesDataRequest' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesRequestBody$inboundSchema: z.ZodType< PutV2ListsListEntriesRequestBody, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => PutV2ListsListEntriesDataRequest$inboundSchema), }); /** @internal */ export type PutV2ListsListEntriesRequestBody$Outbound = { data: PutV2ListsListEntriesDataRequest$Outbound; }; /** @internal */ export const PutV2ListsListEntriesRequestBody$outboundSchema: z.ZodType< PutV2ListsListEntriesRequestBody$Outbound, z.ZodTypeDef, PutV2ListsListEntriesRequestBody > = z.object({ data: z.lazy(() => PutV2ListsListEntriesDataRequest$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesRequestBody$ { /** @deprecated use `PutV2ListsListEntriesRequestBody$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesRequestBody$inboundSchema; /** @deprecated use `PutV2ListsListEntriesRequestBody$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesRequestBody$outboundSchema; /** @deprecated use `PutV2ListsListEntriesRequestBody$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesRequestBody$Outbound; } export function putV2ListsListEntriesRequestBodyToJSON( putV2ListsListEntriesRequestBody: PutV2ListsListEntriesRequestBody, ): string { return JSON.stringify( PutV2ListsListEntriesRequestBody$outboundSchema.parse( putV2ListsListEntriesRequestBody, ), ); } export function putV2ListsListEntriesRequestBodyFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesRequestBody, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesRequestBody' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesRequest$inboundSchema: z.ZodType< PutV2ListsListEntriesRequest, z.ZodTypeDef, unknown > = z.object({ list: z.string(), RequestBody: z.lazy(() => PutV2ListsListEntriesRequestBody$inboundSchema), }).transform((v) => { return remap$(v, { "RequestBody": "requestBody", }); }); /** @internal */ export type PutV2ListsListEntriesRequest$Outbound = { list: string; RequestBody: PutV2ListsListEntriesRequestBody$Outbound; }; /** @internal */ export const PutV2ListsListEntriesRequest$outboundSchema: z.ZodType< PutV2ListsListEntriesRequest$Outbound, z.ZodTypeDef, PutV2ListsListEntriesRequest > = z.object({ list: z.string(), requestBody: z.lazy(() => PutV2ListsListEntriesRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesRequest$ { /** @deprecated use `PutV2ListsListEntriesRequest$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesRequest$inboundSchema; /** @deprecated use `PutV2ListsListEntriesRequest$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesRequest$outboundSchema; /** @deprecated use `PutV2ListsListEntriesRequest$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesRequest$Outbound; } export function putV2ListsListEntriesRequestToJSON( putV2ListsListEntriesRequest: PutV2ListsListEntriesRequest, ): string { return JSON.stringify( PutV2ListsListEntriesRequest$outboundSchema.parse( putV2ListsListEntriesRequest, ), ); } export function putV2ListsListEntriesRequestFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesRequest, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesRequest' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesId$inboundSchema: z.ZodType< PutV2ListsListEntriesId, z.ZodTypeDef, unknown > = z.object({ workspace_id: z.string(), list_id: z.string(), entry_id: z.string(), }).transform((v) => { return remap$(v, { "workspace_id": "workspaceId", "list_id": "listId", "entry_id": "entryId", }); }); /** @internal */ export type PutV2ListsListEntriesId$Outbound = { workspace_id: string; list_id: string; entry_id: string; }; /** @internal */ export const PutV2ListsListEntriesId$outboundSchema: z.ZodType< PutV2ListsListEntriesId$Outbound, z.ZodTypeDef, PutV2ListsListEntriesId > = z.object({ workspaceId: z.string(), listId: z.string(), entryId: z.string(), }).transform((v) => { return remap$(v, { workspaceId: "workspace_id", listId: "list_id", entryId: "entry_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesId$ { /** @deprecated use `PutV2ListsListEntriesId$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesId$inboundSchema; /** @deprecated use `PutV2ListsListEntriesId$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesId$outboundSchema; /** @deprecated use `PutV2ListsListEntriesId$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesId$Outbound; } export function putV2ListsListEntriesIdToJSON( putV2ListsListEntriesId: PutV2ListsListEntriesId, ): string { return JSON.stringify( PutV2ListsListEntriesId$outboundSchema.parse(putV2ListsListEntriesId), ); } export function putV2ListsListEntriesIdFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesId, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesId' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesEntryValues$inboundSchema: z.ZodType< PutV2ListsListEntriesEntryValues, z.ZodTypeDef, unknown > = z.object({}); /** @internal */ export type PutV2ListsListEntriesEntryValues$Outbound = {}; /** @internal */ export const PutV2ListsListEntriesEntryValues$outboundSchema: z.ZodType< PutV2ListsListEntriesEntryValues$Outbound, z.ZodTypeDef, PutV2ListsListEntriesEntryValues > = z.object({}); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesEntryValues$ { /** @deprecated use `PutV2ListsListEntriesEntryValues$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesEntryValues$inboundSchema; /** @deprecated use `PutV2ListsListEntriesEntryValues$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesEntryValues$outboundSchema; /** @deprecated use `PutV2ListsListEntriesEntryValues$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesEntryValues$Outbound; } export function putV2ListsListEntriesEntryValuesToJSON( putV2ListsListEntriesEntryValues: PutV2ListsListEntriesEntryValues, ): string { return JSON.stringify( PutV2ListsListEntriesEntryValues$outboundSchema.parse( putV2ListsListEntriesEntryValues, ), ); } export function putV2ListsListEntriesEntryValuesFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesEntryValues, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesEntryValues$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesEntryValues' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesDataResponse$inboundSchema: z.ZodType< PutV2ListsListEntriesDataResponse, z.ZodTypeDef, unknown > = z.object({ id: z.lazy(() => PutV2ListsListEntriesId$inboundSchema), parent_record_id: z.string(), parent_object: z.string(), created_at: z.string(), entry_values: z.lazy(() => PutV2ListsListEntriesEntryValues$inboundSchema), }).transform((v) => { return remap$(v, { "parent_record_id": "parentRecordId", "parent_object": "parentObject", "created_at": "createdAt", "entry_values": "entryValues", }); }); /** @internal */ export type PutV2ListsListEntriesDataResponse$Outbound = { id: PutV2ListsListEntriesId$Outbound; parent_record_id: string; parent_object: string; created_at: string; entry_values: PutV2ListsListEntriesEntryValues$Outbound; }; /** @internal */ export const PutV2ListsListEntriesDataResponse$outboundSchema: z.ZodType< PutV2ListsListEntriesDataResponse$Outbound, z.ZodTypeDef, PutV2ListsListEntriesDataResponse > = z.object({ id: z.lazy(() => PutV2ListsListEntriesId$outboundSchema), parentRecordId: z.string(), parentObject: z.string(), createdAt: z.string(), entryValues: z.lazy(() => PutV2ListsListEntriesEntryValues$outboundSchema), }).transform((v) => { return remap$(v, { parentRecordId: "parent_record_id", parentObject: "parent_object", createdAt: "created_at", entryValues: "entry_values", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesDataResponse$ { /** @deprecated use `PutV2ListsListEntriesDataResponse$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesDataResponse$inboundSchema; /** @deprecated use `PutV2ListsListEntriesDataResponse$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesDataResponse$outboundSchema; /** @deprecated use `PutV2ListsListEntriesDataResponse$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesDataResponse$Outbound; } export function putV2ListsListEntriesDataResponseToJSON( putV2ListsListEntriesDataResponse: PutV2ListsListEntriesDataResponse, ): string { return JSON.stringify( PutV2ListsListEntriesDataResponse$outboundSchema.parse( putV2ListsListEntriesDataResponse, ), ); } export function putV2ListsListEntriesDataResponseFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesDataResponse, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesDataResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesDataResponse' from JSON`, ); } /** @internal */ export const PutV2ListsListEntriesResponse$inboundSchema: z.ZodType< PutV2ListsListEntriesResponse, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => PutV2ListsListEntriesDataResponse$inboundSchema), }); /** @internal */ export type PutV2ListsListEntriesResponse$Outbound = { data: PutV2ListsListEntriesDataResponse$Outbound; }; /** @internal */ export const PutV2ListsListEntriesResponse$outboundSchema: z.ZodType< PutV2ListsListEntriesResponse$Outbound, z.ZodTypeDef, PutV2ListsListEntriesResponse > = z.object({ data: z.lazy(() => PutV2ListsListEntriesDataResponse$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PutV2ListsListEntriesResponse$ { /** @deprecated use `PutV2ListsListEntriesResponse$inboundSchema` instead. */ export const inboundSchema = PutV2ListsListEntriesResponse$inboundSchema; /** @deprecated use `PutV2ListsListEntriesResponse$outboundSchema` instead. */ export const outboundSchema = PutV2ListsListEntriesResponse$outboundSchema; /** @deprecated use `PutV2ListsListEntriesResponse$Outbound` instead. */ export type Outbound = PutV2ListsListEntriesResponse$Outbound; } export function putV2ListsListEntriesResponseToJSON( putV2ListsListEntriesResponse: PutV2ListsListEntriesResponse, ): string { return JSON.stringify( PutV2ListsListEntriesResponse$outboundSchema.parse( putV2ListsListEntriesResponse, ), ); } export function putV2ListsListEntriesResponseFromJSON( jsonString: string, ): SafeParseResult<PutV2ListsListEntriesResponse, SDKValidationError> { return safeParse( jsonString, (x) => PutV2ListsListEntriesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutV2ListsListEntriesResponse' from JSON`, ); }