@dpgradio/creative 5.3.6 → 5.4.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.
@@ -14,16 +14,8 @@ jobs:
14
14
  # Defaults to the user or organization that owns the workflow file
15
15
  scope: '@octocat'
16
16
  cache: yarn
17
- - name: Git configuration
18
- run: |
19
- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
20
- git config --global user.name "GitHub Actions"
21
17
  - run: yarn
22
18
  - run: yarn publish --new-version ${{ github.event.release.tag_name }}
23
19
  env:
24
20
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25
- - name: Push changes to repository
26
- env:
27
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
- run: |
29
- git push origin
21
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpgradio/creative",
3
- "version": "5.3.6",
3
+ "version": "5.4.0",
4
4
  "description": "Support package for standalone Javascript applications",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import api from './api'
1
+ import api from './api.js'
2
2
 
3
3
  export default class PaginatedResponse {
4
4
  constructor(response, dataKey = 'data') {
package/src/api/api.js CHANGED
@@ -6,6 +6,8 @@ import Config from './endpoints/Config.js'
6
6
  import Members from './endpoints/Members.js'
7
7
  import Ratings from './endpoints/Ratings.js'
8
8
  import ForbiddenWord from './endpoints/ForbiddenWord.js'
9
+ import TrackLists from './endpoints/TrackLists.js'
10
+ import Requests from './endpoints/Requests.js'
9
11
 
10
12
  const GLOBAL_API_URL = 'https://api.radio.dpgmedia.cloud'
11
13
 
@@ -29,6 +31,8 @@ export class Api {
29
31
  this.members = new Members(this)
30
32
  this.ratings = new Ratings(this)
31
33
  this.forbiddenWord = new ForbiddenWord(this)
34
+ this.trackLists = new TrackLists(this)
35
+ this.requests = new Requests(this)
32
36
  }
33
37
 
34
38
  get baseUrl() {
@@ -57,6 +57,6 @@ export default class Endpoint {
57
57
  }
58
58
 
59
59
  withoutNullValues(object) {
60
- return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== null))
60
+ return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== null && value !== undefined))
61
61
  }
62
62
  }
@@ -0,0 +1,7 @@
1
+ import Endpoint from './Endpoint.js'
2
+
3
+ export default class Requests extends Endpoint {
4
+ async requestTrack(eventSlug, request) {
5
+ return await this.api.request().post(`/requests/${eventSlug}`, request)
6
+ }
7
+ }
@@ -0,0 +1,41 @@
1
+ import Endpoint from './Endpoint.js'
2
+
3
+ /**
4
+ * These requests support a form of pagination but not using the default pagination approach.
5
+ * Therefore, pagination requires a manual implementation on the consuming side.
6
+ */
7
+ export default class TrackLists extends Endpoint {
8
+ async tracks(trackListId, { trackCodeIds, all, order, seed, page, limit } = {}) {
9
+ const parameters = {
10
+ track_code_ids: trackCodeIds,
11
+ all,
12
+ order,
13
+ seed,
14
+ page,
15
+ limit,
16
+ }
17
+
18
+ return await this.requestData(
19
+ (r) => r.get(`/track_lists/${trackListId}`, this.withoutNullValues(parameters)),
20
+ 'tracks'
21
+ )
22
+ }
23
+
24
+ async search(trackListId, query, { order, seed, page, limit } = {}) {
25
+ const parameters = { query, order, seed, page, limit }
26
+
27
+ return await this.requestData(
28
+ (r) => r.get(`/track_lists/${trackListId}/search`, this.withoutNullValues(parameters)),
29
+ 'tracks'
30
+ )
31
+ }
32
+
33
+ async byLetter(trackListId, letter, { order, seed, page, limit } = {}) {
34
+ const parameters = { order, seed, page, limit }
35
+
36
+ return await this.requestData(
37
+ (r) => r.get(`/track_lists/${trackListId}/by_letter/${letter}`, this.withoutNullValues(parameters)),
38
+ 'tracks'
39
+ )
40
+ }
41
+ }