@time2win/t2w 2.0.2 → 2.0.4
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 +8 -0
- package/index.d.ts +2 -1
- package/index.js +9 -2
- package/models.d.ts +5 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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.4 - 2025-08-22
|
|
9
|
+
### Added
|
|
10
|
+
non binary gender support
|
|
11
|
+
|
|
12
|
+
## 2.0.3 - 2025-07-30
|
|
13
|
+
### Added
|
|
14
|
+
apiKey get property to retrieve the current api key
|
|
15
|
+
|
|
8
16
|
## 2.0.2 - 2025-07-28
|
|
9
17
|
### Changed
|
|
10
18
|
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]);
|
package/models.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type gender =
|
|
1
|
+
declare type gender = T2WGender;
|
|
2
2
|
export interface T2WEventResponse {
|
|
3
3
|
events: T2WEvent[];
|
|
4
4
|
page: number;
|
|
@@ -274,12 +274,12 @@ export declare enum RaceStatus {
|
|
|
274
274
|
export interface ParticipantInfoOptions {
|
|
275
275
|
raceId?: number;
|
|
276
276
|
dataExtra?: ('order' | 'attributes' | 'categories' | 'uci_id' | 'chip_code' | 'externalticket' | 'contactinfo')[];
|
|
277
|
-
gender?:
|
|
277
|
+
gender?: T2WGender;
|
|
278
278
|
maxEventAge?: number;
|
|
279
279
|
}
|
|
280
280
|
export interface IndividualResultsOptions {
|
|
281
281
|
dataExtra?: ('splits' | 'laps' | 'positions' | 'attributes')[];
|
|
282
|
-
gender?:
|
|
282
|
+
gender?: T2WGender;
|
|
283
283
|
maxEventAge?: number;
|
|
284
284
|
}
|
|
285
285
|
export interface EventDataOptions {
|
|
@@ -287,10 +287,11 @@ export interface EventDataOptions {
|
|
|
287
287
|
}
|
|
288
288
|
export interface TeamResultOptions {
|
|
289
289
|
dataExtra?: ('splits' | 'attributes' | 'laps')[];
|
|
290
|
-
teamType?:
|
|
290
|
+
teamType?: T2WGender;
|
|
291
291
|
}
|
|
292
292
|
export interface TeamsWithMembersOptions {
|
|
293
293
|
raceId?: number;
|
|
294
294
|
dataExtra?: ('teammembers' | 'attributes')[];
|
|
295
295
|
}
|
|
296
|
+
export declare type T2WGender = 'M' | 'F' | 'X' | 'U';
|
|
296
297
|
export {};
|