@dpgradio/creative 5.5.1 → 5.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpgradio/creative",
3
- "version": "5.5.1",
3
+ "version": "5.6.1",
4
4
  "description": "Support package for standalone Javascript applications",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/api/api.js CHANGED
@@ -8,6 +8,8 @@ import Ratings from './endpoints/Ratings.js'
8
8
  import ForbiddenWord from './endpoints/ForbiddenWord.js'
9
9
  import TrackLists from './endpoints/TrackLists.js'
10
10
  import Requests from './endpoints/Requests.js'
11
+ import Lists from './endpoints/Lists.js'
12
+ import Programs from './endpoints/Programs.js'
11
13
 
12
14
  const GLOBAL_API_URL = 'https://api.radio.dpgmedia.cloud'
13
15
 
@@ -33,6 +35,8 @@ export class Api {
33
35
  this.forbiddenWord = new ForbiddenWord(this)
34
36
  this.trackLists = new TrackLists(this)
35
37
  this.requests = new Requests(this)
38
+ this.lists = new Lists(this)
39
+ this.programs = new Programs(this)
36
40
  }
37
41
 
38
42
  get baseUrl() {
@@ -0,0 +1,7 @@
1
+ import Endpoint from './Endpoint.js'
2
+
3
+ export default class Lists extends Endpoint {
4
+ async all() {
5
+ return await this.requestData((r) => r.get(`/lists`), 'lists')
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ import Endpoint from './Endpoint.js'
2
+
3
+ export default class Programs extends Endpoint {
4
+ async all() {
5
+ return await this.requestData((r) => r.get(`/programs`), 'programs')
6
+ }
7
+ }
@@ -96,7 +96,10 @@ export default class Request {
96
96
 
97
97
  const endpointWithoutSlash = endpoint.replace(/^\/+/, '')
98
98
 
99
- const urlParts = [baseUrlWithProtocol, this.version, endpointWithoutSlash].filter(Boolean)
99
+ const urlParts =
100
+ endpoint.startsWith('http')
101
+ ? [endpoint]
102
+ : [baseUrlWithProtocol, this.version, endpointWithoutSlash].filter(Boolean)
100
103
 
101
104
  return tap(new URL(urlParts.join('/')), (url) => {
102
105
  url.search = new URLSearchParams({