UNPKG

@docusign/iam-sdk

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.

125 lines (116 loc) 4.02 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; /** * 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 | undefined; /** * The continuation token used to retrieve a page in a paginated response. */ pageTokenNext?: string | null | undefined; /** * Unique identifier for the request, useful for tracking and debugging. */ requestId?: string | null | undefined; /** * The timestamp indicating when the response was generated. */ responseTimestamp?: Date | null | undefined; /** * 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 | undefined; }; /** @internal */ export const ResponseMetadata$inboundSchema: z.ZodType< ResponseMetadata, z.ZodTypeDef, unknown > = z.object({ page_limit: z.nullable(z.number().int()).optional(), page_token_next: z.nullable(z.string()).optional(), request_id: z.nullable(z.string()).optional(), response_timestamp: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), response_duration_ms: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { "page_limit": "pageLimit", "page_token_next": "pageTokenNext", "request_id": "requestId", "response_timestamp": "responseTimestamp", "response_duration_ms": "responseDurationMs", }); }); /** @internal */ export type ResponseMetadata$Outbound = { page_limit?: number | null | undefined; page_token_next?: string | null | undefined; request_id?: string | null | undefined; response_timestamp?: string | null | undefined; response_duration_ms?: number | null | undefined; }; /** @internal */ export const ResponseMetadata$outboundSchema: z.ZodType< ResponseMetadata$Outbound, z.ZodTypeDef, ResponseMetadata > = z.object({ pageLimit: z.nullable(z.number().int()).optional(), pageTokenNext: z.nullable(z.string()).optional(), requestId: z.nullable(z.string()).optional(), responseTimestamp: z.nullable(z.date().transform(v => v.toISOString())) .optional(), responseDurationMs: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { pageLimit: "page_limit", pageTokenNext: "page_token_next", requestId: "request_id", responseTimestamp: "response_timestamp", responseDurationMs: "response_duration_ms", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ResponseMetadata$ { /** @deprecated use `ResponseMetadata$inboundSchema` instead. */ export const inboundSchema = ResponseMetadata$inboundSchema; /** @deprecated use `ResponseMetadata$outboundSchema` instead. */ export const outboundSchema = ResponseMetadata$outboundSchema; /** @deprecated use `ResponseMetadata$Outbound` instead. */ export type Outbound = ResponseMetadata$Outbound; } export function responseMetadataToJSON( responseMetadata: ResponseMetadata, ): string { return JSON.stringify( ResponseMetadata$outboundSchema.parse(responseMetadata), ); } export function responseMetadataFromJSON( jsonString: string, ): SafeParseResult<ResponseMetadata, SDKValidationError> { return safeParse( jsonString, (x) => ResponseMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseMetadata' from JSON`, ); }