Skip to content

Commit 190aaf4

Browse files
committed
feat(leaderboard): add version option for #getResults[AroundUser]
1 parent 7c86683 commit 190aaf4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/leaderboard.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const parseStatisticData = statisticData => {
7373
/**
7474
* @class
7575
*/
76-
AV.Leaderboard = function(statisticName) {
76+
AV.Leaderboard = function Leaderboard(statisticName) {
7777
/**
7878
* @type {string}
7979
*/
@@ -224,7 +224,7 @@ _.extend(
224224
}).then(data => this._finishFetch(data));
225225
},
226226
_getResults(
227-
{ skip, limit, selectUserKeys, includeStatistics },
227+
{ skip, limit, selectUserKeys, includeStatistics, version },
228228
authOptions,
229229
self
230230
) {
@@ -242,6 +242,7 @@ _.extend(
242242
includeStatistics: includeStatistics
243243
? ensureArray(includeStatistics).join(',')
244244
: undefined,
245+
version,
245246
},
246247
authOptions,
247248
}).then(({ results: rankings }) =>
@@ -268,15 +269,16 @@ _.extend(
268269
* @param {number} [options.limit] The limit of the number of results.
269270
* @param {string[]} [options.selectUserKeys] Specify keys of the users to include
270271
* @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
272+
* @param {number} [options.version] Specify the version of the leaderboard
271273
* @param {AuthOptions} [authOptions]
272274
* @return {Promise<Ranking[]>}
273275
*/
274276
getResults(
275-
{ skip, limit, selectUserKeys, includeStatistics } = {},
277+
{ skip, limit, selectUserKeys, includeStatistics, version } = {},
276278
authOptions
277279
) {
278280
return this._getResults(
279-
{ skip, limit, selectUserKeys, includeStatistics },
281+
{ skip, limit, selectUserKeys, includeStatistics, version },
280282
authOptions
281283
);
282284
},
@@ -286,15 +288,16 @@ _.extend(
286288
* @param {number} [options.limit] The limit of the number of results.
287289
* @param {string[]} [options.selectUserKeys] Specify keys of the users to include
288290
* @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
291+
* @param {number} [options.version] Specify the version of the leaderboard
289292
* @param {AuthOptions} [authOptions]
290293
* @return {Promise<Ranking[]>}
291294
*/
292295
getResultsAroundUser(
293-
{ limit, selectUserKeys, includeStatistics } = {},
296+
{ limit, selectUserKeys, includeStatistics, version } = {},
294297
authOptions
295298
) {
296299
return this._getResults(
297-
{ limit, selectUserKeys, includeStatistics },
300+
{ limit, selectUserKeys, includeStatistics, version },
298301
authOptions,
299302
true
300303
);

storage.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ export class Leaderboard {
878878
limit?: number;
879879
selectUserKeys?: string | string[];
880880
includeStatistics?: string | string[];
881+
version?: number;
881882
},
882883
authOptions?: AuthOptions
883884
): Promise<Ranking[]>;
@@ -886,6 +887,7 @@ export class Leaderboard {
886887
limit?: number;
887888
selectUserKeys?: string | string[];
888889
includeStatistics?: string | string[];
890+
version?: number;
889891
},
890892
authOptions?: AuthOptions
891893
): Promise<Ranking[]>;

0 commit comments

Comments
 (0)