@@ -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}
207284exports . Points = Points ;
0 commit comments