@retroachievements/api
Version:
A well-tested library that lets you get achievement, user, and game data from RetroAchievements.
59 lines (58 loc) • 1.76 kB
TypeScript
import type { ID } from "../utils/internal";
import type { AuthObject } from "../utils/public";
import type { CommentsResponse } from "./models";
/**
* A call to this function will retrieve a list of comments on a particular target.
*
* @param authorization An object containing your username and webApiKey.
* This can be constructed with `buildAuthorization()`.
*
* @param payload.identifier The identifier to retrieve. For user walls, this will
* be a string (the username), and for game and achievement walls, this will be a
* the ID of the object in question.
*
* @param payload.kind What kind of identifier was used. This can be "game",
* "achievement", or "user".
*
* @param payload.offset Defaults to 0. The number of entries to skip.
*
* @param payload.count Defaults to 50, has a max of 500.
*
* @example
* ```
* // Retrieving game/achievement comments
* const gameWallComments = await getComments(
* authorization,
* { identifier: 20294, kind: 'game', count: 4, offset: 0 },
* );
*
* // Retrieving comments on a user's wall
* const userWallComments = await getComments(
* authorization,
* { identifier: "xelnia", count: 4, offset: 0 },
* );
* ```
*
* @returns An object containing the amount of comments retrieved,
* the total comments, and an array of the comments themselves.
* ```
* {
* count: 4,
* total: 4,
* results: [
* {
* user: "PlayTester",
* submitted: "2024-07-31T11:22:23.000000Z",
* commentText: "Comment 1"
* },
* // ...
* ]
* }
* ```
*/
export declare const getComments: (authorization: AuthObject, payload: {
identifier: ID;
kind?: "game" | "achievement" | "user";
offset?: number;
count?: number;
}) => Promise<CommentsResponse>;