Tag

Tags are a special object that can be attached to any object. The Plattar CMS allows searching for objects with specific tag names.

Tagging can be useful for organising large number of objects.

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

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

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

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

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

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

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