mwg API
    Preparing search index...

    Class SaveSyncClient

    The constructor validation and timeout-wrapped fetch shared by every injectable HTTPS transport here (FeedbackClient, NewsClient, SaveSyncClient, TelemetryClient) - each one is a plain request/response against a game's own endpoint, differing only in what they send and expect back, not in how the endpoint/timeout/fetch options are validated or how a request is aborted after timeoutMs. label names the concrete client in its own error messages ("feedback endpoint is required", not a generic one that would leave a game guessing which of several clients threw).

    import { HttpTransport, type HttpTransportOptions } from '@datamoc/mwg/core';

    class ScoreClient extends HttpTransport {
    constructor(options: HttpTransportOptions) {
    super(options, 'score');
    }
    }

    const client = new ScoreClient({ endpoint: 'https://example.com/scores' });
    console.log(client instanceof HttpTransport); // true

    Hierarchy (View Summary)

    Index
    endpoint: string
    fetchFn: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    maxResponseBytes: number
    timeoutMs: number
    • fetches whatever payload the endpoint currently holds for slot, ready for SaveSystem.importSlot

      Parameters

      • slot: string

      Returns Promise<string>

    • every slot name this endpoint currently holds for this player, for a profile picker to list

      Returns Promise<string[]>

    • the response body as text, refused as soon as it passes maxResponseBytes rather than after it is all in memory

      Parameters

      • response: Response

      Returns Promise<string>