@dpgradio/creative 5.3.6 → 5.5.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/workflows/publish.yml +1 -9
- package/examples/useApi.js +1 -2
- package/package.json +1 -1
- package/src/api/PaginatedResponse.js +1 -1
- package/src/api/api.js +4 -0
- package/src/api/endpoints/Endpoint.js +1 -1
- package/src/api/endpoints/Requests.js +11 -0
- package/src/api/endpoints/TrackLists.js +41 -0
|
@@ -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
|
-
|
|
26
|
-
env:
|
|
27
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
-
run: |
|
|
29
|
-
git push origin
|
|
21
|
+
|
package/examples/useApi.js
CHANGED
|
@@ -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.
|
|
6
|
+
await configuration.retrieveConfigForStation(stationId)
|
|
8
7
|
|
|
9
8
|
const channels = await api.channels.all()
|
|
10
9
|
|
package/package.json
CHANGED
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,11 @@
|
|
|
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
|
+
|
|
8
|
+
async requestsForTrack(eventSlug, selectorCode) {
|
|
9
|
+
return await this.requestData((r) => r.get(`/requests/${eventSlug}/track/${selectorCode}`), 'requests')
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -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
|
+
}
|