refactor: replace deprecated endpoints
This commit is contained in:
parent
c29f987caa
commit
b03bae4cd9
|
@ -1,7 +1,7 @@
|
|||
const preambles = {
|
||||
'extended-player-profile': `// ==UserScript==
|
||||
// @name Extended player profile
|
||||
// @version 1.1.2
|
||||
// @version 1.1.3
|
||||
// @description Adds additional info and actions on a player overview.
|
||||
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
||||
// @match https://*/game.php?*screen=info_player*
|
||||
|
@ -37,7 +37,7 @@ const preambles = {
|
|||
// ==/UserScript==`,
|
||||
'extended-tribe-profile': `// ==UserScript==
|
||||
// @name Extended tribe profile
|
||||
// @version 1.0.0
|
||||
// @version 1.0.1
|
||||
// @description Adds additional info and actions on a tribe overview.
|
||||
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
||||
// @match https://*/game.php?*screen=info_ally*
|
||||
|
|
|
@ -71,8 +71,8 @@ class TWHelpConnector {
|
|||
}
|
||||
|
||||
async latestSnapshot() {
|
||||
const history = await this.playerHistory(1, 1);
|
||||
return history.data.length > 0 ? history.data[0] : null;
|
||||
const snapshot = await this.playerSnapshots(1, 1);
|
||||
return snapshot.data.length > 0 ? snapshot.data[0] : null;
|
||||
}
|
||||
|
||||
playerTribeChanges(page: number, limit: number) {
|
||||
|
@ -91,8 +91,8 @@ class TWHelpConnector {
|
|||
});
|
||||
}
|
||||
|
||||
playerHistory(page: number, limit: number) {
|
||||
return this.client.playerHistory(this.version, this.server, this.id, {
|
||||
playerSnapshots(page: number, limit: number) {
|
||||
return this.client.playerSnapshots(this.version, this.server, this.id, {
|
||||
offset: (page - 1) * limit,
|
||||
limit,
|
||||
sort: ['date:desc'],
|
||||
|
@ -511,7 +511,7 @@ class UI {
|
|||
],
|
||||
30,
|
||||
(page: number, limit: number) => {
|
||||
return this.twhelpConnector.playerHistory(page, limit);
|
||||
return this.twhelpConnector.playerSnapshots(page, limit);
|
||||
}
|
||||
).render();
|
||||
}
|
||||
|
|
|
@ -60,12 +60,12 @@ class TWHelpConnector {
|
|||
}
|
||||
|
||||
async latestSnapshot() {
|
||||
const history = await this.tribeHistory(1, 1);
|
||||
return history.data.length > 0 ? history.data[0] : null;
|
||||
const snapshot = await this.tribeSnapshots(1, 1);
|
||||
return snapshot.data.length > 0 ? snapshot.data[0] : null;
|
||||
}
|
||||
|
||||
tribeHistory(page: number, limit: number) {
|
||||
return this.client.tribeHistory(this.version, this.server, this.id, {
|
||||
tribeSnapshots(page: number, limit: number) {
|
||||
return this.client.tribeSnapshots(this.version, this.server, this.id, {
|
||||
offset: (page - 1) * limit,
|
||||
limit,
|
||||
sort: ['date:desc'],
|
||||
|
@ -376,7 +376,7 @@ class UI {
|
|||
],
|
||||
30,
|
||||
(page: number, limit: number) => {
|
||||
return this.twhelpConnector.tribeHistory(page, limit);
|
||||
return this.twhelpConnector.tribeSnapshots(page, limit);
|
||||
}
|
||||
).render();
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ export class TWHelpClient {
|
|||
return resp.data.data;
|
||||
}
|
||||
|
||||
public async tribeHistory(
|
||||
public async tribeSnapshots(
|
||||
version: string,
|
||||
server: string,
|
||||
id: number,
|
||||
|
@ -245,7 +245,7 @@ export class TWHelpClient {
|
|||
): Promise<ListResult<TribeSnapshot>> {
|
||||
const queryString = queryParams ? this.buildQueryString(queryParams) : '';
|
||||
const resp = await this.client.get(
|
||||
`/api/v1/versions/${version}/servers/${server}/tribes/${id}/history?${queryString}`
|
||||
`/api/v1/versions/${version}/servers/${server}/tribes/${id}/snapshots?${queryString}`
|
||||
);
|
||||
return {
|
||||
data: resp.data.data,
|
||||
|
@ -344,7 +344,7 @@ export class TWHelpClient {
|
|||
};
|
||||
}
|
||||
|
||||
public async playerHistory(
|
||||
public async playerSnapshots(
|
||||
version: string,
|
||||
server: string,
|
||||
id: number,
|
||||
|
@ -352,7 +352,7 @@ export class TWHelpClient {
|
|||
): Promise<ListResult<PlayerSnapshot>> {
|
||||
const queryString = queryParams ? this.buildQueryString(queryParams) : '';
|
||||
const resp = await this.client.get(
|
||||
`/api/v1/versions/${version}/servers/${server}/players/${id}/history?${queryString}`
|
||||
`/api/v1/versions/${version}/servers/${server}/players/${id}/snapshots?${queryString}`
|
||||
);
|
||||
return {
|
||||
data: resp.data.data,
|
||||
|
|
Loading…
Reference in New Issue