Skip to content

Commit 4ee3b8f

Browse files
Merge pull request #119 from renderforest/stage
release 0.3.0
2 parents 52fe972 + 4ff8011 commit 4ee3b8f

File tree

7 files changed

+78
-63
lines changed

7 files changed

+78
-63
lines changed

README.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ Welcome to the Renderforest API! You can use our API to:
3333
- [Get title](#get-title)
3434
- [Get mute music](#get-mute-music)
3535
- [Get sounds](#get-sounds)
36-
- [Get theme](#get-theme)
36+
- [Get styles](#get-styles)
37+
- [Get voice-over](#get-voice-over)
3738
- [Get project colors](#get-project-colors)
3839
- [Get screens](#get-screens)
3940
- [Get screen areas](#get-screen-areas)
4041
- [Get patch object](#get-patch-object)
4142
* [Setters](#setters)
42-
- [Set theme](#set-theme)
43+
- [Set styles](#set-styles)
44+
- [Set voice-over](#set-voice-over)
4345
- [Set mute music](#set-mute-music)
4446
- [Set sounds](#set-sounds)
4547
- [Set text on text holder area](#set-text-on-text-holder-area)
@@ -278,7 +280,8 @@ renderforest.getProjectData(payload)
278280
console.log('Title:', projectDataInstance.getTitle())
279281
console.log('Mute music:', projectDataInstance.getMuteMusic())
280282
console.log('Sounds:', projectDataInstance.getSounds())
281-
console.log('Theme:', projectDataInstance.getTheme())
283+
console.log('Styles:', projectDataInstance.getStyles())
284+
console.log('VoiceOver:', projectDataInstance.getVoiceOver())
282285
console.log('Project colors:', projectDataInstance.getProjectColors())
283286
console.log('Screens:', projectDataInstance.getScreens())
284287

@@ -385,9 +388,14 @@ projectDataInstance.getMuteMusic() // false
385388
projectDataInstance.getSounds() // Array of sound objects
386389
```
387390

388-
##### Get theme
391+
##### Get styles
389392
```js
390-
projectDataInstance.getTheme() // { themeVariableName: 'num', themeVariableValue: '2' }
393+
projectDataInstance.getStyles() // { theme: '1', transition: '2' }
394+
```
395+
396+
##### Get voice-over
397+
```js
398+
projectDataInstance.getVoiceOver() // { path: 'https://example.com/voice-over.mp3' }
391399
```
392400

393401
##### Get project colors
@@ -415,14 +423,22 @@ projectDataInstance.getPatchObject() // Object containing local updates. Used t
415423

416424
#### Setters
417425

418-
##### Set theme
426+
##### Set styles
427+
```js
428+
// get theme/transition from .templates API
429+
const styles = {
430+
theme: '1', // optional
431+
transition: '2' // optional
432+
}
433+
projectDataInstance.setStyles(styles)
434+
```
435+
436+
##### Set voice-over
419437
```js
420-
// get theme from .templates API
421-
const theme = {
422-
themeVariableName: 'num',
423-
themeVariableValue: '2'
438+
const voiceOver = {
439+
path: 'https://example.com/voice-ower.mp3' // optional
424440
}
425-
projectDataInstance.setTheme(theme)
441+
projectDataInstance.setVoiceOver(voiceOver)
426442
```
427443

428444
##### Set mute music
@@ -538,16 +554,7 @@ if (screens && screens[2]) {
538554
```js
539555
// get project colors from ./templates API
540556
const projectColors = [
541-
{ id: 0, hexCode: 'ffffff' },
542-
{ id: 1, hexCode: 'a1d4ec' },
543-
{ id: 2, hexCode: '1d2e54' },
544-
{ id: 3, hexCode: '61a371' },
545-
{ id: 4, hexCode: 'a0b6e7' },
546-
{ id: 5, hexCode: 'e0d0ef' },
547-
{ id: 6, hexCode: '5c1313' },
548-
{ id: 7, hexCode: 'b2e1f4' },
549-
{ id: 8, hexCode: '706bb5' },
550-
{ id: 9, hexCode: 'b4ddf5' }
557+
'ffffff', 'a1d4ec', '1d2e54', '61a371', 'a0b6e7', 'e0d0ef', '5c1313', 'b2e1f4', '706bb5', 'b4ddf5'
551558
]
552559
projectDataInstance.setProjectColors(projectColors)
553560
```

examples/project-data/get-project-data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ renderforest.getProjectData(payload)
2222
console.log('Title:', projectDataInstance.getTitle())
2323
console.log('Mute music:', projectDataInstance.getMuteMusic())
2424
console.log('Sounds:', projectDataInstance.getSounds())
25-
console.log('Theme:', projectDataInstance.getTheme())
25+
console.log('Styles:', projectDataInstance.getStyles())
26+
console.log('VoiceOver:', projectDataInstance.getVoiceOver())
2627
console.log('Project colors:', projectDataInstance.getProjectColors())
2728
console.log('Screens:', projectDataInstance.getScreens())
2829

examples/project-data/update-project-data-partial-advanced.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ async function sample () {
2020
// make some change
2121
projectDataInstance.setMuteMusic(true)
2222

23-
const theme = {
24-
themeVariableName: 'num',
25-
themeVariableValue: '2'
23+
const styles = {
24+
theme: '1', // optional
25+
transition: '2' // optional
2626
}
27-
projectDataInstance.setTheme(theme) // get theme from ./templates API
27+
projectDataInstance.setStyles(styles) // get theme/transition from ./templates API
28+
29+
const voiceOver = {
30+
path: 'https://example.com/voice-ower.mp3' // optional
31+
}
32+
projectDataInstance.setVoiceOver(voiceOver)
2833

2934
// sound from ./sounds API
3035
const sound1 = {
@@ -115,17 +120,9 @@ async function sample () {
115120
}
116121

117122
const projectColors = [
118-
{ id: 0, hexCode: 'ffffff' },
119-
{ id: 1, hexCode: 'a1d4ec' },
120-
{ id: 2, hexCode: '1d2e54' },
121-
{ id: 3, hexCode: '61a371' },
122-
{ id: 4, hexCode: 'a0b6e7' },
123-
{ id: 5, hexCode: 'e0d0ef' },
124-
{ id: 6, hexCode: '5c1313' },
125-
{ id: 7, hexCode: 'b2e1f4' },
126-
{ id: 8, hexCode: '706bb5' },
127-
{ id: 9, hexCode: 'b4ddf5' }
123+
'ffffff', 'a1d4ec', '1d2e54', '61a371', 'a0b6e7', 'e0d0ef', '5c1313', 'b2e1f4', '706bb5', 'b4ddf5'
128124
]
125+
129126
projectDataInstance.setProjectColors(projectColors) // get project colors from ./templates API
130127

131128
const screen = {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@renderforest/sdk-node",
33
"description": "Renderforest SDK for Node.js",
4-
"version": "0.2.1",
4+
"version": "0.3.0",
55
"author": "RenderForest LLC",
66
"bugs": {
77
"url": "https://github.com/renderforest/renderforest-sdk-node/issues"

src/classes/project-data.js

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,30 +111,6 @@ class ProjectData {
111111
this.patchProperties.push('projectColors')
112112
}
113113

114-
/**
115-
* @returns {Object}
116-
* @description Get the project theme.
117-
*/
118-
getTheme () {
119-
return {
120-
themeVariableName: this.projectDataJson.data['themeVariableName'],
121-
themeVariableValue: this.projectDataJson.data['themeVariableValue']
122-
}
123-
}
124-
125-
/**
126-
* @param {Object} payload
127-
* @param {string} payload.themeVariableName
128-
* @param {string} payload.themeVariableValue
129-
* @description Set the project theme.
130-
*/
131-
setTheme (payload) {
132-
this.projectDataJson.data['themeVariableName'] = payload.themeVariableName
133-
this.projectDataJson.data['themeVariableValue'] = payload.themeVariableValue
134-
this.patchProperties.push('themeVariableName')
135-
this.patchProperties.push('themeVariableValue')
136-
}
137-
138114
/**
139115
* @returns {Array}
140116
* @description Get the project sounds.
@@ -152,6 +128,40 @@ class ProjectData {
152128
this.patchProperties.push('sounds')
153129
}
154130

131+
/**
132+
* @returns {Object}
133+
* @description Get the project styles.
134+
*/
135+
getStyles () {
136+
return this.projectDataJson.data['styles']
137+
}
138+
139+
/**
140+
* @param {Object} styles
141+
* @description Set the project styles.
142+
*/
143+
setStyles (styles) {
144+
this.projectDataJson.data['styles'] = styles
145+
this.patchProperties.push('styles')
146+
}
147+
148+
/**
149+
* @returns {Object}
150+
* @description Get the project voiceOver.
151+
*/
152+
getVoiceOver () {
153+
return this.projectDataJson.data['voiceOver']
154+
}
155+
156+
/**
157+
* @param {Object} voiceOver
158+
* @description Set the project voiceOver.
159+
*/
160+
setVoiceOver (voiceOver) {
161+
this.projectDataJson.data['voiceOver'] = voiceOver
162+
this.patchProperties.push('voiceOver')
163+
}
164+
155165
/**
156166
* @returns {string}
157167
* @description Get the project title.

src/lib/resources/project-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ class ProjectData {
4646
}
4747
}
4848

49-
ProjectData.API_PREFIX = '/api/v4'
49+
ProjectData.API_PREFIX = '/api/v5'
5050

5151
module.exports = ProjectData

0 commit comments

Comments
 (0)