@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
51 lines (45 loc) • 1.19 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* A URL that references a specific resource.
*
* @remarks
*/
export type Link = {
/**
* The URL for the referenced page.
*/
href: string;
};
/** @internal */
export const Link$inboundSchema: z.ZodType<Link, z.ZodTypeDef, unknown> = z
.object({
href: types.string(),
});
/** @internal */
export type Link$Outbound = {
href: string;
};
/** @internal */
export const Link$outboundSchema: z.ZodType<Link$Outbound, z.ZodTypeDef, Link> =
z.object({
href: z.string(),
});
export function linkToJSON(link: Link): string {
return JSON.stringify(Link$outboundSchema.parse(link));
}
export function linkFromJSON(
jsonString: string,
): SafeParseResult<Link, SDKValidationError> {
return safeParse(
jsonString,
(x) => Link$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Link' from JSON`,
);
}