/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AccountingAttachmentsOneGlobals = { /** * ID of the consumer which you want to get or push data from */ consumerId?: string | undefined; /** * The ID of your Unify application */ appId?: string | undefined; }; export type AccountingAttachmentsOneRequest = { /** * The reference type of the document. */ referenceType: components.AttachmentReferenceType; /** * The reference id of the object to retrieve. */ referenceId: string; /** * ID of the record you are acting upon. */ id: string; /** * Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. */ serviceId?: string | undefined; /** * Include raw response. Mostly used for debugging purposes */ raw?: boolean | undefined; /** * The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: `fields=name,email,addresses.city`

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded. */ fields?: string | null | undefined; }; export type AccountingAttachmentsOneResponse = { httpMeta: components.HTTPMetadata; /** * Attachments */ getAttachmentResponse?: components.GetAttachmentResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingAttachmentsOneGlobals$inboundSchema: z.ZodType< AccountingAttachmentsOneGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingAttachmentsOneGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingAttachmentsOneGlobals$outboundSchema: z.ZodType< AccountingAttachmentsOneGlobals$Outbound, z.ZodTypeDef, AccountingAttachmentsOneGlobals > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingAttachmentsOneGlobals$ { /** @deprecated use `AccountingAttachmentsOneGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingAttachmentsOneGlobals$inboundSchema; /** @deprecated use `AccountingAttachmentsOneGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingAttachmentsOneGlobals$outboundSchema; /** @deprecated use `AccountingAttachmentsOneGlobals$Outbound` instead. */ export type Outbound = AccountingAttachmentsOneGlobals$Outbound; } export function accountingAttachmentsOneGlobalsToJSON( accountingAttachmentsOneGlobals: AccountingAttachmentsOneGlobals, ): string { return JSON.stringify( AccountingAttachmentsOneGlobals$outboundSchema.parse( accountingAttachmentsOneGlobals, ), ); } export function accountingAttachmentsOneGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingAttachmentsOneGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingAttachmentsOneGlobals' from JSON`, ); } /** @internal */ export const AccountingAttachmentsOneRequest$inboundSchema: z.ZodType< AccountingAttachmentsOneRequest, z.ZodTypeDef, unknown > = z.object({ reference_type: components.AttachmentReferenceType$inboundSchema, reference_id: z.string(), id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), fields: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "reference_type": "referenceType", "reference_id": "referenceId", }); }); /** @internal */ export type AccountingAttachmentsOneRequest$Outbound = { reference_type: string; reference_id: string; id: string; serviceId?: string | undefined; raw: boolean; fields?: string | null | undefined; }; /** @internal */ export const AccountingAttachmentsOneRequest$outboundSchema: z.ZodType< AccountingAttachmentsOneRequest$Outbound, z.ZodTypeDef, AccountingAttachmentsOneRequest > = z.object({ referenceType: components.AttachmentReferenceType$outboundSchema, referenceId: z.string(), id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), fields: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { referenceType: "reference_type", referenceId: "reference_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingAttachmentsOneRequest$ { /** @deprecated use `AccountingAttachmentsOneRequest$inboundSchema` instead. */ export const inboundSchema = AccountingAttachmentsOneRequest$inboundSchema; /** @deprecated use `AccountingAttachmentsOneRequest$outboundSchema` instead. */ export const outboundSchema = AccountingAttachmentsOneRequest$outboundSchema; /** @deprecated use `AccountingAttachmentsOneRequest$Outbound` instead. */ export type Outbound = AccountingAttachmentsOneRequest$Outbound; } export function accountingAttachmentsOneRequestToJSON( accountingAttachmentsOneRequest: AccountingAttachmentsOneRequest, ): string { return JSON.stringify( AccountingAttachmentsOneRequest$outboundSchema.parse( accountingAttachmentsOneRequest, ), ); } export function accountingAttachmentsOneRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingAttachmentsOneRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingAttachmentsOneRequest' from JSON`, ); } /** @internal */ export const AccountingAttachmentsOneResponse$inboundSchema: z.ZodType< AccountingAttachmentsOneResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, GetAttachmentResponse: components.GetAttachmentResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "GetAttachmentResponse": "getAttachmentResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingAttachmentsOneResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; GetAttachmentResponse?: components.GetAttachmentResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingAttachmentsOneResponse$outboundSchema: z.ZodType< AccountingAttachmentsOneResponse$Outbound, z.ZodTypeDef, AccountingAttachmentsOneResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, getAttachmentResponse: components.GetAttachmentResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", getAttachmentResponse: "GetAttachmentResponse", unexpectedErrorResponse: "UnexpectedErrorResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingAttachmentsOneResponse$ { /** @deprecated use `AccountingAttachmentsOneResponse$inboundSchema` instead. */ export const inboundSchema = AccountingAttachmentsOneResponse$inboundSchema; /** @deprecated use `AccountingAttachmentsOneResponse$outboundSchema` instead. */ export const outboundSchema = AccountingAttachmentsOneResponse$outboundSchema; /** @deprecated use `AccountingAttachmentsOneResponse$Outbound` instead. */ export type Outbound = AccountingAttachmentsOneResponse$Outbound; } export function accountingAttachmentsOneResponseToJSON( accountingAttachmentsOneResponse: AccountingAttachmentsOneResponse, ): string { return JSON.stringify( AccountingAttachmentsOneResponse$outboundSchema.parse( accountingAttachmentsOneResponse, ), ); } export function accountingAttachmentsOneResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingAttachmentsOneResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingAttachmentsOneResponse' from JSON`, ); }