seatsio 63.6.0 → 65.1.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 (38) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/.github/workflows/release.yml +39 -0
  3. package/README.md +49 -5
  4. package/package.json +7 -7
  5. package/releasing.md +6 -0
  6. package/src/Accounts/Accounts.js +4 -4
  7. package/src/Charts/ChartListParams.js +14 -2
  8. package/src/{Reports/ChartReportItem.js → Charts/ChartObjectInfo.js} +2 -2
  9. package/src/Charts/Charts.js +11 -11
  10. package/src/Events/ChangeObjectStatusResult.js +1 -1
  11. package/src/{Reports/EventReportItem.js → Events/EventObjectInfo.js} +9 -3
  12. package/src/Events/Events.js +64 -25
  13. package/src/Events/StatusChangeRequest.js +5 -1
  14. package/src/Reports/ChartReports.js +4 -4
  15. package/src/Reports/EventReports.js +44 -16
  16. package/src/SeatsioClient.js +8 -3
  17. package/src/errorInterceptor.js +1 -2
  18. package/src/utilities/reportUtility.js +7 -7
  19. package/tests/charts/listAllCharts.test.js +26 -8
  20. package/tests/eventReports/eventReport.test.js +44 -14
  21. package/tests/eventReports/eventReportDeepSummary.test.js +19 -5
  22. package/tests/eventReports/eventReportSummary.test.js +117 -10
  23. package/tests/events/bookObject.test.js +24 -24
  24. package/tests/events/changeBestAvailableObjectStatus.test.js +24 -24
  25. package/tests/events/changeObjectStatus.test.js +55 -24
  26. package/tests/events/changeObjectStatusForMultipleEvents.test.js +17 -17
  27. package/tests/events/changeObjectStatusForMultipleObjects.test.js +31 -31
  28. package/tests/events/changeObjectStatusInBatch.test.js +36 -2
  29. package/tests/events/holdObjects.test.js +13 -13
  30. package/tests/events/listAllStatusChanges.test.js +2 -3
  31. package/tests/events/releaseObjects.test.js +16 -16
  32. package/tests/events/retrieveEventObjectInfo.test.js +16 -0
  33. package/tests/events/retrieveEventObjectInfos.test.js +30 -0
  34. package/tests/events/updateExtraData.test.js +2 -2
  35. package/tests/events/updateExtraDatas.test.js +4 -4
  36. package/tests/exponentialBackoff.test.js +19 -6
  37. package/src/Events/ObjectStatus.js +0 -20
  38. package/tests/events/retrieveObjectStatus.test.js +0 -16
@@ -1,4 +1,4 @@
1
- name: 'Publish'
1
+ name: 'Publish release'
2
2
 
3
3
  on:
4
4
  release:
@@ -0,0 +1,39 @@
1
+ name: 'Create release'
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ versionType:
7
+ description: 'minor or major'
8
+ required: true
9
+ description:
10
+ description: 'Release description'
11
+ required: true
12
+
13
+ jobs:
14
+ build:
15
+
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - uses: oleksiyrudenko/gha-git-credentials@v2-latest
21
+ with:
22
+ token: '${{ secrets.GITHUB_TOKEN }}'
23
+ - uses: actions/setup-node@v1
24
+ with:
25
+ node-version: 13
26
+ registry-url: https://registry.npmjs.org/
27
+ - run: npm version ${{ github.event.inputs.versionType }}
28
+ - uses: ad-m/github-push-action@master
29
+ with:
30
+ github_token: ${{ secrets.GITHUB_TOKEN }}
31
+ branch: ${{ github.ref }}
32
+ tags: true
33
+ - id: package-version
34
+ uses: martinbeentjes/npm-get-version-action@master
35
+ - uses: ncipollo/release-action@v1
36
+ with:
37
+ token: ${{ secrets.GITHUB_TOKEN }}
38
+ tag: 'v${{ steps.package-version.outputs.current-version}}'
39
+ body: ${{ github.event.inputs.description }}
package/README.md CHANGED
@@ -154,6 +154,23 @@ A combination of filter, sorting order and sorting option is also possible.
154
154
  let parameter = new StatusChangesParams().withFilter('testFilter').sortByStatus().sortAscending()
