Skip to content

Commit 3dae667

Browse files
Merge pull request #152 from renderforest/fix-optional-parameter-issue
fix-optional-parameter-issue
2 parents 29d39d5 + eacb3e4 commit 3dae667

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ renderforest.duplicateProject(payload)
267267

268268
### Render the Project
269269

270-
Renders the project.
270+
Renders the project with given quality. The possible values for the quality are: 0, 360, 720, and 1080.
271+
The watermark parameter is optional, must be in '.png' file format and have canvas size of 1920 x 1080 pixels,
272+
url length must not exceed 250 characters and is not applicable to HD quality videos.
273+
271274
```js
272275
const Renderforest = require('@renderforest/sdk-node')
273276

examples/projects/delete-project-videos.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Renderforest = require('../../src/lib/renderforest')
1111
const renderforest = new Renderforest({ signKey: '<signKey>', clientId: -1 })
1212

1313
const payload = {
14-
projectId: 5000658,
14+
projectId: 4120385,
1515
quality: 360 // optional argument
1616
}
1717
renderforest.deleteProjectVideos(payload)

examples/projects/render-project.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Renderforest = require('../../src/lib/renderforest')
1111
const renderforest = new Renderforest({ signKey: '<signKey>', clientId: -1 })
1212

1313
const payload = {
14-
projectId: 5000658,
14+
projectId: 4120385,
1515
quality: 360,
1616
watermark: 'https://example.com/watermark.png' // optional argument
1717
}

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"name": "@renderforest/sdk-node",
33
"description": "Renderforest SDK for Node.js",
4-
"version": "0.3.8",
4+
"version": "0.3.9",
55
"author": "RenderForest LLC",
66
"bugs": {
77
"url": "https://github.com/renderforest/renderforest-sdk-node/issues"
88
},
99
"contributors": [
10+
{
11+
"name": "Narek Hovhannisyan",
12+
"email": "narekgilmour@gmail.com"
13+
},
1014
{
1115
"name": "Albert Hambardzumyan",
1216
"email": "hambardzumyan.albert@gmail.com"

src/util/params.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const { RenderforestError } = require('./error')
1010

1111
class Params {
1212
/**
13-
* @param {Object} payload
14-
* @param {Array} props
13+
* Destruct given properties from the payload.
14+
* @param {Object} payload - The payload to destruct.
15+
* @param {Array} props - The props to destruct from payload.
1516
* @returns {Object}
16-
* @description Destruct given properties from the payload.
1717
*/
1818
static destructParams (payload, props) {
1919
if (!payload || !Object.keys(payload).length) {
@@ -30,11 +30,11 @@ class Params {
3030
}
3131

3232
/**
33-
* @param {Object} payload
34-
* @param {string} param
35-
* @returns {number|undefined}
33+
* Destruct URL param from the payload.
34+
* @param {Object} payload - The payload to destruct.
35+
* @param {string} param - The param to destruct from payload.
36+
* @returns {number|string}
3637
* @throws RenderforestError
37-
* @description Destruct URL param from the payload.
3838
*/
3939
static destructURLParam (payload, param) {
4040
if (!payload || !Object.keys(payload).length || payload[param] === undefined) {
@@ -45,17 +45,14 @@ class Params {
4545
}
4646

4747
/**
48+
* Destruct optional URL param from the payload.
4849
* @param {Object} payload
4950
* @param {string} param
5051
* @returns {number|string}
5152
* @throws RenderforestError
52-
* @description Destruct optional URL param from the payload.
5353
*/
5454
static destructOptionalURLParam (payload, param) {
55-
if (!payload || !Object.keys(payload).length) {
56-
throw new RenderforestError(`No parameter specified`)
57-
}
58-
if (payload[param] === undefined) {
55+
if (!payload || !Object.keys(payload).length || payload[param] === undefined) {
5956
return ''
6057
}
6158

0 commit comments

Comments
 (0)