Cimpress Tagliatelle client
This project contains a thin client library for Cimpress' Tagliatelle service.
Usage
In order to use the client
npm install cimpress-tagliatelle --save
and once the package is available
Import
const Tagliatelle = require('cimpress-tagliatelle');
or
import Tagliatelle from 'cimpress-tagliatelle'
Instantiation
const options = {
baseUrl: 'string', // Base url of the service, by default it will be https://tagliatelle.trdlnk.cimpress.io
timeout: '3000', // Default: 3000 ms
retries: 3, // By default there are 3 retries
retryDelayInMs: 1000 // Default: 1000
}
const tagliatelle = new Tagliatelle(options);
Class functions
const accessToken = "ACCESS_TOKEN"
const resourceId = "https://stereotype.trdlnk.cimpress.io/v1/templates/demo"
const namespace= "test-namespace"
const tagId = "urn:namespace:specification"
const tagValue = "tag_value"
tagliatelle
.getTagsByResource(accessToken, resourceUri, namespace)
.then(data => {
console.log(data)
})
const resourcesUris = [
"https://stereotype.trdlnk.cimpress.io/v1/templates/demo",
"https://stereotype.trdlnk.cimpress.io/v1/templates/demo2"
]
tagliatelle
.getTagsByResources(accessToken, resourcesUris, namespace)
.then(data => {
console.log(data)
})
const key = "urn:stereotype:isTest";
tagliatelle
.getTagByResourceAndKey(accessToken, resourceUri, key)
.then(data => {
console.log(data)
})
tagliatelle
.getTagsByKey(accessToken, key)
.then(data => {
console.log(data)
})
const id = '00000000-0000-0000-0000-000000000000';
tagliatelle
.getTagById(accessToken,id)
.then(data => {
console.log(data)
})
const tagValue = true;
tagliatelle
.createTag(accessToken, resourceUri, tagKey, tagValue)
.then(tag => {
console.log(tag);
})
const tagValue = true;
tagliatelle
.updateTag(accessToken, id, resourceUri, key, tagValue)
.then(tag => {
console.log(tag);
})
const tagValue = true;
tagliatelle
.deleteTag(accessToken, id)
.then(tag => { })
Support
For any inquiries, we invite you to reach out to the Trdelnik Squad at TrdelnikSquad@cimpress.com.