Skip to content

Commit 0189e64

Browse files
Automatically update staging NodeJS SDK
1 parent 017d665 commit 0189e64

56 files changed

Lines changed: 617 additions & 34 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/resources/leaderboards/client/Client.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ export declare class Leaderboards {
1818
protected readonly _options: Leaderboards.Options;
1919
constructor(_options: Leaderboards.Options);
2020
/**
21-
* Get all active leaderboards for your organization.
21+
* Get all leaderboards for your organization. Finished leaderboards are excluded by default.
2222
* @throws {@link TrophyApi.UnauthorizedError}
2323
* @throws {@link TrophyApi.UnprocessableEntityError}
2424
*
2525
* @example
26-
* await trophyApi.leaderboards.all()
26+
* await trophyApi.leaderboards.all({
27+
* includeFinished: true
28+
* })
2729
*/
28-
all(requestOptions?: Leaderboards.RequestOptions): Promise<TrophyApi.LeaderboardsAllResponseItem[]>;
30+
all(request?: TrophyApi.LeaderboardsAllRequest, requestOptions?: Leaderboards.RequestOptions): Promise<TrophyApi.LeaderboardsAllResponseItem[]>;
2931
/**
3032
* Get a specific leaderboard by its key.
3133
* @throws {@link TrophyApi.UnauthorizedError}

api/resources/leaderboards/client/Client.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,23 @@ class Leaderboards {
5050
this._options = _options;
5151
}
5252
/**
53-
* Get all active leaderboards for your organization.
53+
* Get all leaderboards for your organization. Finished leaderboards are excluded by default.
5454
* @throws {@link TrophyApi.UnauthorizedError}
5555
* @throws {@link TrophyApi.UnprocessableEntityError}
5656
*
5757
* @example
58-
* await trophyApi.leaderboards.all()
58+
* await trophyApi.leaderboards.all({
59+
* includeFinished: true
60+
* })
5961
*/
60-
all(requestOptions) {
62+
all(request = {}, requestOptions) {
6163
var _a;
6264
return __awaiter(this, void 0, void 0, function* () {
65+
const { includeFinished } = request;
66+
const _queryParams = {};
67+
if (includeFinished != null) {
68+
_queryParams["includeFinished"] = includeFinished.toString();
69+
}
6370
const _response = yield core.fetcher({
6471
url: (0, url_join_1.default)(((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.TrophyApiEnvironment.Production)
6572
.api, "leaderboards"),
@@ -69,6 +76,7 @@ class Leaderboards {
6976
"X-Fern-Language": "JavaScript",
7077
},
7178
contentType: "application/json",
79+
queryParameters: _queryParams,
7280
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
7381
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
7482
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
/**
5+
* @example
6+
* {
7+
* includeFinished: true
8+
* }
9+
*/
10+
export interface LeaderboardsAllRequest {
11+
/**
12+
* When set to 'true', leaderboards with status 'finished' will be included in the response. By default, finished leaderboards are excluded.
13+
*/
14+
includeFinished?: boolean;
15+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
/**
3+
* This file was auto-generated by Fern from our API Definition.
4+
*/
5+
Object.defineProperty(exports, "__esModule", { value: true });
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export { LeaderboardsAllRequest } from "./LeaderboardsAllRequest";
12
export { LeaderboardsGetRequest } from "./LeaderboardsGetRequest";

api/resources/points/client/Client.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,23 @@ export declare class Points {
3030
*/
3131
summary(key: string, request?: TrophyApi.PointsSummaryRequest, requestOptions?: Points.RequestOptions): Promise<TrophyApi.PointsSummaryResponse>;
3232
/**
33-
* Get a points system with all its triggers.
33+
* Get a points system with its triggers.
3434
* @throws {@link TrophyApi.UnauthorizedError}
3535
* @throws {@link TrophyApi.NotFoundError}
3636
*
3737
* @example
3838
* await trophyApi.points.system("points-system-key")
3939
*/
4040
system(key: string, requestOptions?: Points.RequestOptions): Promise<TrophyApi.PointsSystemResponse>;
41+
/**
42+
* Get all global boosts for a points system. Finished boosts are excluded by default.
43+
* @throws {@link TrophyApi.UnauthorizedError}
44+
* @throws {@link TrophyApi.NotFoundError}
45+
*
46+
* @example
47+
* await trophyApi.points.boosts("points-system-key", {
48+
* includeFinished: true
49+
* })
50+
*/
51+
boosts(key: string, request?: TrophyApi.PointsBoostsRequest, requestOptions?: Points.RequestOptions): Promise<TrophyApi.PointsBoost[]>;
4152
}

api/resources/points/client/Client.js

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Points {
135135
});
136136
}
137137
/**
138-
* Get a points system with all its triggers.
138+
* Get a points system with its triggers.
139139
* @throws {@link TrophyApi.UnauthorizedError}
140140
* @throws {@link TrophyApi.NotFoundError}
141141
*
@@ -203,5 +203,82 @@ class Points {
203203
}
204204
});
205205
}
206+
/**
207+
* Get all global boosts for a points system. Finished boosts are excluded by default.
208+
* @throws {@link TrophyApi.UnauthorizedError}
209+
* @throws {@link TrophyApi.NotFoundError}
210+
*
211+
* @example
212+
* await trophyApi.points.boosts("points-system-key", {
213+
* includeFinished: true
214+
* })
215+
*/
216+
boosts(key, request = {}, requestOptions) {
217+
var _a;
218+
return __awaiter(this, void 0, void 0, function* () {
219+
const { includeFinished } = request;
220+
const _queryParams = {};
221+
if (includeFinished != null) {
222+
_queryParams["includeFinished"] = includeFinished.toString();
223+
}
224+
const _response = yield core.fetcher({
225+
url: (0, url_join_1.default)(((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.TrophyApiEnvironment.Production)
226+
.api, `points/${key}/boosts`),
227+
method: "GET",
228+
headers: {
229+
"X-API-KEY": yield core.Supplier.get(this._options.apiKey),
230+
"X-Fern-Language": "JavaScript",
231+
},
232+
contentType: "application/json",
233+
queryParameters: _queryParams,
234+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
235+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
236+
});
237+
if (_response.ok) {
238+
return yield serializers.points.boosts.Response.parseOrThrow(_response.body, {
239+
unrecognizedObjectKeys: "passthrough",
240+
allowUnrecognizedUnionMembers: true,
241+
allowUnrecognizedEnumValues: true,
242+
breadcrumbsPrefix: ["response"],
243+
});
244+
}
245+
if (_response.error.reason === "status-code") {
246+
switch (_response.error.statusCode) {
247+
case 401:
248+
throw new TrophyApi.UnauthorizedError(yield serializers.ErrorBody.parseOrThrow(_response.error.body, {
249+
unrecognizedObjectKeys: "passthrough",
250+
allowUnrecognizedUnionMembers: true,
251+
allowUnrecognizedEnumValues: true,
252+
breadcrumbsPrefix: ["response"],
253+
}));
254+
case 404:
255+
throw new TrophyApi.NotFoundError(yield serializers.ErrorBody.parseOrThrow(_response.error.body, {
256+
unrecognizedObjectKeys: "passthrough",
257+
allowUnrecognizedUnionMembers: true,
258+
allowUnrecognizedEnumValues: true,
259+
breadcrumbsPrefix: ["response"],
260+
}));
261+
default:
262+
throw new errors.TrophyApiError({
263+
statusCode: _response.error.statusCode,
264+
body: _response.error.body,
265+
});
266+
}
267+
}
268+
switch (_response.error.reason) {
269+
case "non-json":
270+
throw new errors.TrophyApiError({
271+
statusCode: _response.error.statusCode,
272+
body: _response.error.rawBody,
273+
});
274+
case "timeout":
275+
throw new errors.TrophyApiTimeoutError();
276+
case "unknown":
277+
throw new errors.TrophyApiError({
278+
message: _response.error.errorMessage,
279+
});
280+
}
281+
});
282+
}
206283
}
207284
exports.Points = Points;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
/**
5+
* @example
6+
* {
7+
* includeFinished: true
8+
* }
9+
*/
10+
export interface PointsBoostsRequest {
11+
/**
12+
* When set to 'true', boosts that have finished (past their end date) will be included in the response. By default, finished boosts are excluded.
13+
*/
14+
includeFinished?: boolean;
15+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
/**
3+
* This file was auto-generated by Fern from our API Definition.
4+
*/
5+
Object.defineProperty(exports, "__esModule", { value: true });
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { PointsSummaryRequest } from "./PointsSummaryRequest";
2+
export { PointsBoostsRequest } from "./PointsBoostsRequest";

0 commit comments

Comments
 (0)