/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type VaultConnectionsImportGlobals = { /** * 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 VaultConnectionsImportRequest = { /** * 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; /** * Service ID of the resource to return */ serviceId: string; /** * Unified API */ unifiedApi: string; /** * Fields that need to be persisted on the resource */ connectionImportData: components.ConnectionImportData; }; export type VaultConnectionsImportResponse = { httpMeta: components.HTTPMetadata; /** * Connection created */ createConnectionResponse?: components.CreateConnectionResponse | undefined; /** * Unexpected error */ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined; }; /** @internal */ export type VaultConnectionsImportRequest$Outbound = { consumerId?: string | undefined; appId?: string | undefined; service_id: string; unified_api: string; ConnectionImportData: components.ConnectionImportData$Outbound; }; /** @internal */ export const VaultConnectionsImportRequest$outboundSchema: z.ZodType< VaultConnectionsImportRequest$Outbound, z.ZodTypeDef, VaultConnectionsImportRequest > = /* @__PURE__ */ lazySchema$(() => z.object({ consumerId: z.string().optional(), appId: z.string().optional(), serviceId: z.string(), unifiedApi: z.string(), connectionImportData: components.ConnectionImportData$outboundSchema, }).transform((v) => { return remap$(v, { serviceId: "service_id", unifiedApi: "unified_api", connectionImportData: "ConnectionImportData", }); }) ); export function vaultConnectionsImportRequestToJSON( vaultConnectionsImportRequest: VaultConnectionsImportRequest, ): string { return JSON.stringify( VaultConnectionsImportRequest$outboundSchema.parse( vaultConnectionsImportRequest, ), ); } /** @internal */ export const VaultConnectionsImportResponse$inboundSchema: z.ZodType< VaultConnectionsImportResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CreateConnectionResponse: types.optional( components.CreateConnectionResponse$inboundSchema, ), UnexpectedErrorResponse: types.optional( components.UnexpectedErrorResponse$inboundSchema, ), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CreateConnectionResponse": "createConnectionResponse", "UnexpectedErrorResponse": "unexpectedErrorResponse", }); }) ); export function vaultConnectionsImportResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VaultConnectionsImportResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VaultConnectionsImportResponse' from JSON`, ); }