/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Encryption = { /** * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. */ encryptedKey: string; }; /** @internal */ export const Encryption$inboundSchema: z.ZodType< Encryption, z.ZodTypeDef, unknown > = z.object({ encryptedKey: z.string(), }); /** @internal */ export type Encryption$Outbound = { encryptedKey: string; }; /** @internal */ export const Encryption$outboundSchema: z.ZodType< Encryption$Outbound, z.ZodTypeDef, Encryption > = z.object({ encryptedKey: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Encryption$ { /** @deprecated use `Encryption$inboundSchema` instead. */ export const inboundSchema = Encryption$inboundSchema; /** @deprecated use `Encryption$outboundSchema` instead. */ export const outboundSchema = Encryption$outboundSchema; /** @deprecated use `Encryption$Outbound` instead. */ export type Outbound = Encryption$Outbound; } export function encryptionToJSON(encryption: Encryption): string { return JSON.stringify(Encryption$outboundSchema.parse(encryption)); } export function encryptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Encryption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Encryption' from JSON`, ); }