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.
Files changed (73) hide show
  1. package/dist/src/Accounts/Account.js +12 -10
  2. package/dist/src/Accounts/AccountSettings.js +12 -12
  3. package/dist/src/Accounts/Accounts.js +28 -32
  4. package/dist/src/Accounts/ChartValidationSettings.js +9 -8
  5. package/dist/src/Accounts/DefaultRendererSettings.js +6 -8
  6. package/dist/src/AsyncIterator.js +39 -97
  7. package/dist/src/Charts/Category.js +17 -18
  8. package/dist/src/Charts/CategoryUpdateParams.js +13 -17
  9. package/dist/src/Charts/Chart.js +21 -14
  10. package/dist/src/Charts/ChartListParams.js +30 -34
  11. package/dist/src/Charts/ChartObjectInfo.js +33 -14
  12. package/dist/src/Charts/ChartValidation.js +5 -8
  13. package/dist/src/Charts/Charts.js +114 -129
  14. package/dist/src/Charts/Zone.js +11 -14
  15. package/dist/src/Common/Floor.js +9 -12
  16. package/dist/src/Common/IDs.js +6 -10
  17. package/dist/src/Common/LabelAndType.js +5 -8
  18. package/dist/src/Common/Labels.js +10 -12
  19. package/dist/src/Dict.js +1 -2
  20. package/dist/src/EventLog/EventLog.js +21 -27
  21. package/dist/src/EventLog/EventLogItem.js +7 -8
  22. package/dist/src/Events/AbstractEventParams.js +17 -19
  23. package/dist/src/Events/BestAvailableObjects.js +8 -10
  24. package/dist/src/Events/BestAvailableParams.js +26 -25
  25. package/dist/src/Events/ChangeObjectStatusResult.js +6 -10
  26. package/dist/src/Events/Channel.d.ts +11 -0
  27. package/dist/src/Events/Channel.js +15 -8
  28. package/dist/src/Events/Channels.d.ts +8 -7
  29. package/dist/src/Events/Channels.js +35 -36
  30. package/dist/src/Events/CreateEventParams.d.ts +3 -3
  31. package/dist/src/Events/CreateEventParams.js +12 -33
  32. package/dist/src/Events/EditForSaleConfigResult.js +10 -13
  33. package/dist/src/Events/Event.js +33 -18
  34. package/dist/src/Events/EventDeserializer.js +8 -15
  35. package/dist/src/Events/EventObjectInfo.js +58 -18
  36. package/dist/src/Events/Events.js +178 -310
  37. package/dist/src/Events/ForSaleConfig.js +9 -10
  38. package/dist/src/Events/ForSaleConfigParams.js +8 -13
  39. package/dist/src/Events/ForSaleRateLimitInfo.js +7 -10
  40. package/dist/src/Events/ObjectProperties.js +13 -14
  41. package/dist/src/Events/StatusChange.js +16 -8
  42. package/dist/src/Events/StatusChangeOrigin.js +5 -8
  43. package/dist/src/Events/StatusChangeRequest.js +45 -52
  44. package/dist/src/Events/StatusChangesParams.js +23 -26
  45. package/dist/src/Events/TableBookingConfig.js +13 -16
  46. package/dist/src/Events/UpdateEventParams.js +9 -31
  47. package/dist/src/HoldTokens/HoldToken.js +7 -8
  48. package/dist/src/HoldTokens/HoldTokens.js +16 -21
  49. package/dist/src/Lister.js +21 -30
  50. package/dist/src/LocalDate.js +13 -15
  51. package/dist/src/Page.js +12 -16
  52. package/dist/src/PageFetcher.js +21 -69
  53. package/dist/src/Region.js +16 -20
  54. package/dist/src/Reports/ChartReports.js +39 -47
  55. package/dist/src/Reports/EventReports.js +102 -117
  56. package/dist/src/Reports/UsageReports.js +19 -23
  57. package/dist/src/Seasons/CreateSeasonParams.d.ts +3 -3
  58. package/dist/src/Seasons/CreateSeasonParams.js +32 -29
  59. package/dist/src/Seasons/Season.js +11 -31
  60. package/dist/src/Seasons/Seasons.d.ts +1 -1
  61. package/dist/src/Seasons/Seasons.js +54 -108
  62. package/dist/src/Seasons/UpdateSeasonParams.js +6 -29
  63. package/dist/src/SeatsioClient.js +72 -77
  64. package/dist/src/TicketBuyers/AddTicketBuyerIdsResponse.js +5 -8
  65. package/dist/src/TicketBuyers/RemoveTicketBuyerIdsResponse.js +5 -8
  66. package/dist/src/TicketBuyers/TicketBuyers.js +27 -76
  67. package/dist/src/Workspaces/Workspace.js +11 -8
  68. package/dist/src/Workspaces/Workspaces.js +86 -112
  69. package/dist/src/errorInterceptor.js +2 -5
  70. package/dist/src/index.js +63 -79
  71. package/dist/src/utilities/helperFunctions.js +9 -16
  72. package/dist/src/utilities/reportUtility.js +19 -28
  73. package/package.json +5 -5