155
155
  ```
156
156
 
157
+ ### Retrieving object category and status (and other information)
158
+
159
+ ```js
160
+ import { SeatsioClient, Region } from 'seatsio'
161
+
162
+ let client = new SeatsioClient(Region.EU(), <WORKSPACE SECRET KEY>)
163
+ let objectInfos = await client.events.retrieveObjectInfos(event.key, ['A-1', 'A-2'])
164
+
165
+ console.log(objectInfos['A-1'].categoryKey)
166
+ console.log(objectInfos['A-1'].categoryLabel)
167
+ console.log(objectInfos['A-1'].status)
168
+
169
+ console.log(objectInfos['A-2'].categoryKey)
170
+ console.log(objectInfos['A-2'].categoryLabel)
171
+ console.log(objectInfos['A-2'].status)
172
+ ```
173
+
157
174
  ### Event reports
158
175
 
159
176
  Want to know which seats of an event are booked, and which ones are free? That’s where reporting comes in handy.
@@ -224,15 +241,42 @@ let client = new SeatsioClient(Region.EU(), <COMPANY ADMIN KEY>)
224
241
  await client.workspaces.create('a workspace');
225
242
  ```
226
243
 
244
+ ### Creating a chart and an event with the company admin key
245
+
246
+ ```js
247
+ import { SeatsioClient, Region } from 'seatsio'
248
+
249
+ let client = new SeatsioClient(Region.EU(), <COMPANY ADMIN KEY>, <WORKSPACE PUBLIC KEY>)
250
+ let chart = await client.charts.create()
251
+ let event = await client.events.create(chart.key)
252
+ console.log(`Created a chart with key ${chart.key} and an event with key: ${event.key}`)
253
+ ```
254
+
227
255
  ## Error Handling
228
- When an API call results in an error, a rejected promise is returned with the response received from the server. This response contains a message string describing what went wrong, and also two other properties:
256
+ When an API call results in an error, a rejected promise is returned with a value that looks like
257
+
258
+ ```json
259
+ {
260
+ errors: [{ code: 'RATE_LIMIT_EXCEEDED', message: 'Rate limit exceeded' }],
261
+ messages: ['Rate limit exceeded'],
262
+ requestId: '123456',
263
+ status: 429
264
+ }
265
+ ```
229
266
 
230
- - `messages`: an array of error messages that the server returned. In most cases, this array will contain only one element.
231
- - `requestId`: the identifier of the request you made. Please mention this to us when you have questions, as it will make debugging easier.
232
- -
233
267
  ## Rate limiting - exponential backoff
234
268
 
235
269
  This library supports [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff).
236
270
 
237
271
  When you send too many concurrent requests, the server returns an error `429 - Too Many Requests`. The client reacts to this by waiting for a while, and then retrying the request.
238
- If the request still fails with an error `429`, it waits a little longer, and try again. This happens at most 5 times, before giving up (after approximately 15 seconds).
272
+ If the request still fails with an error `429`, it waits a little longer, and try again. By default this happens 5 times, before giving up (after approximately 15 seconds).
273
+
274
+ To change the maximum number of retries, create the `SeatsioClient` as follows:
275
+
276
+ ```js
277
+ import { SeatsioClient, Region } from 'seatsio'
278
+
279
+ let client = new SeatsioClient(Region.EU(), <WORKSPACE SECRET KEY>).setMaxRetries(3)
280
+ ```
281
+
282
+ Passing in 0 disables exponential backoff completely. In that case, the client will never retry a failed request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seatsio",
3
- "version": "63.6.0",
3
+ "version": "65.1.0",
4
4
  "main": "index.js",
5
5
  "description": "Official JavaScript and Node.JS client library for the Seats.io REST API",
6
6
  "license": "MIT",
@@ -14,15 +14,15 @@
14
14
  "url": "https://github.com/seatsio/seatsio-js"
