@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
98 lines (89 loc) • 2.8 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
TabExtensionData,
TabExtensionData$inboundSchema,
TabExtensionData$Outbound,
TabExtensionData$outboundSchema,
} from "./tabextensiondata.js";
export type Tab = {
extensionData: TabExtensionData;
/**
* Indicates the type of tab
*/
tabType: string;
/**
* A regular expression used to validate input for the tab.
*/
validationPattern?: string | undefined;
/**
* The message displayed if the custom tab fails input validation
*/
validationMessage?: string | undefined;
/**
* The label associated to a verification field in a document.
*/
tabLabel: string;
/**
* The radio button properties for the tab (if the tab is of radio type)
*/
radios?: Array<string> | undefined;
};
/** @internal */
export const Tab$inboundSchema: z.ZodType<Tab, z.ZodTypeDef, unknown> = z
.object({
extensionData: TabExtensionData$inboundSchema,
tabType: z.string(),
validationPattern: z.string().optional(),
validationMessage: z.string().optional(),
tabLabel: z.string(),
radios: z.array(z.string()).optional(),
});
/** @internal */
export type Tab$Outbound = {
extensionData: TabExtensionData$Outbound;
tabType: string;
validationPattern?: string | undefined;
validationMessage?: string | undefined;
tabLabel: string;
radios?: Array<string> | undefined;
};
/** @internal */
export const Tab$outboundSchema: z.ZodType<Tab$Outbound, z.ZodTypeDef, Tab> = z
.object({
extensionData: TabExtensionData$outboundSchema,
tabType: z.string(),
validationPattern: z.string().optional(),
validationMessage: z.string().optional(),
tabLabel: z.string(),
radios: z.array(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 Tab$ {
/** @deprecated use `Tab$inboundSchema` instead. */
export const inboundSchema = Tab$inboundSchema;
/** @deprecated use `Tab$outboundSchema` instead. */
export const outboundSchema = Tab$outboundSchema;
/** @deprecated use `Tab$Outbound` instead. */
export type Outbound = Tab$Outbound;
}
export function tabToJSON(tab: Tab): string {
return JSON.stringify(Tab$outboundSchema.parse(tab));
}
export function tabFromJSON(
jsonString: string,
): SafeParseResult<Tab, SDKValidationError> {
return safeParse(
jsonString,
(x) => Tab$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Tab' from JSON`,
);
}