@dpgradio/creative 5.0.0 → 5.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpgradio/creative",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Support package for standalone Javascript applications",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/api/api.js CHANGED
@@ -4,6 +4,7 @@ import tap from '../utils/tap.js'
4
4
  import Channels from './endpoints/Channels.js'
5
5
  import Config from './endpoints/Config.js'
6
6
  import Members from './endpoints/Members.js'
7
+ import Ratings from './endpoints/Ratings.js'
7
8
 
8
9
  const GLOBAL_API_URL = 'https://api.radio.dpgmedia.cloud'
9
10
 
@@ -20,10 +21,11 @@ export class Api {
20
21
  this.channels = new Channels(this)
21
22
  this.config = new Config(this)
22
23
  this.members = new Members(this)
24
+ this.ratings = new Ratings(this)
23
25
  }
24
26
 
25
27
  get baseUrl() {
26
- return this.baseUrlOverride || config('apiBaseUrl')
28
+ return this.baseUrlOverride || config('api_base_url')
27
29
  }
28
30
 
29
31
  request() {
@@ -0,0 +1,15 @@
1
+ import Endpoint from './Endpoint.js'
2
+
3
+ export default class Ratings extends Endpoint {
4
+ async allForMember() {
5
+ return await this.requestData((r) => r.get('/members/me/ratings'), 'ratings')
6
+ }
7
+
8
+ async like(selectorCode) {
9
+ await this.api.request().post(`/tracks/${selectorCode}/ratings`, { rating: 1 })
10
+ }
11
+
12
+ async unlike(selectorCode) {
13
+ await this.api.request().delete(`/tracks/${selectorCode}/ratings`)
14
+ }
15
+ }