15
15
  },
16
16
  "dependencies": {
17
- "axios": "0.21.1"
17
+ "axios": "0.24.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "browserify": "latest",
21
- "eslint": "7.27.0",
21
+ "eslint": "7.32.0",
22
22
  "eslint-config-standard": "16.0.3",
23
- "eslint-plugin-import": "2.23.4",
23
+ "eslint-plugin-import": "2.25.3",
24
24
  "eslint-plugin-node": "11.1.0",
25
- "eslint-plugin-promise": "5.1.0",
25
+ "eslint-plugin-promise": "5.2.0",
26
26
  "eslint-plugin-standard": "5.0.0",
27
27
  "gulp": "latest",
28
28
  "gulp-buffer": "latest",
@@ -30,8 +30,8 @@
30
30
  "gulp-tap": "latest",
31
31
  "gulp-uglify": "latest",
32
32
  "gulp-uglify-es": "latest",
33
- "jest": "27.0.3",
34
- "jest-cli": "27.0.3",
33
+ "jest": "27.4.3",
34
+ "jest-cli": "27.4.3",
35
35
  "uuid": "8.3.2"
36
36
  }
37
37
  }
package/releasing.md CHANGED
@@ -1,4 +1,10 @@
1
1
  *Note: this is internal documentation for the seats.io team*
2
2
 
3
+ Through GitHub actions (the preferred way):
4
+
5
+ Run https://github.com/seatsio/seatsio-js/actions/workflows/release.yml
6
+
7
+ Manually:
8
+
3
9
  1) Set the correct version number in package.json
4
10
  2) Create the release in GitHub
@@ -8,28 +8,28 @@ class Accounts {
8
8
  }
9
9
 
10
10
  /**
11
- * @returns {Promise<Account>} Promise that resolves to Account object
11
+ * @returns {Promise<Account>}
12
12
  */
13
13
  retrieveMyAccount () {
14
14
  return this.client.get(baseUrl).then((res) => new Account(res.data))
15
15
  }
16
16
 
17
17
  /**
18
- * @returns {Promise<string>} Promise that resolves to a string
18
+ * @returns {Promise<string>}
19
19
  */
20
20
  regenerateSecretKey () {
21
21
  return this.client.post(baseUrl + '/secret-key/actions/regenerate').then((res) => res.data.secretKey)
22
22
  }
23
23
 
24
24
  /**
25
- * @returns {Promise<string>} Promise that resolves to a string
25
+ * @returns {Promise<string>}
26
26
  */
27
27
  regenerateDesignerKey () {
28
28
  return this.client.post(baseUrl + '/designer-key/actions/regenerate').then((res) => res.data.designerKey)
29
29
  }
30
30
 
31
31
  /**
32
- * @returns {Promise} Promise
32
+ * @returns {Promise}
33
33
  */