@@ -1,49 +1,52 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateSeasonParams = void 0;
4
- var CreateSeasonParams = /** @class */ (function () {
5
- function CreateSeasonParams() {
6
- }
7
- CreateSeasonParams.prototype.key = function (key) {
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
- CreateSeasonParams.prototype.name = function (name) {
15
+ }
16
+ name(name) {
12
17
  this._name = name;
13
18
  return this;
14
- };
15
- CreateSeasonParams.prototype.numberOfEvents = function (numberOfEvents) {
19
+ }
20
+ numberOfEvents(numberOfEvents) {
16
21
  this._numberOfEvents = numberOfEvents;
17
22
  return this;
18
- };
19
- CreateSeasonParams.prototype.eventKeys = function (eventKeys) {
23
+ }
24
+ eventKeys(eventKeys) {
20
25
  this._eventKeys = eventKeys;
21
26
  return this;
22
- };
23
- CreateSeasonParams.prototype.tableBookingConfig = function (tableBookingConfig) {
27
+ }
28
+ tableBookingConfig(tableBookingConfig) {
24
29
  this._tableBookingConfig = tableBookingConfig;
25
30
  return this;
26
- };
27
- CreateSeasonParams.prototype.channels = function (channels) {
31
+ }
32
+ channels(channels) {
28
33
  this._channels = channels;
29
34
  return this;
30
- };
31
- CreateSeasonParams.prototype.forSaleConfig = function (forSaleConfig) {
35
+ }
36
+ forSaleConfig(forSaleConfig) {
32
37
  this._forSaleConfig = forSaleConfig;
33
38
  return this;
34
- };
35
- CreateSeasonParams.prototype.forSalePropagated = function (forSalePropagated) {
39
+ }
40
+ forSalePropagated(forSalePropagated) {
36
41
  this._forSalePropagated = forSalePropagated;
37
42
  return this;
38
- };
39
- CreateSeasonParams.prototype.objectCategories = function (objectCategories) {
43
+ }
44
+ objectCategories(objectCategories) {
40
45
  this._objectCategories = objectCategories;
41
46
  return this;
42
- };
43
- CreateSeasonParams.prototype.categories = function (categories) {
47
+ }
48
+ categories(categories) {
44
49
  this._categories = categories;
45
50
  return this;
46
- };
47
- return CreateSeasonParams;
48
- }());
49
- exports.CreateSeasonParams = CreateSeasonParams;
51
+ }
52
+ }
@@ -1,33 +1,13 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
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.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
- Season.prototype.isSeason = function () {
10
+ isSeason() {
29
11
  return true;
30
- };
31
- return Season;
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("../Events/Event").Event>;
16
+ retrieve(key: string): Promise<import("..").Event>;
17
17
  }
