getGameProgression function

Future<GameProgression> getGameProgression(
  1. AuthObject authorization, {
  2. required int gameId,
  3. bool? hardcore,
  4. Client? client,
})

A call to this function will retrieve information about the average time to unlock achievements in a game.

@param authorization An object containing your username and webApiKey. This can be constructed with buildAuthorization().

@param gameId The unique game ID.

@param hardcore Optional hardcore mode filter.

@example

final progression = await getGameProgression(
  authorization,
  gameId: 14402,
  hardcore: true,
);

@returns Information about average time to unlock achievements in a game.

Implementation

Future<GameProgression> getGameProgression(
  AuthObject authorization, {
  required int gameId,
  bool? hardcore,
  http.Client? client,
}) async {
  final queryParams = <String, dynamic>{'i': gameId};

  if (hardcore != null) {
    queryParams['h'] = hardcore ? 1 : 0;
  }

  final url = buildRequestUrl(
    apiBaseUrl,
    '/API_GetGameProgression.php',
    authorization,
    args: queryParams,
  );

  final rawResponse = await call(url: url, client: client);
  final sanitized = serializeProperties(rawResponse) as Map<String, dynamic>;

  return GameProgression.fromJson(sanitized);
}