Skip to content

Commit fd96475

Browse files
author
Jeff Shillitto
committed
Add template request schemas
1 parent 284a7d6 commit fd96475

1 file changed

Lines changed: 56 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ For examples of how to use the SDK to create videos using code checkout the Node
3737
- [SkewTransformation](#skewtransformation)
3838
- [FlipTransformation](#fliptransformation)
3939
- [MergeField](#mergefield)
40+
- [Template Schemas](#template-schemas)
41+
- [Template](#template)
42+
- [TemplateRender](#templaterender)
4043
- [Output Schemas](#output-schemas)
4144
- [Output](#output)
4245
- [Size](#size)
@@ -143,7 +146,7 @@ DeveloperKey.apiKey = 'H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD'; // use the cor
143146

144147
const api = new Shotstack.EditApi();
145148

146-
const id = "75143ec6-4b72-46f8-a67a-fd7284546935"; // use the render id from previous example
149+
const id = '75143ec6-4b72-46f8-a67a-fd7284546935'; // use the render id from previous example
147150

148151
api.getRender(id, { data: false, merged: true }).then((data) => {
149152
if (data.response.status === 'done') {
@@ -170,7 +173,7 @@ edit
170173
.setTimeline(timeline)
171174
.setOutput(output)
172175
.setMerge(merge)
173-
.setCallback("https://my-server.com/callback.php")
176+
.setCallback('https://my-server.com/callback.php')
174177
.setDisk("local");
175178
```
176179

@@ -700,6 +703,57 @@ setReplace(replace) | The replacement value. The replacement can be any valid JS
700703
701704
---
702705
706+
## Template Schemas
707+
708+
The following schemas specify how to use templates to store and render templates. A template lets you save an
709+
[Edit](#edit) that can be rendered by its template ID and optionally include merge fields that are merged with the
710+
template when rendered.
711+
712+
### Template
713+
714+
A template is a saved [Edit](#edit) than can be loaded and re-used.
715+
716+
#### Example:
717+
718+
```javascript
719+
const Shotstack = require('shotstack-sdk');
720+
721+
const template = new Shotstack.Template;
722+
template
723+
.setName('My Template')
724+
.setTemplate(edit);
725+
```
726+
727+
#### Methods:
728+
729+
Method | Description | Required
730+
:--- | :--- | :---:
731+
setName(string name) | The template name. | Y
732+
setTemplate([Shotstack.Edit](#edit) edit)) | An edit defines the arrangement of a video on a timeline, an audio edit or an image design and the output format. | Y
733+
734+
### TemplateRender
735+
736+
Render a template by its id and optional merge fields.
737+
738+
#### Example:
739+
740+
```javascript
741+
const Shotstack = require('shotstack-sdk');
742+
743+
const template = new Shotstack.TemplateRender;
744+
template
745+
.setId('21e781c0-8232-4418-fec1-cc99f0280c21')
746+
.setMerge(merge);
747+
```
748+
749+
#### Methods:
750+
751+
Method | Description | Required
752+
:--- | :--- | :---:
753+
setId(string id) | The id of the template to render in UUID format. | Y
754+
setMerge([Shotstack.MergeField[]](#mergefield) mergeField) | An array of key/value pairs that provides an easy way to create templates with placeholders. The placeholders can be used to find and replace keys with values. For example you can search for the placeholder `{{NAME}}` and replace it with the value `Jane`. | -
755+
756+
---
703757
## Output Schemas
704758
705759
The following schemas specify the output format and settings.

0 commit comments

Comments
 (0)