seatsio 87.7.0 → 87.9.0
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/dist/src/Accounts/Account.js +12 -10
- package/dist/src/Accounts/AccountSettings.js +12 -12
- package/dist/src/Accounts/Accounts.js +28 -32
- package/dist/src/Accounts/ChartValidationSettings.js +9 -8
- package/dist/src/Accounts/DefaultRendererSettings.js +6 -8
- package/dist/src/AsyncIterator.js +39 -97
- package/dist/src/Charts/Category.js +17 -18
- package/dist/src/Charts/CategoryUpdateParams.js +13 -17
- package/dist/src/Charts/Chart.js +21 -14
- package/dist/src/Charts/ChartListParams.js +30 -34
- package/dist/src/Charts/ChartObjectInfo.js +33 -14
- package/dist/src/Charts/ChartValidation.js +5 -8
- package/dist/src/Charts/Charts.js +114 -129
- package/dist/src/Charts/Zone.js +11 -14
- package/dist/src/Common/Floor.js +9 -12
- package/dist/src/Common/IDs.js +6 -10
- package/dist/src/Common/LabelAndType.js +5 -8
- package/dist/src/Common/Labels.js +10 -12
- package/dist/src/Dict.js +1 -2
- package/dist/src/EventLog/EventLog.js +21 -27
- package/dist/src/EventLog/EventLogItem.js +7 -8
- package/dist/src/Events/AbstractEventParams.js +17 -19
- package/dist/src/Events/BestAvailableObjects.js +8 -10
- package/dist/src/Events/BestAvailableParams.js +26 -25
- package/dist/src/Events/ChangeObjectStatusResult.js +6 -10
- package/dist/src/Events/Channel.d.ts +11 -0
- package/dist/src/Events/Channel.js +15 -8
- package/dist/src/Events/Channels.d.ts +8 -7
- package/dist/src/Events/Channels.js +35 -36
- package/dist/src/Events/CreateEventParams.d.ts +3 -3
- package/dist/src/Events/CreateEventParams.js +12 -33
- package/dist/src/Events/EditForSaleConfigResult.js +10 -13
- package/dist/src/Events/Event.js +33 -18
- package/dist/src/Events/EventDeserializer.js +8 -15
- package/dist/src/Events/EventObjectInfo.js +58 -18
- package/dist/src/Events/Events.js +178 -310
- package/dist/src/Events/ForSaleConfig.js +9 -10
- package/dist/src/Events/ForSaleConfigParams.js +8 -13
- package/dist/src/Events/ForSaleRateLimitInfo.js +7 -10
- package/dist/src/Events/ObjectProperties.js +13 -14
- package/dist/src/Events/StatusChange.js +16 -8
- package/dist/src/Events/StatusChangeOrigin.js +5 -8
- package/dist/src/Events/StatusChangeRequest.js +45 -52
- package/dist/src/Events/StatusChangesParams.js +23 -26
- package/dist/src/Events/TableBookingConfig.js +13 -16
- package/dist/src/Events/UpdateEventParams.js +9 -31
- package/dist/src/HoldTokens/HoldToken.js +7 -8
- package/dist/src/HoldTokens/HoldTokens.js +16 -21
- package/dist/src/Lister.js +21 -30
- package/dist/src/LocalDate.js +13 -15
- package/dist/src/Page.js +12 -16
- package/dist/src/PageFetcher.js +21 -69
- package/dist/src/Region.js +16 -20
- package/dist/src/Reports/ChartReports.js +39 -47
- package/dist/src/Reports/EventReports.js +102 -117
- package/dist/src/Reports/UsageReports.js +19 -23
- package/dist/src/Seasons/CreateSeasonParams.d.ts +3 -3
- package/dist/src/Seasons/CreateSeasonParams.js +32 -29
- package/dist/src/Seasons/Season.js +11 -31
- package/dist/src/Seasons/Seasons.d.ts +1 -1
- package/dist/src/Seasons/Seasons.js +54 -108
- package/dist/src/Seasons/UpdateSeasonParams.js +6 -29
- package/dist/src/SeatsioClient.js +72 -77
- package/dist/src/TicketBuyers/AddTicketBuyerIdsResponse.js +5 -8
- package/dist/src/TicketBuyers/RemoveTicketBuyerIdsResponse.js +5 -8
- package/dist/src/TicketBuyers/TicketBuyers.js +27 -76
- package/dist/src/Workspaces/Workspace.js +11 -8
- package/dist/src/Workspaces/Workspaces.js +86 -112
- package/dist/src/errorInterceptor.js +2 -5
- package/dist/src/index.js +63 -79
- package/dist/src/utilities/helperFunctions.js +9 -16
- package/dist/src/utilities/reportUtility.js +19 -28
- package/package.json +5 -5
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export class CreateSeasonParams {
|
|
2
|
+
_eventKeys;
|
|
3
|
+
_key;
|
|
4
|
+
_name;
|
|
5
|
+
_numberOfEvents;
|
|
6
|
+
_tableBookingConfig;
|
|
7
|
+
_objectCategories;
|
|
8
|
+
_categories;
|
|
9
|
+
_channels;
|
|
10
|
+
_forSaleConfig;
|
|
11
|
+
_forSalePropagated;
|
|
12
|
+
key(key) {
|
|
8
13
|
this._key = key;
|
|
9
14
|
return this;
|
|
10
|
-
}
|
|
11
|
-
|
|
15
|
+
}
|
|
16
|
+
name(name) {
|
|
12
17
|
this._name = name;
|
|
13
18
|
return this;
|
|
14
|
-
}
|
|
15
|
-
|
|
19
|
+
}
|
|
20
|
+
numberOfEvents(numberOfEvents) {
|
|
16
21
|
this._numberOfEvents = numberOfEvents;
|
|
17
22
|
return this;
|
|
18
|
-
}
|
|
19
|
-
|
|
23
|
+
}
|
|
24
|
+
eventKeys(eventKeys) {
|
|
20
25
|
this._eventKeys = eventKeys;
|
|
21
26
|
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
27
|
+
}
|
|
28
|
+
tableBookingConfig(tableBookingConfig) {
|
|
24
29
|
this._tableBookingConfig = tableBookingConfig;
|
|
25
30
|
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
31
|
+
}
|
|
32
|
+
channels(channels) {
|
|
28
33
|
this._channels = channels;
|
|
29
34
|
return this;
|
|
30
|
-
}
|
|
31
|
-
|
|
35
|
+
}
|
|
36
|
+
forSaleConfig(forSaleConfig) {
|
|
32
37
|
this._forSaleConfig = forSaleConfig;
|
|
33
38
|
return this;
|
|
34
|
-
}
|
|
35
|
-
|
|
39
|
+
}
|
|
40
|
+
forSalePropagated(forSalePropagated) {
|
|
36
41
|
this._forSalePropagated = forSalePropagated;
|
|
37
42
|
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
43
|
+
}
|
|
44
|
+
objectCategories(objectCategories) {
|
|
40
45
|
this._objectCategories = objectCategories;
|
|
41
46
|
return this;
|
|
42
|
-
}
|
|
43
|
-
|
|
47
|
+
}
|
|
48
|
+
categories(categories) {
|
|
44
49
|
this._categories = categories;
|
|
45
50
|
return this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}());
|
|
49
|
-
exports.CreateSeasonParams = CreateSeasonParams;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Season = void 0;
|
|
19
|
-
var Event_1 = require("../Events/Event");
|
|
20
|
-
var Season = /** @class */ (function (_super) {
|
|
21
|
-
__extends(Season, _super);
|
|
22
|
-
function Season(season) {
|
|
23
|
-
var _this = _super.call(this, season) || this;
|
|
24
|
-
_this.partialSeasonKeys = season.partialSeasonKeys;
|
|
25
|
-
_this.events = season.events ? season.events.map(function (e) { return new Event_1.Event(e); }) : undefined;
|
|
26
|
-
return _this;
|
|
1
|
+
import { Event } from '../Events/Event';
|
|
2
|
+
export class Season extends Event {
|
|
3
|
+
events;
|
|
4
|
+
partialSeasonKeys;
|
|
5
|
+
constructor(season) {
|
|
6
|
+
super(season);
|
|
7
|
+
this.partialSeasonKeys = season.partialSeasonKeys;
|
|
8
|
+
this.events = season.events ? season.events.map((e) => new Event(e)) : undefined;
|
|
27
9
|
}
|
|
28
|
-
|
|
10
|
+
isSeason() {
|
|
29
11
|
return true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}(Event_1.Event));
|
|
33
|
-
exports.Season = Season;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -13,5 +13,5 @@ export declare class Seasons {
|
|
|
13
13
|
createEvents(key: string, numberOfEvents?: number | null, eventKeys?: string[] | null): Promise<any>;
|
|
14
14
|
addEventsToPartialSeason(topLevelSeasonKey: string, partialSeasonKey: string, eventKeys: string[]): Promise<Season>;
|
|
15
15
|
removeEventFromPartialSeason(topLevelSeasonKey: string, partialSeasonKey: string, eventKey: string): Promise<Season>;
|
|
16
|
-
retrieve(key: string): Promise<import("
|
|
16
|
+
retrieve(key: string): Promise<import("..").Event>;
|
|
17
17
|
}
|
|
@@ -1,52 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Seasons = void 0;
|
|
40
|
-
var Season_1 = require("./Season");
|
|
41
|
-
var EventDeserializer_1 = require("../Events/EventDeserializer");
|
|
42
|
-
var Seasons = /** @class */ (function () {
|
|
43
|
-
function Seasons(client, seatsioClient) {
|
|
1
|
+
import { Season } from './Season';
|
|
2
|
+
import { EventDeserializer } from '../Events/EventDeserializer';
|
|
3
|
+
export class Seasons {
|
|
4
|
+
client;
|
|
5
|
+
seatsioClient;
|
|
6
|
+
constructor(client, seatsioClient) {
|
|
44
7
|
this.client = client;
|
|
45
8
|
this.seatsioClient = seatsioClient;
|
|
46
9
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var requestParameters = {};
|
|
10
|
+
create(chartKey, seasonParams = null) {
|
|
11
|
+
const requestParameters = {};
|
|
50
12
|
requestParameters.chartKey = chartKey;
|
|
51
13
|
if (seasonParams !== null) {
|
|
52
14
|
if (seasonParams._key !== undefined) {
|
|
@@ -81,40 +43,32 @@ var Seasons = /** @class */ (function () {
|
|
|
81
43
|
}
|
|
82
44
|
}
|
|
83
45
|
return this.client.post('/seasons', requestParameters)
|
|
84
|
-
.then(
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
Seasons.prototype.createPartialSeason = function (topLevelSeasonKey, partialSeasonKey, name, eventKeys) {
|
|
114
|
-
if (partialSeasonKey === void 0) { partialSeasonKey = null; }
|
|
115
|
-
if (name === void 0) { name = null; }
|
|
116
|
-
if (eventKeys === void 0) { eventKeys = null; }
|
|
117
|
-
var requestParameters = {};
|
|
46
|
+
.then(res => new Season(res.data));
|
|
47
|
+
}
|
|
48
|
+
async update(seasonKey, params) {
|
|
49
|
+
const requestParameters = {};
|
|
50
|
+
if (params.key !== undefined) {
|
|
51
|
+
requestParameters.eventKey = params.key;
|
|
52
|
+
}
|
|
53
|
+
if (params.tableBookingConfig !== undefined) {
|
|
54
|
+
requestParameters.tableBookingConfig = params.tableBookingConfig;
|
|
55
|
+
}
|
|
56
|
+
if (params.objectCategories !== undefined) {
|
|
57
|
+
requestParameters.objectCategories = params.objectCategories;
|
|
58
|
+
}
|
|
59
|
+
if (params.categories !== undefined) {
|
|
60
|
+
requestParameters.categories = params.categories;
|
|
61
|
+
}
|
|
62
|
+
if (params.name !== undefined) {
|
|
63
|
+
requestParameters.name = params.name;
|
|
64
|
+
}
|
|
65
|
+
if (params.forSalePropagated !== undefined) {
|
|
66
|
+
requestParameters.forSalePropagated = params.forSalePropagated;
|
|
67
|
+
}
|
|
68
|
+
return this.client.post(`events/${encodeURIComponent(seasonKey)}`, requestParameters);
|
|
69
|
+
}
|
|
70
|
+
createPartialSeason(topLevelSeasonKey, partialSeasonKey = null, name = null, eventKeys = null) {
|
|
71
|
+
const requestParameters = {};
|
|
118
72
|
if (partialSeasonKey !== null) {
|
|
119
73
|
requestParameters.key = partialSeasonKey;
|
|
120
74
|
}
|
|
@@ -124,38 +78,30 @@ var Seasons = /** @class */ (function () {
|
|
|
124
78
|
if (eventKeys !== null) {
|
|
125
79
|
requestParameters.eventKeys = eventKeys;
|
|
126
80
|
}
|
|
127
|
-
return this.client.post(
|
|
128
|
-
.then(
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (eventKeys === void 0) { eventKeys = null; }
|
|
133
|
-
var requestParameters = {};
|
|
81
|
+
return this.client.post(`/seasons/${encodeURIComponent(topLevelSeasonKey)}/partial-seasons`, requestParameters)
|
|
82
|
+
.then(res => new Season(res.data));
|
|
83
|
+
}
|
|
84
|
+
createEvents(key, numberOfEvents = null, eventKeys = null) {
|
|
85
|
+
const requestParameters = {};
|
|
134
86
|
if (numberOfEvents !== null) {
|
|
135
87
|
requestParameters.numberOfEvents = numberOfEvents;
|
|
136
88
|
}
|
|
137
89
|
if (eventKeys !== null) {
|
|
138
90
|
requestParameters.eventKeys = eventKeys;
|
|
139
91
|
}
|
|
140
|
-
return this.client.post(
|
|
141
|
-
.then(
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return this.client.post(
|
|
146
|
-
.then(
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
Seasons.prototype.retrieve = function (key) {
|
|
92
|
+
return this.client.post(`/seasons/${encodeURIComponent(key)}/actions/create-events`, requestParameters)
|
|
93
|
+
.then(res => res.data.events.map((e) => new EventDeserializer().fromJson(e)));
|
|
94
|
+
}
|
|
95
|
+
addEventsToPartialSeason(topLevelSeasonKey, partialSeasonKey, eventKeys) {
|
|
96
|
+
const requestParameters = { eventKeys };
|
|
97
|
+
return this.client.post(`/seasons/${encodeURIComponent(topLevelSeasonKey)}/partial-seasons/${encodeURIComponent(partialSeasonKey)}/actions/add-events`, requestParameters)
|
|
98
|
+
.then(res => new Season(res.data));
|
|
99
|
+
}
|
|
100
|
+
async removeEventFromPartialSeason(topLevelSeasonKey, partialSeasonKey, eventKey) {
|
|
101
|
+
return this.client.delete(`/seasons/${encodeURIComponent(topLevelSeasonKey)}/partial-seasons/${encodeURIComponent(partialSeasonKey)}/events/${encodeURIComponent(eventKey)}`)
|
|
102
|
+
.then(res => new Season(res.data));
|
|
103
|
+
}
|
|
104
|
+
retrieve(key) {
|
|
157
105
|
return this.seatsioClient.events.retrieve(key);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
}());
|
|
161
|
-
exports.Seasons = Seasons;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.UpdateSeasonParams = void 0;
|
|
19
|
-
var AbstractEventParams_1 = require("../Events/AbstractEventParams");
|
|
20
|
-
var UpdateSeasonParams = /** @class */ (function (_super) {
|
|
21
|
-
__extends(UpdateSeasonParams, _super);
|
|
22
|
-
function UpdateSeasonParams() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
UpdateSeasonParams.prototype.withForSalePropagated = function (forSalePropagated) {
|
|
1
|
+
import { AbstractEventParams } from '../Events/AbstractEventParams';
|
|
2
|
+
export class UpdateSeasonParams extends AbstractEventParams {
|
|
3
|
+
forSalePropagated;
|
|
4
|
+
withForSalePropagated(forSalePropagated) {
|
|
26
5
|
this.forSalePropagated = forSalePropagated;
|
|
27
6
|
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}(AbstractEventParams_1.AbstractEventParams));
|
|
31
|
-
exports.UpdateSeasonParams = UpdateSeasonParams;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,111 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var SeatsioClient = /** @class */ (function () {
|
|
33
|
-
function SeatsioClient(region, secretKey, workspaceKey, extraHeaders) {
|
|
34
|
-
if (workspaceKey === void 0) { workspaceKey = undefined; }
|
|
35
|
-
if (extraHeaders === void 0) { extraHeaders = {}; }
|
|
36
|
-
this.client = axios_1.default.create(this._axiosConfig(region.url, secretKey, workspaceKey, extraHeaders));
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { Accounts } from './Accounts/Accounts';
|
|
3
|
+
import { Charts } from './Charts/Charts';
|
|
4
|
+
import { errorResponseHandler } from './errorInterceptor';
|
|
5
|
+
import { EventLog } from './EventLog/EventLog';
|
|
6
|
+
import { Events } from './Events/Events';
|
|
7
|
+
import { HoldTokens } from './HoldTokens/HoldTokens';
|
|
8
|
+
import { ChartReports } from './Reports/ChartReports';
|
|
9
|
+
import { EventReports } from './Reports/EventReports';
|
|
10
|
+
import { UsageReports } from './Reports/UsageReports';
|
|
11
|
+
import { Seasons } from './Seasons/Seasons';
|
|
12
|
+
import { TicketBuyers } from './TicketBuyers/TicketBuyers';
|
|
13
|
+
import { Workspaces } from './Workspaces/Workspaces';
|
|
14
|
+
const TEN_SECONDS = 10000;
|
|
15
|
+
export class SeatsioClient {
|
|
16
|
+
accounts;
|
|
17
|
+
chartReports;
|
|
18
|
+
charts;
|
|
19
|
+
client;
|
|
20
|
+
errInterceptor;
|
|
21
|
+
eventReports;
|
|
22
|
+
events;
|
|
23
|
+
holdTokens;
|
|
24
|
+
requestListener;
|
|
25
|
+
seasons;
|
|
26
|
+
usageReports;
|
|
27
|
+
workspaces;
|
|
28
|
+
eventLog;
|
|
29
|
+
ticketBuyers;
|
|
30
|
+
constructor(region, secretKey, workspaceKey = undefined, extraHeaders = {}) {
|
|
31
|
+
this.client = axios.create(this._axiosConfig(region.url, secretKey, workspaceKey, extraHeaders));
|
|
37
32
|
this._setupRequestListenerInterceptors();
|
|
38
33
|
this.setMaxRetries(5);
|
|
39
|
-
this.client.interceptors.response.use(
|
|
40
|
-
this.errInterceptor = this.client.interceptors.response.use(
|
|
41
|
-
this.charts = new
|
|
42
|
-
this.events = new
|
|
43
|
-
this.workspaces = new
|
|
44
|
-
this.holdTokens = new
|
|
45
|
-
this.accounts = new
|
|
46
|
-
this.chartReports = new
|
|
47
|
-
this.eventReports = new
|
|
48
|
-
this.usageReports = new
|
|
49
|
-
this.seasons = new
|
|
50
|
-
this.eventLog = new
|
|
51
|
-
this.ticketBuyers = new
|
|
34
|
+
this.client.interceptors.response.use((response) => response, exponentialBackoffInterceptor(this.client));
|
|
35
|
+
this.errInterceptor = this.client.interceptors.response.use((response) => response, errorResponseHandler);
|
|
36
|
+
this.charts = new Charts(this.client);
|
|
37
|
+
this.events = new Events(this.client);
|
|
38
|
+
this.workspaces = new Workspaces(this.client);
|
|
39
|
+
this.holdTokens = new HoldTokens(this.client);
|
|
40
|
+
this.accounts = new Accounts(this.client);
|
|
41
|
+
this.chartReports = new ChartReports(this.client);
|
|
42
|
+
this.eventReports = new EventReports(this.client);
|
|
43
|
+
this.usageReports = new UsageReports(this.client);
|
|
44
|
+
this.seasons = new Seasons(this.client, this);
|
|
45
|
+
this.eventLog = new EventLog(this.client, this);
|
|
46
|
+
this.ticketBuyers = new TicketBuyers(this.client, this);
|
|
52
47
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
_axiosConfig(baseUrl, secretKey, workspaceKey, extraHeaders) {
|
|
49
|
+
const headers = {
|
|
50
|
+
...extraHeaders,
|
|
51
|
+
'X-Client-Lib': 'js',
|
|
52
|
+
...(workspaceKey ? { 'X-Workspace-Key': workspaceKey } : {})
|
|
53
|
+
};
|
|
54
|
+
const config = {
|
|
56
55
|
baseURL: baseUrl,
|
|
57
56
|
auth: {
|
|
58
57
|
username: secretKey,
|
|
59
58
|
password: ''
|
|
60
59
|
},
|
|
61
|
-
headers
|
|
60
|
+
headers,
|
|
62
61
|
timeout: TEN_SECONDS,
|
|
63
62
|
paramsSerializer: {
|
|
64
63
|
indexes: null
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
66
|
return config;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
config.listener = _this.requestListener();
|
|
67
|
+
}
|
|
68
|
+
_setupRequestListenerInterceptors() {
|
|
69
|
+
this.client.interceptors.request.use((config) => {
|
|
70
|
+
if (this.requestListener) {
|
|
71
|
+
config.listener = this.requestListener();
|
|
74
72
|
config.listener.onRequestStarted();
|
|
75
73
|
}
|
|
76
74
|
return config;
|
|
77
75
|
});
|
|
78
|
-
this.client.interceptors.response.use(
|
|
76
|
+
this.client.interceptors.response.use((response) => {
|
|
79
77
|
if (response.config.listener) {
|
|
80
78
|
response.config.listener.onRequestEnded();
|
|
81
79
|
}
|
|
82
80
|
return response;
|
|
83
|
-
},
|
|
81
|
+
}, (response) => {
|
|
84
82
|
if (response.config.listener) {
|
|
85
83
|
response.config.listener.onRequestEnded();
|
|
86
84
|
}
|
|
87
85
|
return Promise.reject(response);
|
|
88
86
|
});
|
|
89
|
-
}
|
|
90
|
-
|
|
87
|
+
}
|
|
88
|
+
setRequestListener(requestListener) {
|
|
91
89
|
this.requestListener = requestListener;
|
|
92
90
|
return this;
|
|
93
|
-
}
|
|
94
|
-
|
|
91
|
+
}
|
|
92
|
+
setMaxRetries(maxRetries) {
|
|
95
93
|
// @ts-ignore
|
|
96
94
|
this.client.maxRetries = maxRetries;
|
|
97
95
|
return this;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}());
|
|
101
|
-
exports.SeatsioClient = SeatsioClient;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
102
98
|
function exponentialBackoffInterceptor(axios) {
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== 429) {
|
|
99
|
+
return (error) => {
|
|
100
|
+
if (error.response?.status !== 429) {
|
|
106
101
|
return Promise.reject(error);
|
|
107
102
|
}
|
|
108
|
-
|
|
103
|
+
const config = error.config;
|
|
109
104
|
if (!config) {
|
|
110
105
|
return Promise.reject(error);
|
|
111
106
|
}
|
|
@@ -113,11 +108,11 @@ function exponentialBackoffInterceptor(axios) {
|
|
|
113
108
|
if (config.__retryCount >= axios.maxRetries) {
|
|
114
109
|
return Promise.reject(error);
|
|
115
110
|
}
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
const backoff = new Promise(resolve => {
|
|
112
|
+
const waitTime = Math.pow(2, config.__retryCount + 2) * 100;
|
|
118
113
|
config.__retryCount++;
|
|
119
|
-
setTimeout(
|
|
114
|
+
setTimeout(() => resolve(), waitTime);
|
|
120
115
|
});
|
|
121
|
-
return backoff.then(
|
|
116
|
+
return backoff.then(() => axios.request(config));
|
|
122
117
|
};
|
|
123
118
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function AddTicketBuyerIdsResponse(data) {
|
|
1
|
+
export class AddTicketBuyerIdsResponse {
|
|
2
|
+
added;
|
|
3
|
+
alreadyPresent;
|
|
4
|
+
constructor(data) {
|
|
6
5
|
this.added = data.added || [];
|
|
7
6
|
this.alreadyPresent = data.alreadyPresent || [];
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
}());
|
|
11
|
-
exports.AddTicketBuyerIdsResponse = AddTicketBuyerIdsResponse;
|
|
8
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function RemoveTicketBuyerIdsResponse(data) {
|
|
1
|
+
export class RemoveTicketBuyerIdsResponse {
|
|
2
|
+
removed;
|
|
3
|
+
notPresent;
|
|
4
|
+
constructor(data) {
|
|
6
5
|
this.removed = data.removed || [];
|
|
7
6
|
this.notPresent = data.notPresent || [];
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
}());
|
|
11
|
-
exports.RemoveTicketBuyerIdsResponse = RemoveTicketBuyerIdsResponse;
|
|
8
|
+
}
|