UNPKG

attio-js

Version:

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

404 lines (370 loc) 14.8 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { Status, Status$inboundSchema, Status$Outbound, Status$outboundSchema, } from "../components/status.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Whether the attribute is on an object or a list. Please note that company and person objects do not support status attributes at this time. */ export const PostV2TargetIdentifierAttributesAttributeStatusesTarget = { Lists: "lists", Objects: "objects", } as const; /** * Whether the attribute is on an object or a list. Please note that company and person objects do not support status attributes at this time. */ export type PostV2TargetIdentifierAttributesAttributeStatusesTarget = ClosedEnum<typeof PostV2TargetIdentifierAttributesAttributeStatusesTarget>; export type PostV2TargetIdentifierAttributesAttributeStatusesData = { /** * The Title of the status */ title: string; /** * Whether arriving at this status triggers a celebration effect */ celebrationEnabled?: boolean | undefined; /** * Target time for a record to spend in given status expressed as a ISO-8601 duration string */ targetTimeInStatus?: string | null | undefined; }; export type PostV2TargetIdentifierAttributesAttributeStatusesRequestBody = { data: PostV2TargetIdentifierAttributesAttributeStatusesData; }; export type PostV2TargetIdentifierAttributesAttributeStatusesRequest = { /** * Whether the attribute is on an object or a list. Please note that company and person objects do not support status attributes at this time. */ target: PostV2TargetIdentifierAttributesAttributeStatusesTarget; identifier: string; attribute: string; requestBody: PostV2TargetIdentifierAttributesAttributeStatusesRequestBody; }; /** * Success */ export type PostV2TargetIdentifierAttributesAttributeStatusesResponse = { data: Status; }; /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema: z.ZodNativeEnum< typeof PostV2TargetIdentifierAttributesAttributeStatusesTarget > = z.nativeEnum(PostV2TargetIdentifierAttributesAttributeStatusesTarget); /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema: z.ZodNativeEnum< typeof PostV2TargetIdentifierAttributesAttributeStatusesTarget > = PostV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesAttributeStatusesTarget$ { /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesData$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesData, z.ZodTypeDef, unknown > = z.object({ title: z.string(), celebration_enabled: z.boolean().default(false), target_time_in_status: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "celebration_enabled": "celebrationEnabled", "target_time_in_status": "targetTimeInStatus", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesAttributeStatusesData$Outbound = { title: string; celebration_enabled: boolean; target_time_in_status?: string | null | undefined; }; /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesData$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesData$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesAttributeStatusesData > = z.object({ title: z.string(), celebrationEnabled: z.boolean().default(false), targetTimeInStatus: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { celebrationEnabled: "celebration_enabled", targetTimeInStatus: "target_time_in_status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesAttributeStatusesData$ { /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesData$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesData$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesData$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesData$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesData$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesAttributeStatusesData$Outbound; } export function postV2TargetIdentifierAttributesAttributeStatusesDataToJSON( postV2TargetIdentifierAttributesAttributeStatusesData: PostV2TargetIdentifierAttributesAttributeStatusesData, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesAttributeStatusesData$outboundSchema.parse( postV2TargetIdentifierAttributesAttributeStatusesData, ), ); } export function postV2TargetIdentifierAttributesAttributeStatusesDataFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesAttributeStatusesData, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesAttributeStatusesData$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesAttributeStatusesData' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesRequestBody, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => PostV2TargetIdentifierAttributesAttributeStatusesData$inboundSchema ), }); /** @internal */ export type PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$Outbound = { data: PostV2TargetIdentifierAttributesAttributeStatusesData$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesAttributeStatusesRequestBody > = z.object({ data: z.lazy(() => PostV2TargetIdentifierAttributesAttributeStatusesData$outboundSchema ), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$ { /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$Outbound; } export function postV2TargetIdentifierAttributesAttributeStatusesRequestBodyToJSON( postV2TargetIdentifierAttributesAttributeStatusesRequestBody: PostV2TargetIdentifierAttributesAttributeStatusesRequestBody, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$outboundSchema .parse(postV2TargetIdentifierAttributesAttributeStatusesRequestBody), ); } export function postV2TargetIdentifierAttributesAttributeStatusesRequestBodyFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesAttributeStatusesRequestBody, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostV2TargetIdentifierAttributesAttributeStatusesRequestBody' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesRequest, z.ZodTypeDef, unknown > = z.object({ target: PostV2TargetIdentifierAttributesAttributeStatusesTarget$inboundSchema, identifier: z.string(), attribute: z.string(), RequestBody: z.lazy(() => PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$inboundSchema ), }).transform((v) => { return remap$(v, { "RequestBody": "requestBody", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound = { target: string; identifier: string; attribute: string; RequestBody: PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesAttributeStatusesRequest > = z.object({ target: PostV2TargetIdentifierAttributesAttributeStatusesTarget$outboundSchema, identifier: z.string(), attribute: z.string(), requestBody: z.lazy(() => PostV2TargetIdentifierAttributesAttributeStatusesRequestBody$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 PostV2TargetIdentifierAttributesAttributeStatusesRequest$ { /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesAttributeStatusesRequest$Outbound; } export function postV2TargetIdentifierAttributesAttributeStatusesRequestToJSON( postV2TargetIdentifierAttributesAttributeStatusesRequest: PostV2TargetIdentifierAttributesAttributeStatusesRequest, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesAttributeStatusesRequest$outboundSchema .parse(postV2TargetIdentifierAttributesAttributeStatusesRequest), ); } export function postV2TargetIdentifierAttributesAttributeStatusesRequestFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesAttributeStatusesRequest, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesAttributeStatusesRequest$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostV2TargetIdentifierAttributesAttributeStatusesRequest' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesResponse, z.ZodTypeDef, unknown > = z.object({ data: Status$inboundSchema, }); /** @internal */ export type PostV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound = { data: Status$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesAttributeStatusesResponse > = z.object({ data: Status$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesAttributeStatusesResponse$ { /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesAttributeStatusesResponse$Outbound; } export function postV2TargetIdentifierAttributesAttributeStatusesResponseToJSON( postV2TargetIdentifierAttributesAttributeStatusesResponse: PostV2TargetIdentifierAttributesAttributeStatusesResponse, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesAttributeStatusesResponse$outboundSchema .parse(postV2TargetIdentifierAttributesAttributeStatusesResponse), ); } export function postV2TargetIdentifierAttributesAttributeStatusesResponseFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesAttributeStatusesResponse, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesAttributeStatusesResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PostV2TargetIdentifierAttributesAttributeStatusesResponse' from JSON`, ); }