@time2win/t2w 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/index.d.ts +2 -1
- package/index.js +9 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 2.0.3 - 2025-07-30
|
|
9
|
+
### Added
|
|
10
|
+
apiKey get property to retrieve the current api key
|
|
11
|
+
|
|
8
12
|
## 2.0.2 - 2025-07-28
|
|
9
13
|
### Changed
|
|
10
14
|
empty array instead of undefined list
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { EventDataOptions, IndividualResultsOptions, ParticipantInfoOptions, T2WEvent, T2WEventResponse, T2WIndividualResultResponse, T2WParticipantResponse, T2WTeamResponse, T2WTeamResultsResponse, TeamResultOptions, TeamsWithMembersOptions } from './models';
|
|
2
2
|
export default class Time2WinAPI {
|
|
3
3
|
private readonly apiUrl;
|
|
4
|
-
private readonly
|
|
4
|
+
private readonly _apiKey;
|
|
5
5
|
private readonly pageSize;
|
|
6
6
|
constructor(apiKey: string, pageSize?: number);
|
|
7
|
+
get apiKey(): string;
|
|
7
8
|
getEventData(eventId: number, options?: EventDataOptions): Promise<T2WEvent>;
|
|
8
9
|
getEventDataWithCache(eventId: number, options?: EventDataOptions, maxAge?: number): Promise<T2WEvent>;
|
|
9
10
|
getTeamResult(eventId: number, raceId: number, options?: TeamResultOptions, page?: number): Promise<T2WTeamResultsResponse>;
|
package/index.js
CHANGED
|
@@ -51,9 +51,16 @@ var Time2WinAPI = /** @class */ (function () {
|
|
|
51
51
|
function Time2WinAPI(apiKey, pageSize) {
|
|
52
52
|
if (pageSize === void 0) { pageSize = 250; }
|
|
53
53
|
this.apiUrl = 'https://time2win.at/api/1.1/{{route}}';
|
|
54
|
-
this.
|
|
54
|
+
this._apiKey = apiKey;
|
|
55
55
|
this.pageSize = pageSize;
|
|
56
56
|
}
|
|
57
|
+
Object.defineProperty(Time2WinAPI.prototype, "apiKey", {
|
|
58
|
+
get: function () {
|
|
59
|
+
return this._apiKey;
|
|
60
|
+
},
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
57
64
|
Time2WinAPI.prototype.getEventData = function (eventId, options) {
|
|
58
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
66
|
var _this = this;
|
|
@@ -428,7 +435,7 @@ var Time2WinAPI = /** @class */ (function () {
|
|
|
428
435
|
if (url.endsWith('/')) {
|
|
429
436
|
url = url.slice(0, -1);
|
|
430
437
|
}
|
|
431
|
-
url += url.includes('?') ? "&apikey=".concat(this.
|
|
438
|
+
url += url.includes('?') ? "&apikey=".concat(this._apiKey) : "?apikey=".concat(this._apiKey);
|
|
432
439
|
if (queryParams) {
|
|
433
440
|
for (var key in queryParams) {
|
|
434
441
|
url += "&".concat(key, "=").concat(queryParams[key]);
|