UNPKG

attio-js

Version:

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

1,219 lines (1,119 loc) 43.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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { Attribute, Attribute$inboundSchema, Attribute$Outbound, Attribute$outboundSchema, } from "../components/attribute.js"; import { InputValueUnion, InputValueUnion$inboundSchema, InputValueUnion$Outbound, InputValueUnion$outboundSchema, } from "../components/inputvalueunion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Whether the attribute is to be created on an object or a list. */ export const PostV2TargetIdentifierAttributesTarget = { Objects: "objects", Lists: "lists", } as const; /** * Whether the attribute is to be created on an object or a list. */ export type PostV2TargetIdentifierAttributesTarget = ClosedEnum< typeof PostV2TargetIdentifierAttributesTarget >; /** * The type of the attribute. This value affects the possible `config` values. Attributes of type "status" are not supported on objects. */ export const PostV2TargetIdentifierAttributesType = { Text: "text", Number: "number", Checkbox: "checkbox", Currency: "currency", Date: "date", Timestamp: "timestamp", Rating: "rating", Status: "status", Select: "select", RecordReference: "record-reference", ActorReference: "actor-reference", Location: "location", Domain: "domain", EmailAddress: "email-address", PhoneNumber: "phone-number", } as const; /** * The type of the attribute. This value affects the possible `config` values. Attributes of type "status" are not supported on objects. */ export type PostV2TargetIdentifierAttributesType = ClosedEnum< typeof PostV2TargetIdentifierAttributesType >; export const PostV2TargetIdentifierAttributesTypeStatic = { Static: "static", } as const; export type PostV2TargetIdentifierAttributesTypeStatic = ClosedEnum< typeof PostV2TargetIdentifierAttributesTypeStatic >; export type PostV2TargetIdentifierAttributesDefaultValueStatic = { type: PostV2TargetIdentifierAttributesTypeStatic; template: Array<InputValueUnion>; }; export const PostV2TargetIdentifierAttributesTypeDynamic = { Dynamic: "dynamic", } as const; export type PostV2TargetIdentifierAttributesTypeDynamic = ClosedEnum< typeof PostV2TargetIdentifierAttributesTypeDynamic >; /** * For actor reference attributes, you may pass a dynamic value of `"current-user"`. When creating new records or entries, this will cause the actor reference value to be populated with either the workspace member or API token that created the record/entry. */ export const PostV2TargetIdentifierAttributesTemplate = { CurrentUser: "current-user", } as const; /** * For actor reference attributes, you may pass a dynamic value of `"current-user"`. When creating new records or entries, this will cause the actor reference value to be populated with either the workspace member or API token that created the record/entry. */ export type PostV2TargetIdentifierAttributesTemplate = ClosedEnum< typeof PostV2TargetIdentifierAttributesTemplate >; export type PostV2TargetIdentifierAttributesDefaultValueDynamic = { type: PostV2TargetIdentifierAttributesTypeDynamic; template?: any | undefined; }; /** * The default value for this attribute. Static values are used to directly populate values using their contents. Dynamic values are used to lookup data at the point of creation. For example, you could use a dynamic value to insert a value for the currently logged in user. Which default values are available is dependent on the type of the attribute. Default values are not currently supported on people or company objects. */ export type PostV2TargetIdentifierAttributesDefaultValueUnion = | PostV2TargetIdentifierAttributesDefaultValueDynamic | PostV2TargetIdentifierAttributesDefaultValueStatic; /** * The ISO4217 code representing the currency that values for this attribute should be stored in. */ export const PostV2TargetIdentifierAttributesDefaultCurrencyCode = { Aud: "AUD", Brl: "BRL", Bel: "BEL", Cad: "CAD", Cny: "CNY", Cop: "COP", Czk: "CZK", Dkk: "DKK", Eur: "EUR", Hkd: "HKD", Isk: "ISK", Inr: "INR", Ils: "ILS", Jpy: "JPY", Krw: "KRW", Myr: "MYR", Mxn: "MXN", Ntd: "NTD", Nzd: "NZD", Ngn: "NGN", Nok: "NOK", Xpf: "XPF", Pen: "PEN", Php: "PHP", Pln: "PLN", Gbp: "GBP", Sar: "SAR", Sgd: "SGD", Zar: "ZAR", Sek: "SEK", Chf: "CHF", Aed: "AED", Usd: "USD", } as const; /** * The ISO4217 code representing the currency that values for this attribute should be stored in. */ export type PostV2TargetIdentifierAttributesDefaultCurrencyCode = ClosedEnum< typeof PostV2TargetIdentifierAttributesDefaultCurrencyCode >; /** * How the currency should be displayed across the app. "code" will display the ISO currency code e.g. "USD", "name" will display the localized currency name e.g. "British pound", "narrowSymbol" will display "$1" instead of "US$1" and "symbol" will display a localized currency symbol such as "$". */ export const PostV2TargetIdentifierAttributesDisplayType = { Code: "code", Name: "name", NarrowSymbol: "narrowSymbol", Symbol: "symbol", } as const; /** * How the currency should be displayed across the app. "code" will display the ISO currency code e.g. "USD", "name" will display the localized currency name e.g. "British pound", "narrowSymbol" will display "$1" instead of "US$1" and "symbol" will display a localized currency symbol such as "$". */ export type PostV2TargetIdentifierAttributesDisplayType = ClosedEnum< typeof PostV2TargetIdentifierAttributesDisplayType >; /** * Configuration available for attributes of type "currency". */ export type PostV2TargetIdentifierAttributesCurrency = { /** * The ISO4217 code representing the currency that values for this attribute should be stored in. */ defaultCurrencyCode: PostV2TargetIdentifierAttributesDefaultCurrencyCode; /** * How the currency should be displayed across the app. "code" will display the ISO currency code e.g. "USD", "name" will display the localized currency name e.g. "British pound", "narrowSymbol" will display "$1" instead of "US$1" and "symbol" will display a localized currency symbol such as "$". */ displayType: PostV2TargetIdentifierAttributesDisplayType; }; /** * Configuration available for attributes of type "record-reference". */ export type PostV2TargetIdentifierAttributesRecordReference = { /** * A list of slugs or UUIDs to indicate which objects records are allowed to belong to. Leave empty to to allow records from all object types. */ allowedObjects: Array<string>; }; export type PostV2TargetIdentifierAttributesConfig = { /** * Configuration available for attributes of type "currency". */ currency?: PostV2TargetIdentifierAttributesCurrency | undefined; /** * Configuration available for attributes of type "record-reference". */ recordReference?: PostV2TargetIdentifierAttributesRecordReference | undefined; }; export type PostV2TargetIdentifierAttributesData = { /** * The name of the attribute. The title will be visible across Attio's UI. */ title: string; /** * A text description for the attribute. */ description: string | null; /** * A unique, human-readable slug to access the attribute through URLs and API calls. Formatted in snake case. */ apiSlug: string; /** * The type of the attribute. This value affects the possible `config` values. Attributes of type "status" are not supported on objects. */ type: PostV2TargetIdentifierAttributesType; /** * When `is_required` is `true`, new records/entries must have a value for this attribute. If `false`, values may be `null`. This value does not affect existing data and you do not need to backfill `null` values if changing `is_required` from `false` to `true`. */ isRequired: boolean; /** * Whether or not new values for this attribute must be unique. Uniqueness restrictions are only applied to new data and do not apply retroactively to previously created data. */ isUnique: boolean; /** * Whether or not this attribute can have multiple values. Multiselect is only available on some value types. */ isMultiselect: boolean; /** * The default value for this attribute. Static values are used to directly populate values using their contents. Dynamic values are used to lookup data at the point of creation. For example, you could use a dynamic value to insert a value for the currently logged in user. Which default values are available is dependent on the type of the attribute. Default values are not currently supported on people or company objects. */ defaultValue?: | PostV2TargetIdentifierAttributesDefaultValueDynamic | PostV2TargetIdentifierAttributesDefaultValueStatic | null | undefined; config: PostV2TargetIdentifierAttributesConfig; }; export type PostV2TargetIdentifierAttributesRequestBody = { data: PostV2TargetIdentifierAttributesData; }; export type PostV2TargetIdentifierAttributesRequest = { /** * Whether the attribute is to be created on an object or a list. */ target: PostV2TargetIdentifierAttributesTarget; identifier: string; requestBody: PostV2TargetIdentifierAttributesRequestBody; }; /** * Success */ export type PostV2TargetIdentifierAttributesResponse = { data: Attribute; }; /** @internal */ export const PostV2TargetIdentifierAttributesTarget$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTarget> = z.nativeEnum( PostV2TargetIdentifierAttributesTarget, ); /** @internal */ export const PostV2TargetIdentifierAttributesTarget$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTarget> = PostV2TargetIdentifierAttributesTarget$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesTarget$ { /** @deprecated use `PostV2TargetIdentifierAttributesTarget$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesTarget$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesTarget$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesTarget$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesType$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesType> = z.nativeEnum( PostV2TargetIdentifierAttributesType, ); /** @internal */ export const PostV2TargetIdentifierAttributesType$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesType> = PostV2TargetIdentifierAttributesType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesType$ { /** @deprecated use `PostV2TargetIdentifierAttributesType$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesType$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesType$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesType$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesTypeStatic$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTypeStatic> = z .nativeEnum(PostV2TargetIdentifierAttributesTypeStatic); /** @internal */ export const PostV2TargetIdentifierAttributesTypeStatic$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTypeStatic> = PostV2TargetIdentifierAttributesTypeStatic$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesTypeStatic$ { /** @deprecated use `PostV2TargetIdentifierAttributesTypeStatic$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesTypeStatic$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesTypeStatic$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesTypeStatic$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueStatic, z.ZodTypeDef, unknown > = z.object({ type: PostV2TargetIdentifierAttributesTypeStatic$inboundSchema, template: z.array(InputValueUnion$inboundSchema), }); /** @internal */ export type PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound = { type: string; template: Array<InputValueUnion$Outbound>; }; /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesDefaultValueStatic > = z.object({ type: PostV2TargetIdentifierAttributesTypeStatic$outboundSchema, template: z.array(InputValueUnion$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesDefaultValueStatic$ { /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound; } export function postV2TargetIdentifierAttributesDefaultValueStaticToJSON( postV2TargetIdentifierAttributesDefaultValueStatic: PostV2TargetIdentifierAttributesDefaultValueStatic, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema.parse( postV2TargetIdentifierAttributesDefaultValueStatic, ), ); } export function postV2TargetIdentifierAttributesDefaultValueStaticFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesDefaultValueStatic, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesDefaultValueStatic' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesTypeDynamic$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTypeDynamic> = z .nativeEnum(PostV2TargetIdentifierAttributesTypeDynamic); /** @internal */ export const PostV2TargetIdentifierAttributesTypeDynamic$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTypeDynamic> = PostV2TargetIdentifierAttributesTypeDynamic$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesTypeDynamic$ { /** @deprecated use `PostV2TargetIdentifierAttributesTypeDynamic$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesTypeDynamic$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesTypeDynamic$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesTypeDynamic$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesTemplate$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTemplate> = z .nativeEnum(PostV2TargetIdentifierAttributesTemplate); /** @internal */ export const PostV2TargetIdentifierAttributesTemplate$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesTemplate> = PostV2TargetIdentifierAttributesTemplate$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesTemplate$ { /** @deprecated use `PostV2TargetIdentifierAttributesTemplate$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesTemplate$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesTemplate$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesTemplate$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueDynamic, z.ZodTypeDef, unknown > = z.object({ type: PostV2TargetIdentifierAttributesTypeDynamic$inboundSchema, template: z.any().optional(), }); /** @internal */ export type PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound = { type: string; template?: any | undefined; }; /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesDefaultValueDynamic > = z.object({ type: PostV2TargetIdentifierAttributesTypeDynamic$outboundSchema, template: z.any().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesDefaultValueDynamic$ { /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound; } export function postV2TargetIdentifierAttributesDefaultValueDynamicToJSON( postV2TargetIdentifierAttributesDefaultValueDynamic: PostV2TargetIdentifierAttributesDefaultValueDynamic, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema.parse( postV2TargetIdentifierAttributesDefaultValueDynamic, ), ); } export function postV2TargetIdentifierAttributesDefaultValueDynamicFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesDefaultValueDynamic, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesDefaultValueDynamic' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueUnion$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueUnion, z.ZodTypeDef, unknown > = z.union([ z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema ), z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema ), ]); /** @internal */ export type PostV2TargetIdentifierAttributesDefaultValueUnion$Outbound = | PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound | PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound; /** @internal */ export const PostV2TargetIdentifierAttributesDefaultValueUnion$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesDefaultValueUnion$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesDefaultValueUnion > = z.union([ z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema ), z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema ), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesDefaultValueUnion$ { /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueUnion$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesDefaultValueUnion$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueUnion$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesDefaultValueUnion$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultValueUnion$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesDefaultValueUnion$Outbound; } export function postV2TargetIdentifierAttributesDefaultValueUnionToJSON( postV2TargetIdentifierAttributesDefaultValueUnion: PostV2TargetIdentifierAttributesDefaultValueUnion, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesDefaultValueUnion$outboundSchema.parse( postV2TargetIdentifierAttributesDefaultValueUnion, ), ); } export function postV2TargetIdentifierAttributesDefaultValueUnionFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesDefaultValueUnion, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesDefaultValueUnion$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesDefaultValueUnion' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesDefaultCurrencyCode$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesDefaultCurrencyCode> = z.nativeEnum(PostV2TargetIdentifierAttributesDefaultCurrencyCode); /** @internal */ export const PostV2TargetIdentifierAttributesDefaultCurrencyCode$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesDefaultCurrencyCode> = PostV2TargetIdentifierAttributesDefaultCurrencyCode$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesDefaultCurrencyCode$ { /** @deprecated use `PostV2TargetIdentifierAttributesDefaultCurrencyCode$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesDefaultCurrencyCode$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDefaultCurrencyCode$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesDefaultCurrencyCode$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesDisplayType$inboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesDisplayType> = z .nativeEnum(PostV2TargetIdentifierAttributesDisplayType); /** @internal */ export const PostV2TargetIdentifierAttributesDisplayType$outboundSchema: z.ZodNativeEnum<typeof PostV2TargetIdentifierAttributesDisplayType> = PostV2TargetIdentifierAttributesDisplayType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesDisplayType$ { /** @deprecated use `PostV2TargetIdentifierAttributesDisplayType$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesDisplayType$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesDisplayType$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesDisplayType$outboundSchema; } /** @internal */ export const PostV2TargetIdentifierAttributesCurrency$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesCurrency, z.ZodTypeDef, unknown > = z.object({ default_currency_code: PostV2TargetIdentifierAttributesDefaultCurrencyCode$inboundSchema, display_type: PostV2TargetIdentifierAttributesDisplayType$inboundSchema, }).transform((v) => { return remap$(v, { "default_currency_code": "defaultCurrencyCode", "display_type": "displayType", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesCurrency$Outbound = { default_currency_code: string; display_type: string; }; /** @internal */ export const PostV2TargetIdentifierAttributesCurrency$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesCurrency$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesCurrency > = z.object({ defaultCurrencyCode: PostV2TargetIdentifierAttributesDefaultCurrencyCode$outboundSchema, displayType: PostV2TargetIdentifierAttributesDisplayType$outboundSchema, }).transform((v) => { return remap$(v, { defaultCurrencyCode: "default_currency_code", displayType: "display_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesCurrency$ { /** @deprecated use `PostV2TargetIdentifierAttributesCurrency$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesCurrency$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesCurrency$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesCurrency$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesCurrency$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesCurrency$Outbound; } export function postV2TargetIdentifierAttributesCurrencyToJSON( postV2TargetIdentifierAttributesCurrency: PostV2TargetIdentifierAttributesCurrency, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesCurrency$outboundSchema.parse( postV2TargetIdentifierAttributesCurrency, ), ); } export function postV2TargetIdentifierAttributesCurrencyFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesCurrency, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesCurrency$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesCurrency' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesRecordReference$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRecordReference, z.ZodTypeDef, unknown > = z.object({ allowed_objects: z.array(z.string()), }).transform((v) => { return remap$(v, { "allowed_objects": "allowedObjects", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesRecordReference$Outbound = { allowed_objects: Array<string>; }; /** @internal */ export const PostV2TargetIdentifierAttributesRecordReference$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRecordReference$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesRecordReference > = z.object({ allowedObjects: z.array(z.string()), }).transform((v) => { return remap$(v, { allowedObjects: "allowed_objects", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesRecordReference$ { /** @deprecated use `PostV2TargetIdentifierAttributesRecordReference$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesRecordReference$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRecordReference$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesRecordReference$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRecordReference$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesRecordReference$Outbound; } export function postV2TargetIdentifierAttributesRecordReferenceToJSON( postV2TargetIdentifierAttributesRecordReference: PostV2TargetIdentifierAttributesRecordReference, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesRecordReference$outboundSchema.parse( postV2TargetIdentifierAttributesRecordReference, ), ); } export function postV2TargetIdentifierAttributesRecordReferenceFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesRecordReference, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesRecordReference$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesRecordReference' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesConfig$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesConfig, z.ZodTypeDef, unknown > = z.object({ currency: z.lazy(() => PostV2TargetIdentifierAttributesCurrency$inboundSchema) .optional(), record_reference: z.lazy(() => PostV2TargetIdentifierAttributesRecordReference$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "record_reference": "recordReference", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesConfig$Outbound = { currency?: PostV2TargetIdentifierAttributesCurrency$Outbound | undefined; record_reference?: | PostV2TargetIdentifierAttributesRecordReference$Outbound | undefined; }; /** @internal */ export const PostV2TargetIdentifierAttributesConfig$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesConfig$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesConfig > = z.object({ currency: z.lazy(() => PostV2TargetIdentifierAttributesCurrency$outboundSchema ).optional(), recordReference: z.lazy(() => PostV2TargetIdentifierAttributesRecordReference$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { recordReference: "record_reference", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesConfig$ { /** @deprecated use `PostV2TargetIdentifierAttributesConfig$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesConfig$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesConfig$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesConfig$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesConfig$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesConfig$Outbound; } export function postV2TargetIdentifierAttributesConfigToJSON( postV2TargetIdentifierAttributesConfig: PostV2TargetIdentifierAttributesConfig, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesConfig$outboundSchema.parse( postV2TargetIdentifierAttributesConfig, ), ); } export function postV2TargetIdentifierAttributesConfigFromJSON( jsonString: string, ): SafeParseResult<PostV2TargetIdentifierAttributesConfig, SDKValidationError> { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2TargetIdentifierAttributesConfig' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesData$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesData, z.ZodTypeDef, unknown > = z.object({ title: z.string(), description: z.nullable(z.string()), api_slug: z.string(), type: PostV2TargetIdentifierAttributesType$inboundSchema, is_required: z.boolean(), is_unique: z.boolean(), is_multiselect: z.boolean(), default_value: z.nullable( z.union([ z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueDynamic$inboundSchema ), z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueStatic$inboundSchema ), ]), ).optional(), config: z.lazy(() => PostV2TargetIdentifierAttributesConfig$inboundSchema), }).transform((v) => { return remap$(v, { "api_slug": "apiSlug", "is_required": "isRequired", "is_unique": "isUnique", "is_multiselect": "isMultiselect", "default_value": "defaultValue", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesData$Outbound = { title: string; description: string | null; api_slug: string; type: string; is_required: boolean; is_unique: boolean; is_multiselect: boolean; default_value?: | PostV2TargetIdentifierAttributesDefaultValueDynamic$Outbound | PostV2TargetIdentifierAttributesDefaultValueStatic$Outbound | null | undefined; config: PostV2TargetIdentifierAttributesConfig$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesData$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesData$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesData > = z.object({ title: z.string(), description: z.nullable(z.string()), apiSlug: z.string(), type: PostV2TargetIdentifierAttributesType$outboundSchema, isRequired: z.boolean(), isUnique: z.boolean(), isMultiselect: z.boolean(), defaultValue: z.nullable( z.union([ z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueDynamic$outboundSchema ), z.lazy(() => PostV2TargetIdentifierAttributesDefaultValueStatic$outboundSchema ), ]), ).optional(), config: z.lazy(() => PostV2TargetIdentifierAttributesConfig$outboundSchema), }).transform((v) => { return remap$(v, { apiSlug: "api_slug", isRequired: "is_required", isUnique: "is_unique", isMultiselect: "is_multiselect", defaultValue: "default_value", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesData$ { /** @deprecated use `PostV2TargetIdentifierAttributesData$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesData$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesData$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesData$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesData$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesData$Outbound; } export function postV2TargetIdentifierAttributesDataToJSON( postV2TargetIdentifierAttributesData: PostV2TargetIdentifierAttributesData, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesData$outboundSchema.parse( postV2TargetIdentifierAttributesData, ), ); } export function postV2TargetIdentifierAttributesDataFromJSON( jsonString: string, ): SafeParseResult<PostV2TargetIdentifierAttributesData, SDKValidationError> { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2TargetIdentifierAttributesData' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesRequestBody$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRequestBody, z.ZodTypeDef, unknown > = z.object({ data: z.lazy(() => PostV2TargetIdentifierAttributesData$inboundSchema), }); /** @internal */ export type PostV2TargetIdentifierAttributesRequestBody$Outbound = { data: PostV2TargetIdentifierAttributesData$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesRequestBody$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRequestBody$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesRequestBody > = z.object({ data: z.lazy(() => PostV2TargetIdentifierAttributesData$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesRequestBody$ { /** @deprecated use `PostV2TargetIdentifierAttributesRequestBody$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesRequestBody$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRequestBody$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesRequestBody$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRequestBody$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesRequestBody$Outbound; } export function postV2TargetIdentifierAttributesRequestBodyToJSON( postV2TargetIdentifierAttributesRequestBody: PostV2TargetIdentifierAttributesRequestBody, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesRequestBody$outboundSchema.parse( postV2TargetIdentifierAttributesRequestBody, ), ); } export function postV2TargetIdentifierAttributesRequestBodyFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesRequestBody, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesRequestBody$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesRequestBody' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesRequest$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRequest, z.ZodTypeDef, unknown > = z.object({ target: PostV2TargetIdentifierAttributesTarget$inboundSchema, identifier: z.string(), RequestBody: z.lazy(() => PostV2TargetIdentifierAttributesRequestBody$inboundSchema ), }).transform((v) => { return remap$(v, { "RequestBody": "requestBody", }); }); /** @internal */ export type PostV2TargetIdentifierAttributesRequest$Outbound = { target: string; identifier: string; RequestBody: PostV2TargetIdentifierAttributesRequestBody$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesRequest$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesRequest$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesRequest > = z.object({ target: PostV2TargetIdentifierAttributesTarget$outboundSchema, identifier: z.string(), requestBody: z.lazy(() => PostV2TargetIdentifierAttributesRequestBody$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 PostV2TargetIdentifierAttributesRequest$ { /** @deprecated use `PostV2TargetIdentifierAttributesRequest$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesRequest$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRequest$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesRequest$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesRequest$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesRequest$Outbound; } export function postV2TargetIdentifierAttributesRequestToJSON( postV2TargetIdentifierAttributesRequest: PostV2TargetIdentifierAttributesRequest, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesRequest$outboundSchema.parse( postV2TargetIdentifierAttributesRequest, ), ); } export function postV2TargetIdentifierAttributesRequestFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesRequest, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesRequest' from JSON`, ); } /** @internal */ export const PostV2TargetIdentifierAttributesResponse$inboundSchema: z.ZodType< PostV2TargetIdentifierAttributesResponse, z.ZodTypeDef, unknown > = z.object({ data: Attribute$inboundSchema, }); /** @internal */ export type PostV2TargetIdentifierAttributesResponse$Outbound = { data: Attribute$Outbound; }; /** @internal */ export const PostV2TargetIdentifierAttributesResponse$outboundSchema: z.ZodType< PostV2TargetIdentifierAttributesResponse$Outbound, z.ZodTypeDef, PostV2TargetIdentifierAttributesResponse > = z.object({ data: Attribute$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PostV2TargetIdentifierAttributesResponse$ { /** @deprecated use `PostV2TargetIdentifierAttributesResponse$inboundSchema` instead. */ export const inboundSchema = PostV2TargetIdentifierAttributesResponse$inboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesResponse$outboundSchema` instead. */ export const outboundSchema = PostV2TargetIdentifierAttributesResponse$outboundSchema; /** @deprecated use `PostV2TargetIdentifierAttributesResponse$Outbound` instead. */ export type Outbound = PostV2TargetIdentifierAttributesResponse$Outbound; } export function postV2TargetIdentifierAttributesResponseToJSON( postV2TargetIdentifierAttributesResponse: PostV2TargetIdentifierAttributesResponse, ): string { return JSON.stringify( PostV2TargetIdentifierAttributesResponse$outboundSchema.parse( postV2TargetIdentifierAttributesResponse, ), ); } export function postV2TargetIdentifierAttributesResponseFromJSON( jsonString: string, ): SafeParseResult< PostV2TargetIdentifierAttributesResponse, SDKValidationError > { return safeParse( jsonString, (x) => PostV2TargetIdentifierAttributesResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostV2TargetIdentifierAttributesResponse' from JSON`, ); }