ScriptEvent

ScriptEvent allows writing and executing custom JavaScript on the Plattar platform.

These scripts can be used to implement custom interactions and functionality not available in the Plattar CMS.

Parent
Relationships
Imports
NodeJS Imports
const {
  	Project,
  	ScriptEvent,
  	Server
} = require('@plattar/plattar-api');
Initialisation
Initialise the ScriptEvent Object
const script = new ScriptEvent('your-scriptevent-id');
.get()
Populate the object with data
script.get().then((script) => {
	// do something with script
}).catch((error) => {
	// do something with error
});
.update()
Update the object with new data
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

script.attributes.title = 'your-new-script-title';

script.update().then((script) => {
	// do something with script
}).catch((error) => {
	// do something with error
});
.create()
Create a new object
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

script.attributes.title = 'your-new-script-title';

// you must pass the parent object during create function
const parent = new Project('your-project-id');

script.create(parent).then((script) => {
	// do something with script
}).catch((error) => {
	// do something with error
});
.delete()
Delete a previous object
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

script.delete().then((script) => {
	// do something with script
}).catch((error) => {
	// do something with error
});