|
| 1 | +## Projects API |
| 2 | + |
| 3 | + - [Get All Projects](#get-all-projects) |
| 4 | + - [Add Project](#add-project) |
| 5 | + - [Get Trial Project](#get-trial-project) |
| 6 | + - [Get a Specific Project](#get-a-specific-project) |
| 7 | + - [Update the Project - partial update](#update-the-project---partial-update) |
| 8 | + - [Delete a Specific Project](#delete-a-specific-project) |
| 9 | + - [Delete Specific Project Videos](#delete-specific-project-videos) |
| 10 | + - [Apply Template Preset on the Project](#apply-template-preset-on-the-project) |
| 11 | + - [Duplicate the Project](#duplicate-the-project) |
| 12 | + - [Render the Project](#render-the-project) |
| 13 | + |
| 14 | +### Get All Projects |
| 15 | + |
| 16 | +Retrieves the projects. |
| 17 | +```js |
| 18 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 19 | + |
| 20 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 21 | + |
| 22 | +Renderforest.getProjects({ |
| 23 | + limit: 2, |
| 24 | + offset: 10, |
| 25 | + includeApiProjects: false, |
| 26 | + order: 'DESC', |
| 27 | + orderBy: 'order', |
| 28 | + search: '' |
| 29 | +}) |
| 30 | + .then(console.log) // handle the success |
| 31 | + .catch(console.error) // handle the error |
| 32 | +``` |
| 33 | +- The renderedQualities property is optional and present if the project is in renders queue (ongoing rend). |
| 34 | +- All the properties of `payload` object are optional. |
| 35 | + |
| 36 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/get-projects.js) |
| 37 | + |
| 38 | + |
| 39 | +### Add Project |
| 40 | + |
| 41 | +Creates a project. |
| 42 | +```js |
| 43 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 44 | + |
| 45 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 46 | + |
| 47 | +Renderforest.addProject(701) |
| 48 | + .then(console.log) // handle the success |
| 49 | + .catch(console.error) // handle the error |
| 50 | +``` |
| 51 | +- Also, project-data is created with the following list of initial properties: |
| 52 | + templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteMusic, |
| 53 | + currentScreenId, projectColors (optional), themeVariableName (optional), themeVariableValue (optional). |
| 54 | + |
| 55 | + |
| 56 | +- The "muteMusic" is false initially. |
| 57 | +- If template is lego ("isLego": true), then no initial screen is added and "screens" defaults to []. Otherwise, at least one screen is present. |
| 58 | +- The "currentScreenId" is the id of the first screen for non-lego templates & null for lego templates. |
| 59 | +- The "projectColors" is optional and gets value if the template has default colors. Both lego & non-lego templates might have default colors. |
| 60 | +- Both "themeVariableName" & "themeVariableValue" are optional and are added (both) if template has theme. Both lego & non-lego templates might have a theme. |
| 61 | + |
| 62 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/add-project.js) |
| 63 | + |
| 64 | + |
| 65 | +### Get Trial Project |
| 66 | + |
| 67 | +This endpoint retrieves a trial project. Designed to allow the user to make a project (trial - without saving) before |
| 68 | + getting logged in to get an overall idea. |
| 69 | +The data can be used later to create real project (create project, update project-data with this data). |
| 70 | + |
| 71 | +_No authorization is required for this endpoint._ |
| 72 | +```js |
| 73 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 74 | + |
| 75 | +RenderforestClient.getTrialProject(701) |
| 76 | + .then(console.log) // handle the success |
| 77 | + .catch(console.error) // handle the error |
| 78 | + |
| 79 | +``` |
| 80 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/get-trial-project.js) |
| 81 | + |
| 82 | + |
| 83 | +### Get a Specific Project |
| 84 | + |
| 85 | +Gets a specific project. |
| 86 | +```js |
| 87 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 88 | + |
| 89 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 90 | + |
| 91 | +Renderforest.getProject(5000295) |
| 92 | + .then(console.log) // handle the success |
| 93 | + .catch(console.error) // handle the error |
| 94 | +``` |
| 95 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/get-project.js) |
| 96 | + |
| 97 | + |
| 98 | +### Update the Project - partial update |
| 99 | + |
| 100 | +Updates the project (partial update). |
| 101 | +```js |
| 102 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 103 | + |
| 104 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 105 | + |
| 106 | +Renderforest.updateProjectPartial(5000658, { customTitle: 'Graduation' }) |
| 107 | + .then(console.log) // handle the success |
| 108 | + .catch(console.error) // handle the error |
| 109 | +``` |
| 110 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/update-project-partial.js) |
| 111 | + |
| 112 | + |
| 113 | +### Delete a Specific Project |
| 114 | + |
| 115 | +Deletes a specific project. |
| 116 | +```js |
| 117 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 118 | + |
| 119 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 120 | + |
| 121 | +Renderforest.deleteProject(5000658) |
| 122 | + .then(console.log) // handle the success |
| 123 | + .catch(console.error) // handle the error |
| 124 | + |
| 125 | +``` |
| 126 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/delete-project.js) |
| 127 | + |
| 128 | + |
| 129 | +### Delete Specific Project Videos |
| 130 | + |
| 131 | +Deletes specific project videos. The quality parameter is optional. |
| 132 | + |
| 133 | +**IMPORTANT**: If you want to delete only a single quality video, you have to specify quality parameter, |
| 134 | +otherwise all quality videos of the project will be deleted. |
| 135 | + |
| 136 | +```js |
| 137 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 138 | + |
| 139 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 140 | + |
| 141 | +Renderforest.deleteProjectVideos(4120385, 360) |
| 142 | + .then(console.log) // handle the success |
| 143 | + .catch(console.error) // handle the error |
| 144 | +``` |
| 145 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/delete-project-videos.js) |
| 146 | + |
| 147 | + |
| 148 | +### Apply Template Preset on the Project |
| 149 | + |
| 150 | +Applies template preset on the project. |
| 151 | +```js |
| 152 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 153 | + |
| 154 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 155 | + |
| 156 | +Renderforest.applyTemplatePresetOnProject(5000658, 55) |
| 157 | + .then(console.log) // handle the success |
| 158 | + .catch(console.error) // handle the error |
| 159 | +``` |
| 160 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/apply-template-preset-on-project.js) |
| 161 | + |
| 162 | + |
| 163 | +### Duplicate the Project |
| 164 | + |
| 165 | +Duplicates the project. |
| 166 | +```js |
| 167 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 168 | + |
| 169 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 170 | + |
| 171 | +Renderforest.duplicateProject(5000658) |
| 172 | + .then(console.log) // handle the success |
| 173 | + .catch(console.error) // handle the error |
| 174 | +``` |
| 175 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/duplicate-project.js) |
| 176 | + |
| 177 | + |
| 178 | +### Render the Project |
| 179 | + |
| 180 | +Renders the project with given quality. The possible values for the quality are: 0, 360, 720, and 1080. |
| 181 | +The watermark parameter is optional, must be in '.png' file format and have canvas size of 1920 x 1080 pixels, |
| 182 | +url length must not exceed 250 characters. |
| 183 | + |
| 184 | +```js |
| 185 | +const RenderforestClient = require('@renderforest/sdk-node') |
| 186 | + |
| 187 | +const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 }) |
| 188 | + |
| 189 | +Renderforest.renderProject(4120385, { quality: 360, watermark: 'https://example.com/watermark.png' }) |
| 190 | + .then(console.log) // handle the success |
| 191 | + .catch(console.error) // handle the error |
| 192 | + |
| 193 | +``` |
| 194 | +- The possible values of the quality are: 0, 360, 720, and 1080. |
| 195 | + |
| 196 | +[See example](https://github.com/renderforest/renderforest-sdk-node/blob/master/samples/projects/render-project.js) |
| 197 | + |
| 198 | +**[⬆ back to the top](#projects-api)** |
0 commit comments