UNPKG

@docusign/iam-sdk

Version:

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

144 lines (135 loc) 4.71 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"; export type ResourceMetadata = { /** * Timestamp when the agreement document was created. */ createdAt?: Date | null | undefined; /** * User ID of the person who created the agreement document. */ createdBy?: string | null | undefined; /** * Timestamp when the agreement document was last modified. */ modifiedAt?: Date | null | undefined; /** * User ID of the person who last modified the agreement document. */ modifiedBy?: 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 ResourceMetadata$inboundSchema: z.ZodType< ResourceMetadata, z.ZodTypeDef, unknown > = z.object({ created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_by: z.nullable(z.string()).optional(), modified_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), modified_by: 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, { "created_at": "createdAt", "created_by": "createdBy", "modified_at": "modifiedAt", "modified_by": "modifiedBy", "request_id": "requestId", "response_timestamp": "responseTimestamp", "response_duration_ms": "responseDurationMs", }); }); /** @internal */ export type ResourceMetadata$Outbound = { created_at?: string | null | undefined; created_by?: string | null | undefined; modified_at?: string | null | undefined; modified_by?: string | null | undefined; request_id?: string | null | undefined; response_timestamp?: string | null | undefined; response_duration_ms?: number | null | undefined; }; /** @internal */ export const ResourceMetadata$outboundSchema: z.ZodType< ResourceMetadata$Outbound, z.ZodTypeDef, ResourceMetadata > = z.object({ createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdBy: z.nullable(z.string()).optional(), modifiedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), modifiedBy: 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, { createdAt: "created_at", createdBy: "created_by", modifiedAt: "modified_at", modifiedBy: "modified_by", 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 ResourceMetadata$ { /** @deprecated use `ResourceMetadata$inboundSchema` instead. */ export const inboundSchema = ResourceMetadata$inboundSchema; /** @deprecated use `ResourceMetadata$outboundSchema` instead. */ export const outboundSchema = ResourceMetadata$outboundSchema; /** @deprecated use `ResourceMetadata$Outbound` instead. */ export type Outbound = ResourceMetadata$Outbound; } export function resourceMetadataToJSON( resourceMetadata: ResourceMetadata, ): string { return JSON.stringify( ResourceMetadata$outboundSchema.parse(resourceMetadata), ); } export function resourceMetadataFromJSON( jsonString: string, ): SafeParseResult<ResourceMetadata, SDKValidationError> { return safeParse( jsonString, (x) => ResourceMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResourceMetadata' from JSON`, ); }