/* * 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 AccountingCreditNotesOneGlobals = { /** * 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 AccountingCreditNotesOneRequest = { /** * 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 AccountingCreditNotesOneResponse = { httpMeta: components.HTTPMetadata; /** * Credit Note */ getCreditNoteResponse?: components.GetCreditNoteResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export const AccountingCreditNotesOneGlobals$inboundSchema: z.ZodType< AccountingCreditNotesOneGlobals, z.ZodTypeDef, unknown > = z.object({ consumerId: z.string().optional(), appId: z.string().optional(), }); /** @internal */ export type AccountingCreditNotesOneGlobals$Outbound = { consumerId?: string | undefined; appId?: string | undefined; }; /** @internal */ export const AccountingCreditNotesOneGlobals$outboundSchema: z.ZodType< AccountingCreditNotesOneGlobals$Outbound, z.ZodTypeDef, AccountingCreditNotesOneGlobals > = 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 AccountingCreditNotesOneGlobals$ { /** @deprecated use `AccountingCreditNotesOneGlobals$inboundSchema` instead. */ export const inboundSchema = AccountingCreditNotesOneGlobals$inboundSchema; /** @deprecated use `AccountingCreditNotesOneGlobals$outboundSchema` instead. */ export const outboundSchema = AccountingCreditNotesOneGlobals$outboundSchema; /** @deprecated use `AccountingCreditNotesOneGlobals$Outbound` instead. */ export type Outbound = AccountingCreditNotesOneGlobals$Outbound; } export function accountingCreditNotesOneGlobalsToJSON( accountingCreditNotesOneGlobals: AccountingCreditNotesOneGlobals, ): string { return JSON.stringify( AccountingCreditNotesOneGlobals$outboundSchema.parse( accountingCreditNotesOneGlobals, ), ); } export function accountingCreditNotesOneGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCreditNotesOneGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCreditNotesOneGlobals' from JSON`, ); } /** @internal */ export const AccountingCreditNotesOneRequest$inboundSchema: z.ZodType< AccountingCreditNotesOneRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), fields: z.nullable(z.string()).optional(), }); /** @internal */ export type AccountingCreditNotesOneRequest$Outbound = { id: string; serviceId?: string | undefined; raw: boolean; fields?: string | null | undefined; }; /** @internal */ export const AccountingCreditNotesOneRequest$outboundSchema: z.ZodType< AccountingCreditNotesOneRequest$Outbound, z.ZodTypeDef, AccountingCreditNotesOneRequest > = z.object({ id: z.string(), serviceId: z.string().optional(), raw: z.boolean().default(false), fields: z.nullable(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 AccountingCreditNotesOneRequest$ { /** @deprecated use `AccountingCreditNotesOneRequest$inboundSchema` instead. */ export const inboundSchema = AccountingCreditNotesOneRequest$inboundSchema; /** @deprecated use `AccountingCreditNotesOneRequest$outboundSchema` instead. */ export const outboundSchema = AccountingCreditNotesOneRequest$outboundSchema; /** @deprecated use `AccountingCreditNotesOneRequest$Outbound` instead. */ export type Outbound = AccountingCreditNotesOneRequest$Outbound; } export function accountingCreditNotesOneRequestToJSON( accountingCreditNotesOneRequest: AccountingCreditNotesOneRequest, ): string { return JSON.stringify( AccountingCreditNotesOneRequest$outboundSchema.parse( accountingCreditNotesOneRequest, ), ); } export function accountingCreditNotesOneRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCreditNotesOneRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCreditNotesOneRequest' from JSON`, ); } /** @internal */ export const AccountingCreditNotesOneResponse$inboundSchema: z.ZodType< AccountingCreditNotesOneResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, GetCreditNoteResponse: components.GetCreditNoteResponse$inboundSchema .optional(), UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "GetCreditNoteResponse": "getCreditNoteResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }); /** @internal */ export type AccountingCreditNotesOneResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; GetCreditNoteResponse?: components.GetCreditNoteResponse$Outbound | undefined; UnexpectedErrorResponse?: | components.UnexpectedErrorResponse$Outbound | undefined; }; /** @internal */ export const AccountingCreditNotesOneResponse$outboundSchema: z.ZodType< AccountingCreditNotesOneResponse$Outbound, z.ZodTypeDef, AccountingCreditNotesOneResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, getCreditNoteResponse: components.GetCreditNoteResponse$outboundSchema .optional(), unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema .optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", getCreditNoteResponse: "GetCreditNoteResponse", 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 AccountingCreditNotesOneResponse$ { /** @deprecated use `AccountingCreditNotesOneResponse$inboundSchema` instead. */ export const inboundSchema = AccountingCreditNotesOneResponse$inboundSchema; /** @deprecated use `AccountingCreditNotesOneResponse$outboundSchema` instead. */ export const outboundSchema = AccountingCreditNotesOneResponse$outboundSchema; /** @deprecated use `AccountingCreditNotesOneResponse$Outbound` instead. */ export type Outbound = AccountingCreditNotesOneResponse$Outbound; } export function accountingCreditNotesOneResponseToJSON( accountingCreditNotesOneResponse: AccountingCreditNotesOneResponse, ): string { return JSON.stringify( AccountingCreditNotesOneResponse$outboundSchema.parse( accountingCreditNotesOneResponse, ), ); } export function accountingCreditNotesOneResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingCreditNotesOneResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingCreditNotesOneResponse' from JSON`, ); }