UNPKG

@playt/client

Version:
151 lines (148 loc) 5.17 kB
import { p as paths, c as components } from './types-QOhObLeB.js'; import * as openapi_typescript_fetch_types from 'openapi-typescript-fetch/types'; import { FetchConfig } from 'openapi-typescript-fetch/types'; import * as openapi_typescript_fetch from 'openapi-typescript-fetch'; export { ApiError } from 'openapi-typescript-fetch'; declare const PlaytApiClient: ({ apiKey, apiUrl, }: { apiKey: string; apiUrl: string; }) => { initialize: ({ gameVersion }: { gameVersion: string; }) => Promise<void>; fetcher: { configure: (config: FetchConfig) => void; use: (mw: openapi_typescript_fetch.Middleware) => number; path: <P extends keyof paths>(path: P) => { method: <M extends keyof paths[P]>(method: M) => { create: openapi_typescript_fetch_types.CreateFetch<M, paths[P][M]>; }; }; }; searchMatch: openapi_typescript_fetch.TypedFetch<{ requestBody: { content: { "application/json": { matchId?: string; playerToken?: string; }; }; }; responses: { 200: { content: { "application/json": { id: string; player?: { userId: string; avatar: { url: string; backgroundColor: "#FFAA7A" | "#A9FF94" | "#D694FF" | "#94BFFF" | "#7EFFD1" | "#FFDB7E" | "#FF7E7E"; }; name: string; scoreSnapshots: { score: number; timestamp: string; }[]; finalScore?: number; replayId?: string; }; players: { userId: string; avatar: { url: string; backgroundColor: "#FFAA7A" | "#A9FF94" | "#D694FF" | "#94BFFF" | "#7EFFD1" | "#FFDB7E" | "#FF7E7E"; }; name: string; scoreSnapshots: { score: number; timestamp: string; }[]; finalScore?: number; replayId?: string; }[]; status: "running" | "finished" | "cancelled"; matchTier: { playerCount: number; type: "match" | "tutorial"; }; difficulty: ((0 | 1) | 2) | 3; }; }; }; default: components["responses"]["error"]; }; }>; submitScore: ({ timestamp, ...args }: Omit<Parameters<openapi_typescript_fetch.TypedFetch<{ requestBody: { content: { "application/json": { playerToken: string; score: number; finalSnapshot?: boolean; surrender?: boolean; timestamp: string; }; }; }; responses: { 200: { content: { "application/json": { success: "true"; }; }; }; default: components["responses"]["error"]; }; }>>[0], "timestamp"> & { timestamp?: string; }) => Promise<openapi_typescript_fetch.ApiResponse<{ success: "true"; }>>; submitAchievements: (payload: { achievements: `achievement-${number}`[]; playerToken: string; }) => Promise<openapi_typescript_fetch.ApiResponse<{ success: "true"; }>>; submitReplay: openapi_typescript_fetch.TypedFetch<{ requestBody: { content: { "application/json": { playerToken: string; payload: string; }; }; }; responses: { 200: { content: { "application/json": { replayId: string; }; }; }; default: components["responses"]["error"]; }; }>; getReplay: openapi_typescript_fetch.TypedFetch<{ parameters: { query: { matchId: string; userId: string; }; }; responses: { 200: { content: { "application/json": { payload: string; }; }; }; default: components["responses"]["error"]; }; }>; }; export { PlaytApiClient as default, paths };