@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
66 lines (61 loc) • 1.96 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";
/**
* Control information and metadata for the response.
*/
export type ResponseMetadata = {
/**
* The maximum number of items that can be returned in a single page.
*/
pageLimit: number | null;
/**
* Unique identifier for the request, useful for tracking and debugging.
*/
requestId: string | null;
/**
* The timestamp indicating when the response was generated.
*/
responseTimestamp: Date | null;
/**
* The duration of time, in milliseconds, that the server took to process and respond
*
* @remarks
* to the request. This is measured from the time the server received the request
* until the time the response was sent.
*/
responseDurationMs: number | null;
};
/** @internal */
export const ResponseMetadata$inboundSchema: z.ZodType<
ResponseMetadata,
z.ZodTypeDef,
unknown
> = z.object({
page_limit: z.nullable(types.number().default(25)),
request_id: types.nullable(types.string()),
response_timestamp: types.nullable(types.date()),
response_duration_ms: types.nullable(types.number()),
}).transform((v) => {
return remap$(v, {
"page_limit": "pageLimit",
"request_id": "requestId",
"response_timestamp": "responseTimestamp",
"response_duration_ms": "responseDurationMs",
});
});
export function responseMetadataFromJSON(
jsonString: string,
): SafeParseResult<ResponseMetadata, SDKValidationError> {
return safeParse(
jsonString,
(x) => ResponseMetadata$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ResponseMetadata' from JSON`,
);
}