@@ -1,52 +1,14 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
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
- Seasons.prototype.create = function (chartKey, seasonParams) {
48
- if (seasonParams === void 0) { seasonParams = null; }
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(function (res) { return new Season_1.Season(res.data); });
85
- };
86
- Seasons.prototype.update = function (seasonKey, params) {
87
- return __awaiter(this, void 0, void 0, function () {
88
- var requestParameters;
89
- return __generator(this, function (_a) {
90
- requestParameters = {};
91
- if (params.key !== undefined) {
92
- requestParameters.eventKey = params.key;
93
- }
94
- if (params.tableBookingConfig !== undefined) {
95
- requestParameters.tableBookingConfig = params.tableBookingConfig;
96
- }
97
- if (params.objectCategories !== undefined) {
98
- requestParameters.objectCategories = params.objectCategories;
99
- }
100
- if (params.categories !== undefined) {
101
- requestParameters.categories = params.categories;
102
- }
103
- if (params.name !== undefined) {
104
- requestParameters.name = params.name;
105
- }
106
- if (params.forSalePropagated !== undefined) {
107
- requestParameters.forSalePropagated = params.forSalePropagated;
108
- }
109
- return [2 /*return*/, this.client.post("events/".concat(encodeURIComponent(seasonKey)), requestParameters)];
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("/seasons/".concat(encodeURIComponent(topLevelSeasonKey), "/partial-seasons"), requestParameters)
128
- .then(function (res) { return new Season_1.Season(res.data); });
129
- };
130
- Seasons.prototype.createEvents = function (key, numberOfEvents, eventKeys) {
131
- if (numberOfEvents === void 0) { numberOfEvents = null; }
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("/seasons/".concat(encodeURIComponent(key), "/actions/create-events"), requestParameters)
141
- .then(function (res) { return res.data.events.map(function (e) { return new EventDeserializer_1.EventDeserializer().fromJson(e); }); });
142
- };
143
- Seasons.prototype.addEventsToPartialSeason = function (topLevelSeasonKey, partialSeasonKey, eventKeys) {
144
- var requestParameters = { eventKeys: eventKeys };
145
- return this.client.post("/seasons/".concat(encodeURIComponent(topLevelSeasonKey), "/partial-seasons/").concat(encodeURIComponent(partialSeasonKey), "/actions/add-events"), requestParameters)
146
- .then(function (res) { return new Season_1.Season(res.data); });
147
- };
148
- Seasons.prototype.removeEventFromPartialSeason = function (topLevelSeasonKey, partialSeasonKey, eventKey) {
149
- return __awaiter(this, void 0, void 0, function () {
150
- return __generator(this, function (_a) {
151
- return [2 /*return*/, this.client.delete("/seasons/".concat(encodeURIComponent(topLevelSeasonKey), "/partial-seasons/").concat(encodeURIComponent(partialSeasonKey), "/events/").concat(encodeURIComponent(eventKey)))
152
- .then(function (res) { return new Season_1.Season(res.data); })];
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
- return Seasons;
160
- }());
161
- exports.Seasons = Seasons;
106
+ }
107
+ }
@@ -1,31 +1,8 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
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
- return UpdateSeasonParams;
30
- }(AbstractEventParams_1.AbstractEventParams));
31
- exports.UpdateSeasonParams = UpdateSeasonParams;
7
+ }
8
+ }
@@ -1,111 +1,106 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SeatsioClient = void 0;
18
- var axios_1 = __importDefault(require("axios"));
19
- var Accounts_1 = require("./Accounts/Accounts");
20
- var Charts_1 = require("./Charts/Charts");
21
- var errorInterceptor_1 = require("./errorInterceptor");
22
- var EventLog_1 = require("./EventLog/EventLog");
23
- var Events_1 = require("./Events/Events");
24
- var HoldTokens_1 = require("./HoldTokens/HoldTokens");
25
- var ChartReports_1 = require("./Reports/ChartReports");
26
- var EventReports_1 = require("./Reports/EventReports");
27
- var UsageReports_1 = require("./Reports/UsageReports");
28
- var Seasons_1 = require("./Seasons/Seasons");
29
- var TicketBuyers_1 = require("./TicketBuyers/TicketBuyers");
30
- var Workspaces_1 = require("./Workspaces/Workspaces");
31
- var TEN_SECONDS = 10000;
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(function (response) { return response; }, exponentialBackoffInterceptor(this.client));
40
- this.errInterceptor = this.client.interceptors.response.use(function (response) { return response; }, errorInterceptor_1.errorResponseHandler);
41
- this.charts = new Charts_1.Charts(this.client);
42
- this.events = new Events_1.Events(this.client);
43
- this.workspaces = new Workspaces_1.Workspaces(this.client);
44
- this.holdTokens = new HoldTokens_1.HoldTokens(this.client);
45
- this.accounts = new Accounts_1.Accounts(this.client);
46
- this.chartReports = new ChartReports_1.ChartReports(this.client);
47
- this.eventReports = new EventReports_1.EventReports(this.client);
48
- this.usageReports = new UsageReports_1.UsageReports(this.client);
49
- this.seasons = new Seasons_1.Seasons(this.client, this);
50
- this.eventLog = new EventLog_1.EventLog(this.client, this);
51
- this.ticketBuyers = new TicketBuyers_1.TicketBuyers(this.client, this);
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
- SeatsioClient.prototype._axiosConfig = function (baseUrl, secretKey, workspaceKey, extraHeaders) {
54
- var headers = __assign(__assign(__assign({}, extraHeaders), { 'X-Client-Lib': 'js' }), (workspaceKey ? { 'X-Workspace-Key': workspaceKey } : {}));
55
- var config = {
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: 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
- SeatsioClient.prototype._setupRequestListenerInterceptors = function () {
70
- var _this = this;
71
- this.client.interceptors.request.use(function (config) {
72
- if (_this.requestListener) {
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(function (response) {
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
- }, function (response) {
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
- SeatsioClient.prototype.setRequestListener = function (requestListener) {
87
+ }
88
+ setRequestListener(requestListener) {
91
89
  this.requestListener = requestListener;
92
90
  return this;
93
- };
94
- SeatsioClient.prototype.setMaxRetries = function (maxRetries) {
91
+ }
92
+ setMaxRetries(maxRetries) {
95
93
  // @ts-ignore
96
94
  this.client.maxRetries = maxRetries;
97
95
  return this;
98
- };
99
- return SeatsioClient;
100
- }());
101
- exports.SeatsioClient = SeatsioClient;
96
+ }
97
+ }
102
98
  function exponentialBackoffInterceptor(axios) {
103
- return function (error) {
104
- var _a;
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
- var config = error.config;
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
- var backoff = new Promise(function (resolve) {
117
- var waitTime = Math.pow(2, config.__retryCount + 2) * 100;
111
+ const backoff = new Promise(resolve => {
112
+ const waitTime = Math.pow(2, config.__retryCount + 2) * 100;
118
113
  config.__retryCount++;
119
- setTimeout(function () { return resolve(); }, waitTime);
114
+ setTimeout(() => resolve(), waitTime);
120
115
  });
121
- return backoff.then(function () { return axios.request(config); });
116
+ return backoff.then(() => axios.request(config));
122
117
  };
123
118
  }
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AddTicketBuyerIdsResponse = void 0;
4
- var AddTicketBuyerIdsResponse = /** @class */ (function () {
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
- return AddTicketBuyerIdsResponse;
10
- }());
11
- exports.AddTicketBuyerIdsResponse = AddTicketBuyerIdsResponse;
8
+ }
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RemoveTicketBuyerIdsResponse = void 0;
4
- var RemoveTicketBuyerIdsResponse = /** @class */ (function () {
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
- return RemoveTicketBuyerIdsResponse;
10
- }());
11
- exports.RemoveTicketBuyerIdsResponse = RemoveTicketBuyerIdsResponse;
8
+ }