mickeyf.docs
    Preparing search index...

    Type Alias PostUsersRequest

    PostUsersRequest:
        | {
            email: string;
            type: "signup";
            user_name: string;
            user_password: string;
        }
        | { type: "login"; user_name: string; user_password: string }
        | { p4_score: number | null; type: "submit_score"; user_name: string }
        | { type: "get_leaderboard" }

    POST /users request body.

    Responsibility:

    • Selects an operation via type and carries that operation's payload.

    Invariants:

    • This is a discriminated union; each type has a fixed payload shape.
    • Unknown/unsupported type yields ApiErrorCode INVALID_TYPE.

    Type Declaration

    • { email: string; type: "signup"; user_name: string; user_password: string }
      • email: string

        Required; must be non-empty.

        Validation quirk (as implemented): INVALID_EMAIL is returned only if the email is simultaneously missing @, missing ., and shorter than 5 characters.

      • type: "signup"

        Operation: create a new user account.

      • user_name: string

        Required; must be non-empty (server returns EMPTY_FIELDS when missing/empty).

      • user_password: string

        Required.

        Validation (as implemented): length must be 8–16 characters, else INVALID_PASSWORD.

    • { type: "login"; user_name: string; user_password: string }
      • type: "login"

        Operation: authenticate an existing user.

      • user_name: string

        Required.

      • user_password: string

        Required.

    • { p4_score: number | null; type: "submit_score"; user_name: string }
      • p4_score: number | null

        Score value (game-defined units). Nullable to indicate “no score”.

        Validation: not currently enforced server-side; callers should send a finite number.

      • type: "submit_score"

        Operation: submit a p4-Vega score.

      • user_name: string

        Required; missing value yields HTTP 401 with UNAUTHORIZED.

    • { type: "get_leaderboard" }
      • type: "get_leaderboard"

        Operation: fetch the leaderboard.