/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type InitiateOauth2SigninGlobals = { /** * Optional string used to pick a non-default API version to use. See our API version guide. */ shippoApiVersion?: string | undefined; }; export type InitiateOauth2SigninRequest = { /** * The carrier account ID (UUID) to start a signin process. */ carrierAccountObjectId: string; /** * Callback URL. The URL that tells the authorization server where to send the user back to after they approve the request. */ redirectUri: string; /** * A random string generated by the consuming application and included in the request to prevent CSRF attacks. The consuming application checks that the same value is returned after the user authorizes Shippo. */ state?: string | undefined; }; export type InitiateOauth2SigninResponse = { headers: { [k: string]: Array }; }; /** @internal */ export type InitiateOauth2SigninRequest$Outbound = { CarrierAccountObjectId: string; redirect_uri: string; state?: string | undefined; }; /** @internal */ export const InitiateOauth2SigninRequest$outboundSchema: z.ZodMiniType< InitiateOauth2SigninRequest$Outbound, InitiateOauth2SigninRequest > = z.pipe( z.object({ carrierAccountObjectId: z.string(), redirectUri: z.string(), state: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { carrierAccountObjectId: "CarrierAccountObjectId", redirectUri: "redirect_uri", }); }), ); export function initiateOauth2SigninRequestToJSON( initiateOauth2SigninRequest: InitiateOauth2SigninRequest, ): string { return JSON.stringify( InitiateOauth2SigninRequest$outboundSchema.parse( initiateOauth2SigninRequest, ), ); } /** @internal */ export const InitiateOauth2SigninResponse$inboundSchema: z.ZodMiniType< InitiateOauth2SigninResponse, unknown > = z.pipe( z.object({ Headers: z._default(z.record(z.string(), z.array(z.string())), {}), }), z.transform((v) => { return remap$(v, { "Headers": "headers", }); }), ); export function initiateOauth2SigninResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InitiateOauth2SigninResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InitiateOauth2SigninResponse' from JSON`, ); }