-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.ts
50 lines (45 loc) · 1.32 KB
/
Game.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import CurseForgeBase from './Base.js';
import CurseForgeClient from './Client.js';
import {CurseForgeCoreApiStatus, CurseForgeCoreStatus, CurseForgeGameAssets, CurseForgeGetGameResponseRaw} from './Types.js';
/**
* Represents a game.
*/
export default class CurseForgeGame extends CurseForgeBase {
id: number;
name: string;
slug: string;
dateModified: Date;
assets: CurseForgeGameAssets;
status: CurseForgeCoreStatus;
apiStatus: CurseForgeCoreApiStatus;
/**
* Constructs a new game representation.
* @internal
* @param client The {@link CurseForgeClient} associated with this file
* @param data The raw API response data
*/
constructor(client: CurseForgeClient, data: CurseForgeGetGameResponseRaw['data']) {
super(client);
this.id = data.id;
this.name = data.name;
this.slug = data.slug;
this.dateModified = data.dateModified;
this.assets = data.assets;
this.status = data.status;
this.apiStatus = data.apiStatus;
}
/**
* {@inheritDoc CurseForgeClient.getVersions}
* @throws {@link CurseForgeResponseError} when the request fails
*/
getVersions() {
return this.client.getVersions(this.id);
}
/**
* {@inheritDoc CurseForgeClient.getVersionTypes}
* @throws {@link CurseForgeResponseError} when the request fails
*/
getVersionTypes() {
return this.client.getVersionTypes(this.id);
}
}