seatsio 63.5.0 → 65.0.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/.github/dependabot.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.github/workflows/release.yml +39 -0
- package/README.md +49 -5
- package/package.json +8 -8
- package/releasing.md +6 -0
- package/src/Accounts/Accounts.js +4 -4
- package/src/Charts/ChartListParams.js +14 -2
- package/src/{Reports/ChartReportItem.js → Charts/ChartObjectInfo.js} +4 -2
- package/src/Charts/Charts.js +11 -11
- package/src/Common/IDs.js +11 -0
- package/src/Events/ChangeObjectStatusResult.js +1 -1
- package/src/{Reports/EventReportItem.js → Events/EventObjectInfo.js} +9 -2
- package/src/Events/Events.js +41 -21
- package/src/Reports/ChartReports.js +4 -4
- package/src/Reports/EventReports.js +15 -15
- package/src/SeatsioClient.js +8 -3
- package/src/errorInterceptor.js +1 -2
- package/src/utilities/reportUtility.js +7 -7
- package/tests/chartReports/chartReport.test.js +2 -0
- package/tests/charts/listAllCharts.test.js +30 -8
- package/tests/eventReports/eventReport.test.js +15 -13
- package/tests/eventReports/eventReportDeepSummary.test.js +5 -5
- package/tests/eventReports/eventReportSummary.test.js +21 -4
- package/tests/events/bookObject.test.js +26 -24
- package/tests/events/changeBestAvailableObjectStatus.test.js +24 -24
- package/tests/events/changeObjectStatus.test.js +24 -23
- package/tests/events/changeObjectStatusForMultipleEvents.test.js +17 -17
- package/tests/events/changeObjectStatusForMultipleObjects.test.js +31 -31
- package/tests/events/changeObjectStatusInBatch.test.js +2 -2
- package/tests/events/holdObjects.test.js +13 -13
- package/tests/events/listAllStatusChanges.test.js +2 -3
- package/tests/events/releaseObjects.test.js +16 -16
- package/tests/events/retrieveEventObjectInfo.test.js +16 -0
- package/tests/events/retrieveEventObjectInfos.test.js +30 -0
- package/tests/events/updateExtraData.test.js +2 -2
- package/tests/events/updateExtraDatas.test.js +4 -4
- package/tests/exponentialBackoff.test.js +19 -6
- package/src/Events/ObjectStatus.js +0 -20
- package/tests/events/retrieveObjectStatus.test.js +0 -16
package/.github/dependabot.yml
CHANGED
|
@@ -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
|
|
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.
|
|
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": "
|
|
3
|
+
"version": "65.0.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.
|
|
17
|
+
"axios": "0.24.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"browserify": "latest",
|
|
21
|
-
"eslint": "7.
|
|
22
|
-
"eslint-config-standard": "
|
|
23
|
-
"eslint-plugin-import": "2.
|
|
21
|
+
"eslint": "7.32.0",
|
|
22
|
+
"eslint-config-standard": "16.0.3",
|
|
23
|
+
"eslint-plugin-import": "2.25.3",
|
|
24
24
|
"eslint-plugin-node": "11.1.0",
|
|
25
|
-
"eslint-plugin-promise": "5.
|
|
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": "
|
|
34
|
-
"jest-cli": "
|
|
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
|
package/src/Accounts/Accounts.js
CHANGED
|
@@ -8,28 +8,28 @@ class Accounts {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @returns {Promise<Account>}
|
|
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>}
|
|
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>}
|
|
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}
|
|
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,12 +1,14 @@
|
|
|
1
1
|
const helperFunctions = require('../utilities/helperFunctions.js')
|
|
2
|
+
const { IDs } = require('../Common/IDs')
|
|
2
3
|
|
|
3
|
-
class
|
|
4
|
+
class ChartObjectInfo {
|
|
4
5
|
/**
|
|
5
6
|
* @param {object} chartReport
|
|
6
7
|
*/
|
|
7
8
|
constructor (chartReport) {
|
|
8
9
|
this.label = chartReport.label
|
|
9
10
|
this.labels = helperFunctions.labelCreator(chartReport)
|
|
11
|
+
this.ids = new IDs(chartReport.ids.own, chartReport.ids.parent, chartReport.ids.section)
|
|
10
12
|
this.categoryLabel = chartReport.categoryLabel
|
|
11
13
|
this.categoryKey = chartReport.categoryKey
|
|
12
14
|
this.entrance = chartReport.entrance
|
|
@@ -20,4 +22,4 @@ class ChartReportItem {
|
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
module.exports =
|
|
25
|
+
module.exports = ChartObjectInfo
|
package/src/Charts/Charts.js
CHANGED
|
@@ -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>}
|
|
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>}
|
|
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>}
|
|
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}
|
|
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}
|
|
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>}
|
|
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>}
|
|
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>}
|
|
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>}
|
|
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}
|
|
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}
|
|
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, {
|
|
5
|
+
* @param {Object.<string, {ObjectInfo}>} objects
|
|
6
6
|
*/
|
|
7
7
|
constructor (objects) {
|
|
8
8
|
this.objects = utilities.createChangeObjectStatusDetails(objects)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
const helperFunctions = require('../utilities/helperFunctions.js')
|
|
2
|
+
const { IDs } = require('../Common/IDs')
|
|
2
3
|
|
|
3
|
-
class
|
|
4
|
+
class EventObjectInfo {
|
|
4
5
|
/**
|
|
5
6
|
* @param {object} report
|
|
6
7
|
*/
|
|
7
8
|
constructor (report) {
|
|
8
9
|
this.label = report.label
|
|
9
10
|
this.labels = helperFunctions.labelCreator(report)
|
|
11
|
+
this.ids = new IDs(report.ids.own, report.ids.parent, report.ids.section)
|
|
10
12
|
this.status = report.status
|
|
11
13
|
this.categoryLabel = report.categoryLabel
|
|
12
14
|
this.categoryKey = report.categoryKey
|
|
@@ -33,7 +35,12 @@ class EventReportItem {
|
|
|
33
35
|
this.isDisabledBySocialDistancing = report.isDisabledBySocialDistancing
|
|
34
36
|
this.channel = report.channel
|
|
35
37
|
this.distanceToFocalPoint = report.distanceToFocalPoint
|
|
38
|
+
this.holds = report.holds
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
EventObjectInfo.FREE = 'free'
|
|
43
|
+
EventObjectInfo.BOOKED = 'booked'
|
|
44
|
+
EventObjectInfo.HELD = 'reservedByToken'
|
|
45
|
+
|
|
46
|
+
module.exports = EventObjectInfo
|
package/src/Events/Events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const Page = require('../Page.js')
|
|
2
2
|
const Lister = require('../Lister.js')
|
|
3
|
-
const
|
|
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>}
|
|
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>}
|
|
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}
|
|
237
|
-
* @returns {Promise<
|
|
236
|
+
* @param {string} label
|
|
237
|
+
* @returns {Promise<EventObjectInfo>}
|
|
238
238
|
*/
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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,13 @@ class Events {
|
|
|
251
271
|
* @param {?boolean} ignoreChannels
|
|
252
272
|
* @param {?string[]} channelKeys
|
|
253
273
|
* @param {?boolean} ignoreSocialDistancing
|
|
254
|
-
* @returns {Promise<ChangeObjectStatusResult>}
|
|
274
|
+
* @returns {Promise<ChangeObjectStatusResult>}
|
|
255
275
|
*/
|
|
256
276
|
changeObjectStatus (eventKeyOrKeys, objectOrObjects, status, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
|
|
257
277
|
const request = this.changeObjectStatusRequest(objectOrObjects, status, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
|
|
258
278
|
request.events = Array.isArray(eventKeyOrKeys) ? eventKeyOrKeys : [eventKeyOrKeys]
|
|
259
279
|
|
|
260
|
-
return this.client.post('/
|
|
280
|
+
return this.client.post('/events/groups/actions/change-object-status?expand=objects', request)
|
|
261
281
|
.then((res) => new ChangeObjectStatusResult(res.data.objects))
|
|
262
282
|
}
|
|
263
283
|
|
|
@@ -311,10 +331,10 @@ class Events {
|
|
|
311
331
|
* @param {?boolean} ignoreChannels
|
|
312
332
|
* @param {?string[]} channelKeys
|
|
313
333
|
* @param {?boolean} ignoreSocialDistancing
|
|
314
|
-
* @returns {Promise<ChangeObjectStatusResult>}
|
|
334
|
+
* @returns {Promise<ChangeObjectStatusResult>}
|
|
315
335
|
*/
|
|
316
336
|
book (eventKeyOrKeys, objectOrObjects, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
|
|
317
|
-
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects,
|
|
337
|
+
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.BOOKED, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
/**
|
|
@@ -328,10 +348,10 @@ class Events {
|
|
|
328
348
|
* @param {?boolean} keepExtraData
|
|
329
349
|
* @param {?boolean} ignoreChannels
|
|
330
350
|
* @param {?string[]} channelKeys
|
|
331
|
-
* @returns {Promise<BestAvailableObjects>}
|
|
351
|
+
* @returns {Promise<BestAvailableObjects>}
|
|
332
352
|
*/
|
|
333
353
|
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,
|
|
354
|
+
return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, EventObjectInfo.BOOKED, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
|
|
335
355
|
}
|
|
336
356
|
|
|
337
357
|
/**
|
|
@@ -342,10 +362,10 @@ class Events {
|
|
|
342
362
|
* @param {?boolean} keepExtraData
|
|
343
363
|
* @param {?boolean} ignoreChannels
|
|
344
364
|
* @param {?string[]} channelKeys
|
|
345
|
-
* @returns {Promise<ChangeObjectStatusResult>}
|
|
365
|
+
* @returns {Promise<ChangeObjectStatusResult>}
|
|
346
366
|
*/
|
|
347
367
|
release (eventKeyOrKeys, objectOrObjects, holdToken = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
|
|
348
|
-
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects,
|
|
368
|
+
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.FREE, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys)
|
|
349
369
|
}
|
|
350
370
|
|
|
351
371
|
/**
|
|
@@ -357,10 +377,10 @@ class Events {
|
|
|
357
377
|
* @param {?boolean} ignoreChannels
|
|
358
378
|
* @param {?string[]} channelKeys
|
|
359
379
|
* @param {?boolean} ignoreSocialDistancing
|
|
360
|
-
* @returns {Promise<ChangeObjectStatusResult>}
|
|
380
|
+
* @returns {Promise<ChangeObjectStatusResult>}
|
|
361
381
|
*/
|
|
362
382
|
hold (eventKeyOrKeys, objectOrObjects, holdToken, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null, ignoreSocialDistancing = null) {
|
|
363
|
-
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects,
|
|
383
|
+
return this.changeObjectStatus(eventKeyOrKeys, objectOrObjects, EventObjectInfo.HELD, holdToken, orderId, keepExtraData, ignoreChannels, channelKeys, ignoreSocialDistancing)
|
|
364
384
|
}
|
|
365
385
|
|
|
366
386
|
/**
|
|
@@ -375,10 +395,10 @@ class Events {
|
|
|
375
395
|
* @param {?boolean} ignoreChannels
|
|
376
396
|
* @param {?string[]} channelKeys
|
|
377
397
|
* @param {?string[]} ticketTypes
|
|
378
|
-
* @returns {Promise<BestAvailableObjects>}
|
|
398
|
+
* @returns {Promise<BestAvailableObjects>}
|
|
379
399
|
*/
|
|
380
400
|
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,
|
|
401
|
+
return this.changeBestAvailableObjectStatus(encodeURIComponent(eventKey), number, EventObjectInfo.HELD, categories, holdToken, extraData, ticketTypes, orderId, keepExtraData, ignoreChannels, channelKeys)
|
|
382
402
|
}
|
|
383
403
|
|
|
384
404
|
/**
|
|
@@ -393,7 +413,7 @@ class Events {
|
|
|
393
413
|
* @param {?boolean} keepExtraData
|
|
394
414
|
* @param {?boolean} ignoreChannels
|
|
395
415
|
* @param {?string[]} channelKeys
|
|
396
|
-
* @returns {Promise<BestAvailableObjects>}
|
|
416
|
+
* @returns {Promise<BestAvailableObjects>}
|
|
397
417
|
*/
|
|
398
418
|
changeBestAvailableObjectStatus (eventKey, number, status, categories = null, holdToken = null, extraData = null, ticketTypes = null, orderId = null, keepExtraData = null, ignoreChannels = null, channelKeys = null) {
|
|
399
419
|
const requestParameters = {}
|
|
@@ -13,7 +13,7 @@ class ChartReports {
|
|
|
13
13
|
/**
|
|
14
14
|
* @param {string} chartKey
|
|
15
15
|
* @param {string} bookWholeTables
|
|
16
|
-
* @returns {Object.<string,
|
|
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,
|
|
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,
|
|
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,
|
|
43
|
+
* @returns {Object.<string, ChartObjectInfo[]>}
|
|
44
44
|
*/
|
|
45
45
|
byCategoryKey (chartKey, bookWholeTables = undefined) {
|
|
46
46
|
return this.fetchReport('byCategoryKey', chartKey, bookWholeTables)
|