/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { SharedLinkTarget, SharedLinkTarget$inboundSchema, } from "./sharedlinktarget.js"; /** * The scope of the shared link. */ export const Scope = { Public: "public", Company: "company", } as const; /** * The scope of the shared link. */ export type Scope = OpenEnum; export type SharedLink = { /** * The URL that can be used to view the file. */ url?: string | null | undefined; /** * The URL that can be used to download the file. */ downloadUrl?: string | null | undefined; target?: SharedLinkTarget | undefined; /** * The scope of the shared link. */ scope?: Scope | null | undefined; /** * Indicated if the shared link is password protected. */ passwordProtected?: boolean | null | undefined; expiresAt?: Date | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; export type SharedLinkInput = { /** * The URL that can be used to download the file. */ downloadUrl?: string | null | undefined; /** * The ID of the file or folder to link. */ targetId: string | null; /** * The scope of the shared link. */ scope?: Scope | null | undefined; /** * Optional password for the shared link. */ password?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const Scope$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(Scope)); /** @internal */ export const Scope$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(Scope)); /** @internal */ export const SharedLink$inboundSchema: z.ZodType< SharedLink, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ url: z.nullable(types.string()).optional(), download_url: z.nullable(types.string()).optional(), target: types.optional(SharedLinkTarget$inboundSchema), scope: z.nullable(Scope$inboundSchema).optional(), password_protected: z.nullable(types.boolean()).optional(), expires_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "download_url": "downloadUrl", "password_protected": "passwordProtected", "expires_at": "expiresAt", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function sharedLinkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SharedLink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SharedLink' from JSON`, ); } /** @internal */ export type SharedLinkInput$Outbound = { download_url?: string | null | undefined; target_id: string | null; scope?: string | null | undefined; password?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const SharedLinkInput$outboundSchema: z.ZodType< SharedLinkInput$Outbound, z.ZodTypeDef, SharedLinkInput > = /* @__PURE__ */ lazySchema$(() => z.object({ downloadUrl: z.nullable(z.string()).optional(), targetId: z.nullable(z.string()), scope: z.nullable(Scope$outboundSchema).optional(), password: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { downloadUrl: "download_url", targetId: "target_id", passThrough: "pass_through", }); }) ); export function sharedLinkInputToJSON( sharedLinkInput: SharedLinkInput, ): string { return JSON.stringify(SharedLinkInput$outboundSchema.parse(sharedLinkInput)); }