UNPKG

attio-js

Version:

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

425 lines (391 loc) 16.1 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 PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget = { 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 PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget = ClosedEnum< typeof PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget >; export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusData = { /** * The Title of the status */ title?: string | undefined; /** * 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; /** * Whether or not to archive the status. See our [archiving guide](/docs/archiving-vs-deleting) for more information on archiving. */ isArchived?: boolean | undefined; }; export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody = { data: PatchV2TargetIdentifierAttributesAttributeStatusesStatusData; }; export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest = { /** * 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: PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget; identifier: string; attribute: string; status: string; requestBody: PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody; }; /** * Success */ export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse = { data: Status; }; /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$inboundSchema: z.ZodNativeEnum< typeof PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget > = z.nativeEnum( PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget, ); /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$outboundSchema: z.ZodNativeEnum< typeof PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget > = PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$ { /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$inboundSchema` instead. */ export const inboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$inboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$outboundSchema` instead. */ export const outboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$outboundSchema; } /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$inboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusData, z.ZodTypeDef, unknown > = z.object({ title: z.string().optional(), celebration_enabled: z.boolean().default(false), target_time_in_status: z.nullable(z.string()).optional(), is_archived: z.boolean().optional(), }).transform((v) => { return remap$(v, { "celebration_enabled": "celebrationEnabled", "target_time_in_status": "targetTimeInStatus", "is_archived": "isArchived", }); }); /** @internal */ export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$Outbound = { title?: string | undefined; celebration_enabled: boolean; target_time_in_status?: string | null | undefined; is_archived?: boolean | undefined; }; /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$outboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$Outbound, z.ZodTypeDef, PatchV2TargetIdentifierAttributesAttributeStatusesStatusData > = z.object({ title: z.string().optional(), celebrationEnabled: z.boolean().default(false), targetTimeInStatus: z.nullable(z.string()).optional(), isArchived: z.boolean().optional(), }).transform((v) => { return remap$(v, { celebrationEnabled: "celebration_enabled", targetTimeInStatus: "target_time_in_status", isArchived: "is_archived", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$ { /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$inboundSchema` instead. */ export const inboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$inboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$outboundSchema` instead. */ export const outboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$outboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$Outbound` instead. */ export type Outbound = PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$Outbound; } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusDataToJSON( patchV2TargetIdentifierAttributesAttributeStatusesStatusData: PatchV2TargetIdentifierAttributesAttributeStatusesStatusData, ): string { return JSON.stringify( PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$outboundSchema .parse(patchV2TargetIdentifierAttributesAttributeStatusesStatusData), ); } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusDataFromJSON( jsonString: string, ): SafeParseResult< PatchV2TargetIdentifierAttributesAttributeStatusesStatusData, SDKValidationError > { return safeParse( jsonString, (x) => PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PatchV2TargetIdentifierAttributesAttributeStatusesStatusData' from JSON`, ); } /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$inboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$inboundSchema ), }); /** @internal */ export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$Outbound = { data: PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$Outbound; }; /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$outboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$Outbound, z.ZodTypeDef, PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody > = z.object({ data: z.lazy(() => PatchV2TargetIdentifierAttributesAttributeStatusesStatusData$outboundSchema ), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$ { /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$inboundSchema` instead. */ export const inboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$inboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$outboundSchema` instead. */ export const outboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$outboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$Outbound` instead. */ export type Outbound = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$Outbound; } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBodyToJSON( patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody: PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody, ): string { return JSON.stringify( PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$outboundSchema .parse( patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody, ), ); } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBodyFromJSON( jsonString: string, ): SafeParseResult< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody, SDKValidationError > { return safeParse( jsonString, (x) => PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody' from JSON`, ); } /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$inboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest, z.ZodTypeDef, unknown > = z.object({ target: PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$inboundSchema, identifier: z.string(), attribute: z.string(), status: z.string(), RequestBody: z.lazy(() => PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$inboundSchema ), }).transform((v) => { return remap$(v, { "RequestBody": "requestBody", }); }); /** @internal */ export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$Outbound = { target: string; identifier: string; attribute: string; status: string; RequestBody: PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$Outbound; }; /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$outboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$Outbound, z.ZodTypeDef, PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest > = z.object({ target: PatchV2TargetIdentifierAttributesAttributeStatusesStatusTarget$outboundSchema, identifier: z.string(), attribute: z.string(), status: z.string(), requestBody: z.lazy(() => PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequestBody$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 PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$ { /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$inboundSchema` instead. */ export const inboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$inboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$outboundSchema` instead. */ export const outboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$outboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$Outbound` instead. */ export type Outbound = PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$Outbound; } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestToJSON( patchV2TargetIdentifierAttributesAttributeStatusesStatusRequest: PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest, ): string { return JSON.stringify( PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$outboundSchema .parse(patchV2TargetIdentifierAttributesAttributeStatusesStatusRequest), ); } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusRequestFromJSON( jsonString: string, ): SafeParseResult< PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest, SDKValidationError > { return safeParse( jsonString, (x) => PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PatchV2TargetIdentifierAttributesAttributeStatusesStatusRequest' from JSON`, ); } /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$inboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse, z.ZodTypeDef, unknown > = z.object({ data: Status$inboundSchema, }); /** @internal */ export type PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$Outbound = { data: Status$Outbound; }; /** @internal */ export const PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$outboundSchema: z.ZodType< PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$Outbound, z.ZodTypeDef, PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse > = 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 PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$ { /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$inboundSchema` instead. */ export const inboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$inboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$outboundSchema` instead. */ export const outboundSchema = PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$outboundSchema; /** @deprecated use `PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$Outbound` instead. */ export type Outbound = PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$Outbound; } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusResponseToJSON( patchV2TargetIdentifierAttributesAttributeStatusesStatusResponse: PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse, ): string { return JSON.stringify( PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$outboundSchema .parse(patchV2TargetIdentifierAttributesAttributeStatusesStatusResponse), ); } export function patchV2TargetIdentifierAttributesAttributeStatusesStatusResponseFromJSON( jsonString: string, ): SafeParseResult< PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse, SDKValidationError > { return safeParse( jsonString, (x) => PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PatchV2TargetIdentifierAttributesAttributeStatusesStatusResponse' from JSON`, ); }