-
Notifications
You must be signed in to change notification settings - Fork 10
/
GlobalResource.ts
68 lines (62 loc) · 2.22 KB
/
GlobalResource.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import BungieResource from './BungieResoure';
import HTTPService from '../HttpService';
import { ServerResponse } from '../type-definitions/common';
import { GlobalAlert, DictionaryResponse } from '../type-definitions/additions';
export default class GlobalResource extends BungieResource {
protected resourcePath: string;
constructor(httpService: HTTPService) {
super(httpService);
this.resourcePath = `${this.basePath}`;
}
/**
* List of available localization cultures
* @async
* @return {Promise.ServerResponse<any>} When fulfilled returns a list of available localization cultures
*/
public getAvailableLocales(): Promise<ServerResponse<DictionaryResponse<string>>> {
return new Promise<ServerResponse<DictionaryResponse<string>>>((resolve, reject) => {
this.httpService
.get(`${this.resourcePath}/GetAvailableLocales/`)
.then((response: ServerResponse<DictionaryResponse<string>>) => {
resolve(response);
})
.catch(err => {
reject(err);
});
});
}
/**
* Get the common settings used by the Bungie.Net environment.
* @async
* @return {Promise.ServerResponse<any>} When fulfilled returns an object containing the common settings
*/
public getCommonSettings(): Promise<ServerResponse<any>> {
return new Promise<ServerResponse<any>>((resolve, reject) => {
this.httpService
.get(`${this.resourcePath}/Settings/`)
.then((response: ServerResponse<any>) => {
resolve(response);
})
.catch(err => {
reject(err);
});
});
}
/**
* Gets any active global alert for display in the forum banners, help pages, etc. Usually used for DOC alerts.
* @async
* @return {Promise.ServerResponse<IDestinyManifest>} When fulfilled returns an object containing the current Global Alerts
*/
public getGlobalAlerts(): Promise<ServerResponse<GlobalAlert[]>> {
return new Promise<ServerResponse<GlobalAlert[]>>((resolve, reject) => {
this.httpService
.get(`${this.resourcePath}/GlobalAlerts/`)
.then((response: ServerResponse<GlobalAlert[]>) => {
resolve(response);
})
.catch(err => {
reject(err);
});
});
}
}