34
34
  enableDraftChartDrawings () {
35
35
  return this.client.post(baseUrl + '/draft-chart-drawings/actions/enable')
@@ -4,11 +4,13 @@ class ChartListParams {
4
4
  * @param {?string} tag
5
5
  * @param {?boolean} expandEvents
6
6
  * @param {?boolean} withValidation
7
+ * @param {?number} eventsLimit
7
8
  */
8
- constructor (filter = null, tag = null, expandEvents = null, withValidation = false) {
9
+ constructor (filter = null, tag = null, expandEvents = null, withValidation = false, eventsLimit = null) {
9
10
  this.filter = filter
10
11
  this.tag = tag
11
12
  this.validation = withValidation
13
+ this.eventsLimit = eventsLimit
12
14
  if (expandEvents === true) {
13
15
  this.expand = 'events'
14
16
  }
@@ -43,6 +45,15 @@ class ChartListParams {
43
45
  return this
44
46
  }
45
47
 
48
+ /**
49
+ * @param {number} eventsLimit
50
+ * @returns {ChartListParams}
51
+ */
52
+ withEventsLimit (eventsLimit) {
53
+ this.eventsLimit = eventsLimit
54
+ return this
55
+ }
56
+
46
57
  /**
47
58
  *
48
59
  * @param {boolean} validation
@@ -58,7 +69,8 @@ class ChartListParams {
58
69
  tag: this.tag,
59
70
  expand: this.expand,
60
71
  filter: this.filter,
61
- validation: this.validation
72
+ validation: this.validation,
73
+ eventsLimit: this.eventsLimit
62
74
  }
63
75
  }
64
76
  }
@@ -1,7 +1,7 @@
1
1
  const helperFunctions = require('../utilities/helperFunctions.js')
2
2
  const { IDs } = require('../Common/IDs')
3
3
 
4
- class ChartReportItem {
4
+ class ChartObjectInfo {
5
5
  /**
6
6
  * @param {object} chartReport
7
7
  */
@@ -22,4 +22,4 @@ class ChartReportItem {
22
22
  }
23
23
  }
24
24
 
25
- module.exports = ChartReportItem
25
+ module.exports = ChartObjectInfo
@@ -19,7 +19,7 @@ class Charts {
19
19
  * @param {?string} name
20
20
  * @param {?string} venueType
21
21
  * @param {?Object[]} categories
22
- * @returns {Promise<Chart>} Promise that resolves to Chart object
22
+ * @returns {Promise<Chart>}
23
23
  */
24
24
  create (name = null, venueType = null, categories = null) {
25
25
  const requestParameters = {}
@@ -80,7 +80,7 @@ class Charts {
80
80
 
81
81
  /**
82
82
  * @param {string} key
83
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
83
+ * @returns {Promise<Chart>}
84
84
  */
85
85
  retrieve (key) {
86
86
  return this.client.get(`charts/${key}`)
@@ -89,7 +89,7 @@ class Charts {
89
89
 
90
90
  /**
91
91
  * @param {string} key
92
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
92
+ * @returns {Promise<Chart>}
93
93
  */
94
94
  retrieveWithEvents (key) {
95
95
  return this.client.get(`charts/${key}?expand=events`)
@@ -98,7 +98,7 @@ class Charts {
98
98
 
99
99
  /**
100
100
  * @param {string} key
101
- * @returns {Promise} Promise that resolves to JSON
101
+ * @returns {Promise}
102
102
  */
103
103
  retrievePublishedVersion (key) {
104
104
  return this.client.get(`charts/${key}/version/published`)
@@ -107,7 +107,7 @@ class Charts {
107
107
 
108
108
  /**
109
109
  * @param {string} key
110
- * @returns {Promise} Promise that resolves to JSON
110
+ * @returns {Promise}
111
111
  */
112
112
  retrieveDraftVersion (key) {
113
113
  return this.client.get(`charts/${key}/version/draft`)
@@ -148,7 +148,7 @@ class Charts {
148
148
 
149
149
  /**
150
150
  * @param {string} key
151
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
151
+ * @returns {Promise<Chart>}
152
152
  */
153
153
  copy (key) {
154
154
  return this.client.post(`charts/${key}/version/published/actions/copy`)
@@ -157,7 +157,7 @@ class Charts {
157
157
 
158
158
  /**
159
159
  * @param {string} key
160
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
160
+ * @returns {Promise<Chart>}
161
161
  */
162
162
  copyDraftVersion (key) {
163
163
  return this.client.post(`charts/${key}/version/draft/actions/copy`)
@@ -166,7 +166,7 @@ class Charts {
166
166
 
167
167
  /**
168
168
  * @param {string} key
169
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
169
+ * @returns {Promise<Chart>}
170
170
  */
171
171
  copyToSubaccount (key, subaccountId) {
172
172
  return this.client.post(`charts/${key}/version/published/actions/copy-to/${subaccountId}`)
@@ -176,7 +176,7 @@ class Charts {
176
176
  /**
177
177
  * @param {string} key
178
178
  * @params {string} workspaceKey
179
- * @returns {Promise<Chart>} Promise that resolves to a Chart object
179
+ * @returns {Promise<Chart>}
180
180
  */
181
181
  copyToWorkspace (key, workspaceKey) {
182
182
  return this.client.post(`charts/${key}/version/published/actions/copy-to-workspace/${workspaceKey}`)
@@ -193,7 +193,7 @@ class Charts {
193
193
 
194
194
  /**
195
195
  * @param {string} key
196
- * @returns {Promise} Promise that resolves to an SVG doc
196
+ * @returns {Promise}
197
197
  */
198
198
  retrievePublishedVersionThumbnail (key) {
199
199
  return this.client.get(`/charts/${key}/version/published/thumbnail`, { responseType: 'arraybuffer' })
@@ -202,7 +202,7 @@ class Charts {
202
202
 
203
203
  /**
204
204
  * @param {string} key
205
- * @returns {Promise} Promise that resolves to an SVG doc
205
+ * @returns {Promise}
206
206
  */
207
207
  retrieveDraftVersionThumbnail (key) {
208
208
  return this.client.get(`/charts/${key}/version/draft/thumbnail`, { responseType: 'arraybuffer' })
@@ -2,7 +2,7 @@ const utilities = require('../utilities/reportUtility.js')
2
2
 
3
3
  class ChangeObjectStatusResult {
4
4
  /**
5
- * @param {Object.<string, {EventReportItem}>} objects
5
+ * @param {Object.<string, {ObjectInfo}>} objects
6
6
  */
7
7
  constructor (objects) {
8
8
  this.objects = utilities.createChangeObjectStatusDetails(objects)
@@ -1,7 +1,7 @@
1
1
  const helperFunctions = require('../utilities/helperFunctions.js')
2
2
  const { IDs } = require('../Common/IDs')
3
3
 
4
- class EventReportItem {
4
+ class EventObjectInfo {
5
5
  /**
6
6
  * @param {object} report
7
7
  */
@@ -31,11 +31,17 @@ class EventReportItem {
31
31
  this.displayedObjectType = report.displayedObjectType
32
32
  this.leftNeighbour = report.leftNeighbour
33
33
  this.rightNeighbour = report.rightNeighbour
34
- this.isSelectable = report.isSelectable
34
+ this.isAvailable = report.isAvailable
35
+ this.availabilityReason = report.availabilityReason
35
36
  this.isDisabledBySocialDistancing = report.isDisabledBySocialDistancing
36
37
  this.channel = report.channel
37
38
  this.distanceToFocalPoint = report.distanceToFocalPoint
39
+ this.holds = report.holds
38
40
  }
39
41
  }
40
42
 
41
- module.exports = EventReportItem
43
+ EventObjectInfo.FREE = 'free'
44
+ EventObjectInfo.BOOKED = 'booked'
45
+ EventObjectInfo.HELD = 'reservedByToken'
46
+
47
+ module.exports = EventObjectInfo
@@ -1,6 +1,6 @@
1
1
  const Page = require('../Page.js')
2
2
  const Lister = require('../Lister.js')
3
- const ObjectStatus = require('./ObjectStatus.js')
3
+ const EventObjectInfo = require('./EventObjectInfo.js')
4
4
  const StatusChange = require('./StatusChange.js')
5
5
  const BestAvailableObjects = require('./BestAvailableObjects.js')
6
6
  const ChangeObjectStatusResult = require('./ChangeObjectStatusResult.js')
@@ -20,7 +20,7 @@ class Events {
20
20
  * @param {?string} eventKey
21
21
  * @param {?TableBookingConfig} tableBookingConfig
22
22
  * @param {?string} socialDistancingRulesetKey
23
- * @returns {Promise<Event>} Promise that resolves to Event object
23
+ * @returns {Promise<Event>}
24
24
  */
25
25
  create (chartKey, eventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null) {
26
26
  const requestParameters = {}
@@ -45,7 +45,7 @@ class Events {
45
45
 
46
46
  /**
47
47
  * @param {string} eventKey
48
- * @returns {Promise<Event>} Promise that resolves to Event object
48
+ * @returns {Promise<Event>}
49
49
  */
50
50
  retrieve (eventKey) {
51
51
  return this.client.get(`/events/${encodeURIComponent(eventKey)}`)
@@ -233,12 +233,32 @@ class Events {
233
233
 
234
234
  /**
235
235
  * @param {string} eventKey
236
- * @param {string} obj
237
- * @returns {Promise<ObjectStatus>} Promise that resolves to ObjectStatus object
236
+ * @param {string} label
237
+ * @returns {Promise<EventObjectInfo>}
238
238
  */
239
- retrieveObjectStatus (eventKey, obj) {
240
- return this.client.get(`events/${encodeURIComponent(eventKey)}/objects/${encodeURIComponent(obj)}`)
241
- .then((res) => new ObjectStatus(res.data))
239
+ async retrieveObjectInfo (eventKey, label) {
240
+ const result = await this.retrieveObjectInfos(eventKey, [label])
241
+ return result[label]
242
+ }
243
+
244
+ /**
245
+ * @param {string} eventKey
246
+ * @param {string[]} labels
247
+ * @returns {Promise<Map<String, EventObjectInfo>>}
248
+ */
249
+ retrieveObjectInfos (eventKey, labels) {
250
+ const params = new URLSearchParams()
251
+ labels.forEach(label => {
252
+ params.append('label', label)
253
+ })
254
+ return this.client.get(`events/${encodeURIComponent(eventKey)}/objects`, { params })
255
+ .then((res) => {
256
+ const objectInfos = res.data
257
+ for (const key of Object.keys(objectInfos)) {
258
+ objectInfos[key] = new EventObjectInfo(objectInfos[key])
259
+ }
260
+ return objectInfos
261
+ })
242
262
  }
243
263
 
244
264
  /**
@@ -251,13 +271,15 @@ class Events {
251
271
  * @param {?boolean} ignoreChannels
252
272
  * @param {?string[]} channelKeys
253
273
  * @param {?boolean} ignoreSocialDistancing
254
- * @returns {Promise<ChangeObjectStatusResult>} Promise that resolves to ChangeObjectStatusResult object
274
+ * @returns {Promise<ChangeObjectStatusResult>}
275
+ * @param {?string[]} allowedPreviousStatuses
276
+ * @param {?string[]} rejectedPreviousStatuses
255
277
  */
256
- changeObjectStatus (eventKeyOrKeys, objectOrObjects, status, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
257
- const request = this.changeObjectStatusRequest(objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
278
+ changeObjectStatus (eventKeyOrKeys, objectOrObjects, status, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null, allowedPreviousStatuses = null, rejectedPreviousStatuses = null) {
279
+ const request = this.changeObjectStatusRequest(objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, rejectedPreviousStatuses)
258
280
  request.events = Array.isArray(eventKeyOrKeys) ? eventKeyOrKeys : [eventKeyOrKeys]
259
281
 
260
- return this.client.post('/seasons/actions/change-object-status?expand=objects', request)
282
+ return this.client.post('/events/groups/actions/change-object-status?expand=objects', request)
261
283
  .then((res) => new ChangeObjectStatusResult(res.data.objects))
262
284
  }
263
285
 
@@ -267,7 +289,18 @@ class Events {
267
289
  */
268
290
  changeObjectStatusInBatch (statusChangeRequests) {
269
291
  const requests = statusChangeRequests.map(r => {
270
- const json = this.changeObjectStatusRequest(r.objectOrObjects, r.status, r.holdToken, r.orderId, r.keepExtraData, r.ignoreChannels, r.channelKeys)
292
+ const json = this.changeObjectStatusRequest(
293
+ r.objectOrObjects,
294
+ r.status,
295
+ r.holdToken,
296
+ r.orderId,
297
+ r.keepExtraData,
298
+ r.ignoreChannels,
299
+ r.channelKeys,
300
+ null,
301
+ r.allowedPreviousStatuses,
302
+ r.rejectedPreviousStatuses
303
+ )
271
304
  json.event = r.eventKey
272
305
  return json
273
306
  })
@@ -277,7 +310,7 @@ class Events {
277
310
  .then((res) => res.data.results.map(r => new ChangeObjectStatusResult(r.objects)))
278
311
  }
279
312
 
280
- changeObjectStatusRequest (objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing) {
313
+ changeObjectStatusRequest (objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing, allowedPreviousStatuses, rejectedPreviousStatuses) {
281
314
  const request = {}
282
315
  request.objects = this.normalizeObjects(objectOrObjects)
283
316
  request.status = status
@@ -299,6 +332,12 @@ class Events {
299
332
  if (ignoreSocialDistancing !== null) {
300
333
  request.ignoreSocialDistancing = ignoreSocialDistancing
301
334
  }
335
+ if (allowedPreviousStatuses !== null) {
336
+ request.allowedPreviousStatuses = allowedPreviousStatuses
337
+ }
338
+ if (rejectedPreviousStatuses !== null) {
339
+ request.rejectedPreviousStatuses = rejectedPreviousStatuses
340
+ }
302
341
  return request
303
342
  }
304
343
 
@@ -311,10 +350,10 @@ class Events {
311
350
  * @param {?boolean} ignoreChannels
312
351
  * @param {?string[]} channelKeys
313
352
  * @param {?boolean} ignoreSocialDistancing
314
- * @returns {Promise<ChangeObjectStatusResult>} Promise that resolves to ChangeObjectStatusResult object
353
+ * @returns {Promise<ChangeObjectStatusResult>}
315
354
  */
316
355
  book (eventKeyOrKeys, objectOrObjects, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
317
- return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, ObjectStatus.BOOKED, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
356
+ return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.BOOKED, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
318
357
  }
319
358
 
320
359
  /**
@@ -328,10 +367,10 @@ class Events {
328
367
  * @param {?boolean} keepExtraData
329
368
  * @param {?boolean} ignoreChannels
330
369
  * @param {?string[]} channelKeys
331
- * @returns {Promise<BestAvailableObjects>} Promise that resolves to BestAvailableObjects object
370
+ * @returns {Promise<BestAvailableObjects>}
332
371
  */
333
372
  bookBestAvailable (eventKey, number, categories = null, holdToken = null, extraData = null, ticketTypes = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
334
- return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, ObjectStatus.BOOKED, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
373
+ return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, EventObjectInfo.BOOKED, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
335
374
  }
336
375
 
337
376
  /**
@@ -342,10 +381,10 @@ class Events {
342
381
  * @param {?boolean} keepExtraData
343
382
  * @param {?boolean} ignoreChannels
344
383
  * @param {?string[]} channelKeys
345
- * @returns {Promise<ChangeObjectStatusResult>} Promise that resolves to ChangeObjectStatusResult object
384
+ * @returns {Promise<ChangeObjectStatusResult>}
346
385
  */
347
386
  release (eventKeyOrKeys, objectOrObjects, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
348
- return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, ObjectStatus.FREE, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys)
387
+ return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.FREE, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys)
349
388
  }
350
389
 
351
390
  /**
@@ -357,10 +396,10 @@ class Events {
357
396
  * @param {?boolean} ignoreChannels
358
397
  * @param {?string[]} channelKeys
359
398
  * @param {?boolean} ignoreSocialDistancing
360
- * @returns {Promise<ChangeObjectStatusResult>} Promise that resolves to ChangeObjectStatusResult object
399
+ * @returns {Promise<ChangeObjectStatusResult>}
361
400
  */
362
401
  hold (eventKeyOrKeys, objectOrObjects, holdToken, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
363
- return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, ObjectStatus.HELD, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
402
+ return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.HELD, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
364
403
  }
365
404
 
366
405
  /**
@@ -375,10 +414,10 @@ class Events {
375
414
  * @param {?boolean} ignoreChannels
376
415
  * @param {?string[]} channelKeys
377
416
  * @param {?string[]} ticketTypes
378
- * @returns {Promise<BestAvailableObjects>} Promise that resolves to BestAvailableObjects object
417
+ * @returns {Promise<BestAvailableObjects>}
379
418
  */
380
419
  holdBestAvailable (eventKey, number, holdToken, categories = null, extraData = null, ticketTypes = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
381
- return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, ObjectStatus.HELD, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
420
+ return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, EventObjectInfo.HELD, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
382
421
  }
383
422
 
384
423
  /**
@@ -393,7 +432,7 @@ class Events {
393
432
  * @param {?boolean} keepExtraData
394
433
  * @param {?boolean} ignoreChannels
395
434
  * @param {?string[]} channelKeys
396
- * @returns {Promise<BestAvailableObjects>} Promise that resolves to BestAvailableObjects object
435
+ * @returns {Promise<BestAvailableObjects>}
397
436
  */
398
437
  changeBestAvailableObjectStatus (eventKey, number, status, categories = null, holdToken = null, extraData = null, ticketTypes = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
399
438
  const requestParameters = {}
@@ -8,8 +8,10 @@ class StatusChangeRequest {
8
8
  * @param {?boolean} keepExtraData
9
9
  * @param {?boolean} ignoreChannels
10
10
  * @param {?string[]} channelKeys
11
+ * @param {?string[]} allowedPreviousStatuses
12
+ * @param {?string[]} rejectedPreviousStatuses
11
13
  */
12
- constructor (eventKey, objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys) {
14
+ constructor (eventKey, objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, allowedPreviousStatuses, rejectedPreviousStatuses) {
13
15
  this.eventKey = eventKey
14
16
  this.objectOrObjects = objectOrObjects
15
17
  this.status = status
@@ -18,6 +20,8 @@ class StatusChangeRequest {
18
20
  this.keepExtraData = keepExtraData
19
21
  this.ignoreChannels = ignoreChannels
20
22
  this.channelKeys = channelKeys
23
+ this.allowedPreviousStatuses = allowedPreviousStatuses
24
+ this.rejectedPreviousStatuses = rejectedPreviousStatuses
21
25
  }
22
26
  }
23
27
 
@@ -13,7 +13,7 @@ class ChartReports {
13
13
  /**
14
14
  * @param {string} chartKey
15
15
  * @param {string} bookWholeTables
16
- * @returns {Object.<string, ChartReportItem[]>}
16
+ * @returns {Object.<string, ChartObjectInfo[]>}
17
17
  */
18
18
  byLabel (chartKey, bookWholeTables = undefined) {
19
19
  return this.fetchReport('byLabel', chartKey, bookWholeTables)
@@ -22,7 +22,7 @@ class ChartReports {
22
22
  /**
23
23
  * @param {string} chartKey
24
24
  * @param {string} bookWholeTables
25
- * @returns {Object.<string, ChartReportItem[]>}
25
+ * @returns {Object.<string, ChartObjectInfo[]>}
26
26
  */
27
27
  byObjectType (chartKey, bookWholeTables = undefined) {
28
28
  return this.fetchReport('byObjectType', chartKey, bookWholeTables)
@@ -31,7 +31,7 @@ class ChartReports {
31
31
  /**
32
32
  * @param {string} chartKey
33
33
  * @param {string} bookWholeTables
34
- * @returns {Object.<string, ChartReportItem[]>}
34
+ * @returns {Object.<string, ChartObjectInfo[]>}
35
35
  */
36
36
  byCategoryLabel (chartKey, bookWholeTables = undefined) {
37
37
  return this.fetchReport('byCategoryLabel', chartKey, bookWholeTables)
@@ -40,7 +40,7 @@ class ChartReports {
40
40
  /**
41
41
  * @param {string} chartKey
42
42
  * @param {string} bookWholeTables
43
- * @returns {Object.<string, ChartReportItem[]>}
43
+ * @returns {Object.<string, ChartObjectInfo[]>}
44
44
  */
45
45
  byCategoryKey (chartKey, bookWholeTables = undefined) {
46
46
  return this.fetchReport('byCategoryKey', chartKey, bookWholeTables)