/* * 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"; import { StorageStatus, StorageStatus$inboundSchema, StorageStatus$Outbound, StorageStatus$outboundSchema, } from "./storagestatus.js"; /** * Video Metadata EIP-712 primaryType */ export enum PrimaryType { VideoAttestation = "VideoAttestation", } export enum Name { VerifiableVideo = "Verifiable Video", } export enum Version { One = "1", } /** * Video Metadata EIP-712 domain */ export type Domain = { name: Name; version: Version; }; export type Attestations = { role: string; address: string; }; /** * Video Metadata EIP-712 message content */ export type Message = { video: string; attestations: Array; signer: string; timestamp: number; }; export enum SignatureType { Eip712 = "eip712", Flow = "flow", } export type AttestationIpfs = { dollarRef?: any | undefined; /** * Timestamp (in milliseconds) at which IPFS export task was updated * * @remarks */ updatedAt?: number | undefined; }; export type AttestationStorage = { ipfs?: AttestationIpfs | undefined; status?: StorageStatus | undefined; }; export type Attestation = { id?: string | undefined; /** * Video Metadata EIP-712 primaryType */ primaryType: PrimaryType; /** * Video Metadata EIP-712 domain */ domain: Domain; /** * Video Metadata EIP-712 message content */ message: Message; /** * Video Metadata EIP-712 message signature */ signature: string; /** * Timestamp (in milliseconds) at which the object was created */ createdAt?: number | undefined; signatureType?: SignatureType | undefined; storage?: AttestationStorage | undefined; }; /** @internal */ export const PrimaryType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(PrimaryType); /** @internal */ export const PrimaryType$outboundSchema: z.ZodNativeEnum = PrimaryType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PrimaryType$ { /** @deprecated use `PrimaryType$inboundSchema` instead. */ export const inboundSchema = PrimaryType$inboundSchema; /** @deprecated use `PrimaryType$outboundSchema` instead. */ export const outboundSchema = PrimaryType$outboundSchema; } /** @internal */ export const Name$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Name, ); /** @internal */ export const Name$outboundSchema: z.ZodNativeEnum = Name$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Name$ { /** @deprecated use `Name$inboundSchema` instead. */ export const inboundSchema = Name$inboundSchema; /** @deprecated use `Name$outboundSchema` instead. */ export const outboundSchema = Name$outboundSchema; } /** @internal */ export const Version$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Version); /** @internal */ export const Version$outboundSchema: z.ZodNativeEnum = Version$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Version$ { /** @deprecated use `Version$inboundSchema` instead. */ export const inboundSchema = Version$inboundSchema; /** @deprecated use `Version$outboundSchema` instead. */ export const outboundSchema = Version$outboundSchema; } /** @internal */ export const Domain$inboundSchema: z.ZodType = z .object({ name: Name$inboundSchema, version: Version$inboundSchema, }); /** @internal */ export type Domain$Outbound = { name: string; version: string; }; /** @internal */ export const Domain$outboundSchema: z.ZodType< Domain$Outbound, z.ZodTypeDef, Domain > = z.object({ name: Name$outboundSchema, version: Version$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Domain$ { /** @deprecated use `Domain$inboundSchema` instead. */ export const inboundSchema = Domain$inboundSchema; /** @deprecated use `Domain$outboundSchema` instead. */ export const outboundSchema = Domain$outboundSchema; /** @deprecated use `Domain$Outbound` instead. */ export type Outbound = Domain$Outbound; } export function domainToJSON(domain: Domain): string { return JSON.stringify(Domain$outboundSchema.parse(domain)); } export function domainFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Domain$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Domain' from JSON`, ); } /** @internal */ export const Attestations$inboundSchema: z.ZodType< Attestations, z.ZodTypeDef, unknown > = z.object({ role: z.string(), address: z.string(), }); /** @internal */ export type Attestations$Outbound = { role: string; address: string; }; /** @internal */ export const Attestations$outboundSchema: z.ZodType< Attestations$Outbound, z.ZodTypeDef, Attestations > = z.object({ role: z.string(), address: 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 Attestations$ { /** @deprecated use `Attestations$inboundSchema` instead. */ export const inboundSchema = Attestations$inboundSchema; /** @deprecated use `Attestations$outboundSchema` instead. */ export const outboundSchema = Attestations$outboundSchema; /** @deprecated use `Attestations$Outbound` instead. */ export type Outbound = Attestations$Outbound; } export function attestationsToJSON(attestations: Attestations): string { return JSON.stringify(Attestations$outboundSchema.parse(attestations)); } export function attestationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Attestations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Attestations' from JSON`, ); } /** @internal */ export const Message$inboundSchema: z.ZodType = z.object({ video: z.string(), attestations: z.array(z.lazy(() => Attestations$inboundSchema)), signer: z.string(), timestamp: z.number(), }); /** @internal */ export type Message$Outbound = { video: string; attestations: Array; signer: string; timestamp: number; }; /** @internal */ export const Message$outboundSchema: z.ZodType< Message$Outbound, z.ZodTypeDef, Message > = z.object({ video: z.string(), attestations: z.array(z.lazy(() => Attestations$outboundSchema)), signer: z.string(), timestamp: z.number(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Message$ { /** @deprecated use `Message$inboundSchema` instead. */ export const inboundSchema = Message$inboundSchema; /** @deprecated use `Message$outboundSchema` instead. */ export const outboundSchema = Message$outboundSchema; /** @deprecated use `Message$Outbound` instead. */ export type Outbound = Message$Outbound; } export function messageToJSON(message: Message): string { return JSON.stringify(Message$outboundSchema.parse(message)); } export function messageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Message$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Message' from JSON`, ); } /** @internal */ export const SignatureType$inboundSchema: z.ZodNativeEnum< typeof SignatureType > = z.nativeEnum(SignatureType); /** @internal */ export const SignatureType$outboundSchema: z.ZodNativeEnum< typeof SignatureType > = SignatureType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SignatureType$ { /** @deprecated use `SignatureType$inboundSchema` instead. */ export const inboundSchema = SignatureType$inboundSchema; /** @deprecated use `SignatureType$outboundSchema` instead. */ export const outboundSchema = SignatureType$outboundSchema; } /** @internal */ export const AttestationIpfs$inboundSchema: z.ZodType< AttestationIpfs, z.ZodTypeDef, unknown > = z.object({ $ref: z.any().optional(), updatedAt: z.number().optional(), }).transform((v) => { return remap$(v, { "$ref": "dollarRef", }); }); /** @internal */ export type AttestationIpfs$Outbound = { $ref?: any | undefined; updatedAt?: number | undefined; }; /** @internal */ export const AttestationIpfs$outboundSchema: z.ZodType< AttestationIpfs$Outbound, z.ZodTypeDef, AttestationIpfs > = z.object({ dollarRef: z.any().optional(), updatedAt: z.number().optional(), }).transform((v) => { return remap$(v, { dollarRef: "$ref", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AttestationIpfs$ { /** @deprecated use `AttestationIpfs$inboundSchema` instead. */ export const inboundSchema = AttestationIpfs$inboundSchema; /** @deprecated use `AttestationIpfs$outboundSchema` instead. */ export const outboundSchema = AttestationIpfs$outboundSchema; /** @deprecated use `AttestationIpfs$Outbound` instead. */ export type Outbound = AttestationIpfs$Outbound; } export function attestationIpfsToJSON( attestationIpfs: AttestationIpfs, ): string { return JSON.stringify(AttestationIpfs$outboundSchema.parse(attestationIpfs)); } export function attestationIpfsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AttestationIpfs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AttestationIpfs' from JSON`, ); } /** @internal */ export const AttestationStorage$inboundSchema: z.ZodType< AttestationStorage, z.ZodTypeDef, unknown > = z.object({ ipfs: z.lazy(() => AttestationIpfs$inboundSchema).optional(), status: StorageStatus$inboundSchema.optional(), }); /** @internal */ export type AttestationStorage$Outbound = { ipfs?: AttestationIpfs$Outbound | undefined; status?: StorageStatus$Outbound | undefined; }; /** @internal */ export const AttestationStorage$outboundSchema: z.ZodType< AttestationStorage$Outbound, z.ZodTypeDef, AttestationStorage > = z.object({ ipfs: z.lazy(() => AttestationIpfs$outboundSchema).optional(), status: StorageStatus$outboundSchema.optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AttestationStorage$ { /** @deprecated use `AttestationStorage$inboundSchema` instead. */ export const inboundSchema = AttestationStorage$inboundSchema; /** @deprecated use `AttestationStorage$outboundSchema` instead. */ export const outboundSchema = AttestationStorage$outboundSchema; /** @deprecated use `AttestationStorage$Outbound` instead. */ export type Outbound = AttestationStorage$Outbound; } export function attestationStorageToJSON( attestationStorage: AttestationStorage, ): string { return JSON.stringify( AttestationStorage$outboundSchema.parse(attestationStorage), ); } export function attestationStorageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AttestationStorage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AttestationStorage' from JSON`, ); } /** @internal */ export const Attestation$inboundSchema: z.ZodType< Attestation, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), primaryType: PrimaryType$inboundSchema, domain: z.lazy(() => Domain$inboundSchema), message: z.lazy(() => Message$inboundSchema), signature: z.string(), createdAt: z.number().optional(), signatureType: SignatureType$inboundSchema.optional(), storage: z.lazy(() => AttestationStorage$inboundSchema).optional(), }); /** @internal */ export type Attestation$Outbound = { id?: string | undefined; primaryType: string; domain: Domain$Outbound; message: Message$Outbound; signature: string; createdAt?: number | undefined; signatureType?: string | undefined; storage?: AttestationStorage$Outbound | undefined; }; /** @internal */ export const Attestation$outboundSchema: z.ZodType< Attestation$Outbound, z.ZodTypeDef, Attestation > = z.object({ id: z.string().optional(), primaryType: PrimaryType$outboundSchema, domain: z.lazy(() => Domain$outboundSchema), message: z.lazy(() => Message$outboundSchema), signature: z.string(), createdAt: z.number().optional(), signatureType: SignatureType$outboundSchema.optional(), storage: z.lazy(() => AttestationStorage$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Attestation$ { /** @deprecated use `Attestation$inboundSchema` instead. */ export const inboundSchema = Attestation$inboundSchema; /** @deprecated use `Attestation$outboundSchema` instead. */ export const outboundSchema = Attestation$outboundSchema; /** @deprecated use `Attestation$Outbound` instead. */ export type Outbound = Attestation$Outbound; } export function attestationToJSON(attestation: Attestation): string { return JSON.stringify(Attestation$outboundSchema.parse(attestation)); } export function attestationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Attestation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Attestation' from JSON`, ); }