@dpgradio/creative 5.4.0 → 5.5.1

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.
@@ -1,10 +1,9 @@
1
1
  import api from '../src/api/api.js'
2
2
  import configuration from '../src/config/config.js'
3
3
 
4
- const appId = 'greety'
5
4
  const stationId = 'qmusic_be'
6
5
 
7
- await configuration.retrieveConfig(appId, stationId)
6
+ await configuration.retrieveConfigForStation(stationId)
8
7
 
9
8
  const channels = await api.channels.all()
10
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpgradio/creative",
3
- "version": "5.4.0",
3
+ "version": "5.5.1",
4
4
  "description": "Support package for standalone Javascript applications",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -8,6 +8,9 @@ export default class PaginatedResponse {
8
8
  }
9
9
 
10
10
  async fetchNext() {
11
+ if (!this.pagination.next) {
12
+ return []
13
+ }
11
14
  const response = await api.onVersion(null).request().get(this.pagination.next)
12
15
  this.pagination.next = response.pagination.next
13
16
  this.data = [...this.data, ...response[this.dataKey]]
@@ -16,6 +19,9 @@ export default class PaginatedResponse {
16
19
  }
17
20
 
18
21
  async fetchPrevious() {
22
+ if (!this.pagination.previous) {
23
+ return []
24
+ }
19
25
  const response = await api.onVersion(null).request().get(this.pagination.previous)
20
26
  this.pagination.previous = response.pagination.previous
21
27
  this.data = [...response[this.dataKey], ...this.data]
@@ -4,4 +4,8 @@ export default class Requests extends Endpoint {
4
4
  async requestTrack(eventSlug, request) {
5
5
  return await this.api.request().post(`/requests/${eventSlug}`, request)
6
6
  }
7
+
8
+ async requestsForTrack(eventSlug, selectorCode) {
9
+ return await this.requestData((r) => r.get(`/requests/${eventSlug}/track/${selectorCode}`), 'requests')
10
+ }
7
11
  }