@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
64 lines (59 loc) • 1.92 kB
text/typescript
/*
* 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 { 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";
import { Agreement, Agreement$inboundSchema } from "./agreement.js";
import { PageLinks, PageLinks$inboundSchema } from "./pagelinks.js";
import {
ResponseMetadata,
ResponseMetadata$inboundSchema,
} from "./responsemetadata.js";
/**
* A collection of agreements.
*/
export type AgreementsResponse = {
/**
* A list of agreements
*/
data?: Array<Agreement> | undefined;
/**
* Control information and metadata for the response.
*/
responseMetadata?: ResponseMetadata | undefined;
/**
* Hypermedia controls (HATEOAS) for navigating between pages in a paginated collection of results.
*
* @remarks
* Links for the current page, next page, and previous page, with optional first and last page links.
*/
links?: PageLinks | null | undefined;
};
/** @internal */
export const AgreementsResponse$inboundSchema: z.ZodType<
AgreementsResponse,
z.ZodTypeDef,
unknown
> = z.object({
data: types.optional(z.array(Agreement$inboundSchema)),
response_metadata: types.optional(ResponseMetadata$inboundSchema),
_links: z.nullable(PageLinks$inboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
"response_metadata": "responseMetadata",
"_links": "links",
});
});
export function agreementsResponseFromJSON(
jsonString: string,
): SafeParseResult<AgreementsResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => AgreementsResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AgreementsResponse' from JSON`,
);
}