Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add player's awards and achievements. #4

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions web/v2/player/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,61 @@ export interface APIPlayerCompanyHistory {
leftDate: string;
}

/**
* Entry with information of an achievement obtained by the player.
*/
export interface APIPlayerAchievement {
/**
* The ID of the achievement.
*/
id: number;

/**
* The title of the achievement.
*/
title: string;

/**
* The description of the achievement.
*/
description: string;

/**
* The link to the achievement image.
*/
image_url: string;

/**
* The date and time the user was given the achievement (UTC).
*/
achieved_at: string;
}

/**
* Entry with information of an award given to the player.
*/
export interface APIPlayerAward {
/**
* The ID of the award.
*/
id: number;

/**
* The name of the award.
*/
name: string;

/**
* The link to the award image.
*/
image_url: string;

/**
* The date and time the user was given the award (UTC).
*/
awarded_at: string;
}

/**
* Information about a TruckersMP player.
* @see https://truckersmp.com/developers/api#operation/get-player-id
Expand Down Expand Up @@ -215,6 +270,20 @@ interface _APIPlayerBase {
* If the user does not allow to see their company history, `null` will be returned instead.
*/
vtcHistory: APIPlayerCompanyHistory[] | null;

/**
* List of achievements obtained by the player.
*
* If the user does not allow to see their achievements, `null` will be returned instead.
*/
achievements: APIPlayerAchievement[] | null;

/**
* List of awards given to the player.
*
* If the user does not allow to see their awards, `null` will be returned instead.
*/
awards: APIPlayerAward[] | null;
}

/**
Expand Down
Loading