- Get All Projects
- Add Project
- Get Trial Project
- Get a Specific Project
- Update the Project - partial update
- Delete a Specific Project
- Delete Specific Project Videos
- Duplicate the Project
- Render the Project
- Get rendering status
Retrieves the projects.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.getProjects({
limit: 2,
offset: 10,
includeApiProjects: false,
order: "DESC",
orderBy: "order",
search: "",
})
.then(console.log) // handle the success
.catch(console.error); // handle the error
- The renderedQualities property is optional and present if the project is in renders queue (ongoing rend).
- All the properties of
payload
object are optional.
Creates a project.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.addProject(701)
.then(console.log) // handle the success
.catch(console.error); // handle the error
-
Also, project-data is created with the following list of initial properties: templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteSfx, currentScreenId, projectColors (optional), themeVariableName (optional), themeVariableValue (optional).
-
The "muteSfx" is false initially.
-
If template is lego ("isLego": true), then no initial screen is added and "screens" defaults to []. Otherwise, at least one screen is present.
-
The "currentScreenId" is the id of the first screen for non-lego templates & null for lego templates.
-
The "projectColors" is optional and gets value if the template has default colors. Both lego & non-lego templates might have default colors.
-
Both "themeVariableName" & "themeVariableValue" are optional and are added (both) if template has theme. Both lego & non-lego templates might have a theme.
This endpoint retrieves a trial project. Designed to allow the user to make a project (trial - without saving) before getting logged in to get an overall idea. The data can be used later to create real project (create project, update project-data with this data). Additionally you can get preloaded project data with particular preset of template.
No authorization is required for this endpoint.
const RenderforestClient = require("@renderforest/sdk-node");
// Just a blank project for given tempalte
RenderforestClient.getTrialProject(701)
.then(console.log) // handle the success
.catch(console.error); // handle the error
// Project data with preloaded preset data of given template.
RenderforestClient.getTrialProject(701, 2)
.then(console.log) // handle the success
.catch(console.error); // handle the error
Gets a specific project.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.getProject(5000295)
.then(console.log) // handle the success
.catch(console.error); // handle the error
Updates the project (partial update).
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.updateProjectPartial(5000658, { customTitle: "Graduation" })
.then(console.log) // handle the success
.catch(console.error); // handle the error
Deletes a specific project.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.deleteProject(5000658)
.then(console.log) // handle the success
.catch(console.error); // handle the error
Deletes specific project videos. The quality parameter is optional.
IMPORTANT: If you want to delete only a single quality video, you have to specify quality parameter, otherwise all quality videos of the project will be deleted.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.deleteProjectVideos(4120385, 360)
.then(console.log) // handle the success
.catch(console.error); // handle the error
Duplicates the project.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.duplicateProject(5000658)
.then(console.log) // handle the success
.catch(console.error); // handle the error
Renders the project with given quality. The possible values for the quality are: 0, 360, 720, and 1080. The watermark parameter is optional, must be in '.png' file format and have canvas size of 1920 x 1080 pixels, url length must not exceed 250 characters.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.renderProject(4120385, { quality: 360, watermark: "https://example.com/watermark.png" })
.then(console.log) // handle the success
.catch(console.error); // handle the error
Renderforest.renderProject(4120386, { quality: 360, duration: 15, startSecond: 10 })
.then(console.log) // handle the success
.catch(console.error); // handle the error
- The possible values of the quality are: 0, 360, 720, and 1080.
- Additionally,
duration
andstartSecond
parameters can be specified as rendering options. These parameters are only applicable to visualizer projects. They will be dismissed for other projects.
Our rendering status method uses user's defined callback
to manage rendering status percentage
and uses error first callback pattern. If you want to unsubscribe from getting rendering status
(before rendering finishes) then simply call
unsubscribe
(getRenderingStatus
method returns function to unsubscribe from getting rendering status).
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.renderProject(15431416, { quality: 720 }).then(() => {
const unsubscribe = Renderforest.getRenderingStatus((error, percentage) => {
if (error) {
console.log(error);
}
// take percentage from here
console.log(percentage);
// if you want in unsubscribe (before rendering finishes) for some reason, then simply call unsubscribe
unsubscribe();
});
});
Generates a preview of the lego project's screens.
const Renderforest = require("../../src/lib/renderforest");
const renderforest = new Renderforest({ signKey: "<signKey>", clientId: -1 });
renderforest
.getProjectData(7096113)
.then((projectDataInstance) => {
const projectData = projectDataInstance.getRawProjectData();
const screenIds = projectData.screens.map((screen) => screen.id);
return Renderforest.generateLegoScreensPreviews(projectData.projectId, screenIds);
})
.then((previewData) => {
console.log("Preview data:", previewData);
})
.catch(console.error); // handle the error
See lego preview screens example
Retrieves the rendering status of individual screens for lego templates. This method allows you to track the progress of rendering for each screen in a lego project.
const RenderforestClient = require("../../lib/client");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.getLegoPreviewRenderingStatus((error, status) => {
if (error) {
console.log(error);
}
// take percentage from here
console.log(status);
});
See get rendering status of screens for lego templates example
Cancels the lego preview.
const RenderforestClient = require("../../lib/client");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.cancelLegoPreview(88172301, [101628322])
.then(console.log) // handle the success
.catch(console.error); // handle the error
See cancel lego preview example
Retrieves the preview URLs for a specific project.
const RenderforestClient = require("@renderforest/sdk-node");
const Renderforest = new RenderforestClient({ signKey: "<signKey>", clientId: -1 });
Renderforest.getProjectPreviewUrls(4120385, { quality: 360 })
.then(console.log) // handle the success
.catch(console.error); // handle the error