/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LobbyVisibility, LobbyVisibility$inboundSchema, } from "./lobbyvisibility.js"; import { Region, Region$inboundSchema } from "./region.js"; /** * UserId or email address for the user that created the lobby. */ export type LobbyV3CreatedBy = string | number; /** * A lobby object allows you to store and manage metadata for your rooms. */ export type LobbyV3 = { /** * User-defined identifier for a lobby. */ shortCode: string; /** * When the lobby was created. */ createdAt: Date; /** * UserId or email address for the user that created the lobby. */ createdBy: string | number; roomConfig?: string | null | undefined; /** * Types of lobbies a player can create. * * @remarks * * `private`: the player who created the room must share the roomId with their friends * * `public`: visible in the public lobby list, anyone can join * * `local`: for testing with a server running locally */ visibility: LobbyVisibility; region: Region; /** * Unique identifier to a game session or match. Use the default system generated ID or overwrite it with your own. * * @remarks * Note: error will be returned if `roomId` is not globally unique. */ roomId: string; /** * System generated unique identifier for an application. */ appId: string; }; /** @internal */ export const LobbyV3CreatedBy$inboundSchema: z.ZodType< LobbyV3CreatedBy, z.ZodTypeDef, unknown > = z.union([z.string(), z.number()]); export function lobbyV3CreatedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LobbyV3CreatedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LobbyV3CreatedBy' from JSON`, ); } /** @internal */ export const LobbyV3$inboundSchema: z.ZodType = z.object({ shortCode: z.string(), createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ), createdBy: z.union([z.string(), z.number()]), roomConfig: z.nullable(z.string()).optional(), visibility: LobbyVisibility$inboundSchema, region: Region$inboundSchema, roomId: z.string(), appId: z.string(), }); export function lobbyV3FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LobbyV3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LobbyV3' from JSON`, ); }