Skip to content

Invalid BRStatsResponseData type #75

@Nivl

Description

@Nivl

The autogeneratedEndpointStructs.ts file that is auto-generated from a closed-source script (I can't open a PR to fix it), contains the following types:

  data: {
    stats: {
      all: {
        ....
        trio: {
          score: number;
          scorePerMin: number;
          scorePerMatch: number;
          wins: number;
          top3: number;
          top6: number;
          kills: number;
          killsPerMin: number;
          killsPerMatch: number;
          deaths: number;
          kd: number;
          matches: number;
          winRate: number;
          minutesPlayed: number;
          playersOutlived: number;
          lastModified: string;
        },
      },
      keyboardMouse: {
        ....
        trio: {
          score: number;
          scorePerMin: number;
          scorePerMatch: number;
          wins: number;
          top3: number;
          top6: number;
          kills: number;
          killsPerMin: number;
          killsPerMatch: number;
          deaths: number;
          kd: number;
          matches: number;
          winRate: number;
          minutesPlayed: number;
          playersOutlived: number;
          lastModified: string;
        },
      },
      gamepad: {
        ....
        trio: {
          score: number;
          scorePerMin: number;
          scorePerMatch: number;
          wins: number;
          top3: number;
          top6: number;
          kills: number;
          killsPerMin: number;
          killsPerMatch: number;
          deaths: number;
          kd: number;
          matches: number;
          winRate: number;
          minutesPlayed: number;
          playersOutlived: number;
          lastModified: string;
        },
      },
      touch: {
        ....
        trio: {
          score: number;
          scorePerMin: number;
          scorePerMatch: number;
          wins: number;
          top3: number;
          top6: number;
          kills: number;
          killsPerMin: number;
          killsPerMatch: number;
          deaths: number;
          kd: number;
          matches: number;
          winRate: number;
          minutesPlayed: number;
          playersOutlived: number;
          lastModified: string;
        },
      },
    }
  }

As per the documentation, Trio is always null, so the type should be:

  data: {
    stats: {
      all: {
        ....
        trio: null,
      },
      keyboardMouse: {
        ....
        trio: null,
      },
      gamepad: {
        ....
        trio: null,
      },
      touch: {
        ....
        trio: null
      },
    }
  }

Most of the other stat types are also incorrect. For example the following should be optional (null | { ... }):

  • keyboardMouse, gamepad and touch (there will always be at least one of them available, but they are still nullable since we don't know which one)
  • solo, duo, and squad (same as above, we don't know which ones will be there)
  • data.image

I think for the stats, only stats.all.overall is not optional.

cc @ThisNils

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions