@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
75 lines (70 loc) • 2.08 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 {
WorkspaceDocumentOwner,
WorkspaceDocumentOwner$inboundSchema,
} from "./workspacedocumentowner.js";
export type WorkspaceDocument = {
/**
* The ID of the document
*/
documentId: string;
/**
* The name of the document
*/
name?: string | null | undefined;
/**
* The ID of the user who owns the document
*/
ownerId?: string | null | undefined;
/**
* The size of the document in bytes
*/
size?: number | null | undefined;
/**
* The date the document was created
*/
createdDate?: Date | null | undefined;
/**
* The date the document was last updated
*/
lastUpdatedDate?: Date | null | undefined;
owner?: WorkspaceDocumentOwner | undefined;
};
/** @internal */
export const WorkspaceDocument$inboundSchema: z.ZodType<
WorkspaceDocument,
z.ZodTypeDef,
unknown
> = z.object({
document_id: types.string(),
name: z.nullable(types.string()).optional(),
owner_id: z.nullable(types.string()).optional(),
size: z.nullable(types.number()).optional(),
created_date: z.nullable(types.date()).optional(),
last_updated_date: z.nullable(types.date()).optional(),
owner: types.optional(WorkspaceDocumentOwner$inboundSchema),
}).transform((v) => {
return remap$(v, {
"document_id": "documentId",
"owner_id": "ownerId",
"created_date": "createdDate",
"last_updated_date": "lastUpdatedDate",
});
});
export function workspaceDocumentFromJSON(
jsonString: string,
): SafeParseResult<WorkspaceDocument, SDKValidationError> {
return safeParse(
jsonString,
(x) => WorkspaceDocument$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'WorkspaceDocument' from JSON`,
);
}