Skip to content

Commit cd843e6

Browse files
Merge pull request #48 from renderforest/implement-examples-for-supports-api
implement sounds resource API:
2 parents df11566 + 4706ff5 commit cd843e6

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

src/lib/resources/sounds.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* Copyright (c) 2018-present, Renderforest, LLC.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the
6+
* LICENSE file in the root directory.
7+
*/
8+
9+
const Http = require('../http/http')
10+
11+
const Params = require('../../util/params')
12+
13+
class Sounds {
14+
/**
15+
* @param {Object} payload
16+
* @returns {Promise.<Array>}
17+
* @description Get Company Sounds (limited).
18+
*/
19+
static getCompanySoundsLimited (payload) {
20+
const qs = Params.destructParams(payload, ['duration'])
21+
22+
const options = {
23+
endpoint: `${Sounds.API_PREFIX}/sounds`,
24+
qs
25+
}
26+
return Http.unauthorizedRequest(options)
27+
}
28+
29+
/**
30+
* @param {Object} payload
31+
* @returns {Promise.<Array>}
32+
* @description Get Sounds.
33+
*/
34+
static getSounds (payload) {
35+
const qs = Params.destructParams(payload, ['duration'])
36+
37+
const options = {
38+
endpoint: `${Sounds.API_PREFIX}/sounds`,
39+
qs
40+
}
41+
return Http.authorizedRequest(options)
42+
}
43+
44+
/**
45+
* @param {Object} payload
46+
* @returns {Promise.<Array>}
47+
* @description Get Recommended Sounds (limited).
48+
*/
49+
static getRecommendedSoundsLimited (payload) {
50+
const qs = Params.destructParams(payload, ['duration', 'templateId'])
51+
52+
const options = {
53+
endpoint: `${Sounds.API_PREFIX}/sounds/recommended`,
54+
qs
55+
}
56+
return Http.unauthorizedRequest(options)
57+
}
58+
59+
/**
60+
* @param {Object} payload
61+
* @returns {Promise.<Array>}
62+
* @description Get Recommended Sounds.
63+
*/
64+
static getRecommendedSounds (payload) {
65+
const qs = Params.destructParams(payload, ['duration', 'templateId'])
66+
67+
const options = {
68+
endpoint: `${Sounds.API_PREFIX}/sounds/recommended`,
69+
qs
70+
}
71+
return Http.authorizedRequest(options)
72+
}
73+
}
74+
75+
Sounds.API_PREFIX = '/api/v1'
76+
77+
module.exports = Sounds

0 commit comments

Comments
 (0)