# cimpress-tagliatelle

> A thin client for Cimpress Tagliatelle service

Latest version **0.3.6** (published 2021-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install cimpress-tagliatelle
pnpm add cimpress-tagliatelle
yarn add cimpress-tagliatelle
bun add cimpress-tagliatelle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2021-05-05 |
| First published | 2018-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 293.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | TrdelnikSquad@cimpress.com |
| Maintainers | victorcuena, ivan.stanishev, trdelnik_squad, igrom, rnowosielski |
| Keywords | cimpress, tagging, tagliatelle |

## Links

- npm: https://www.npmjs.com/package/cimpress-tagliatelle
- Repository: https://github.com/Cimpress/cimpress-tagliatelle
- Homepage: https://github.com/Cimpress/cimpress-tagliatelle#readme
- Issues: https://github.com/Cimpress/cimpress-tagliatelle/issues
- npm.io page: https://npm.io/package/cimpress-tagliatelle

## Dependencies (4)

- [qs](https://npm.io/package/qs.md) ^6.5.2
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [axios-retry](https://npm.io/package/axios-retry.md) ^3.1.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.5.4

## Recent versions

- 0.3.6 (latest) — 2021-05-05
- 0.3.5 — 2019-09-10
- 0.3.4 — 2019-07-17
- 0.3.3 — 2019-07-17
- 0.3.2 — 2019-06-24
- 0.3.1 — 2019-01-17
- 0.3.0 — 2018-12-19
- 0.2.1 — 2018-12-18
- 0.2.0 — 2018-12-13
- 0.1.1 — 2018-11-16
- 0.1.0 — 2018-11-06
- 0.0.1 — 2018-11-01

## README

# 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 


```javascript
    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"

    // Get all the tags asociated to a resource, filtered by namespace if provided.

    tagliatelle
        .getTagsByResource(accessToken, resourceUri, namespace) // The 3rd parameter namespace is optional
        .then(data => {
            console.log(data)
            /*
            {
                count: 2,
                total: 2,
                results: [
                {
                    id: '00000000-0000-0000-0000-000000000000',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                        }
                    }
                },
                {
                    id: '00000000-0000-0000-0000-000000000001',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000001"
                        }
                    }
                },
                ]
            }

            */
        })
    
    // Get all the tags asociated to the resources provided, filtered by namespace if provided.
    const resourcesUris = [
        "https://stereotype.trdlnk.cimpress.io/v1/templates/demo",
        "https://stereotype.trdlnk.cimpress.io/v1/templates/demo2"
    ]
    tagliatelle
        .getTagsByResources(accessToken, resourcesUris, namespace) // The 3rd parameter namespace is optional
        .then(data => {
            console.log(data)
            /*
            {
                count: 2,
                total: 2,
                results: [
                {
                    id: '00000000-0000-0000-0000-000000000000',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                        }
                    }
                },
                {
                    id: '00000000-0000-0000-0000-000000000001',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo2',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000001"
                        }
                    }
                },
                ]
            }

            */
        })
        
    // Get the tag asociated with the key and the resourceUri asociated
    const key = "urn:stereotype:isTest";
    tagliatelle
        .getTagByResourceAndKey(accessToken, resourceUri, key)
        .then(data => {
            console.log(data)
            /*
            {
                id: '00000000-0000-0000-0000-000000000000',
                key: 'urn:stereotype:isTest',
                value: 'true',
                resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                createdAt: '2018-11-01T13:08:11.884Z',
                createdBy: '[SUB]',
                _links: {
                    "self": {
                        "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                    }
                }
            }
            */
        })
    
    
    // Get all the tags with the key provided
    tagliatelle
        .getTagsByKey(accessToken, key)
        .then(data => {
            console.log(data)
            /*
            {
                count: 2,
                total: 2,
                results: [
                {
                    id: '00000000-0000-0000-0000-000000000000',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                        }
                    }
                },
                {
                    id: '00000000-0000-0000-0000-000000000001',
                    key: 'urn:stereotype:isTest',
                    value: 'true',
                    resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo2',
                    createdAt: '2018-11-01T13:08:11.884Z',
                    createdBy: '[SUB]',
                    _links: {
                        "self": {
                            "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000001"
                        }
                    }
                },
                ]
            }

            */
        })
        
    // Get the tag with the id provided
    const id = '00000000-0000-0000-0000-000000000000';
    tagliatelle
        .getTagById(accessToken,id)
        .then(data => {
            console.log(data)
            /*
            {
                id: '00000000-0000-0000-0000-000000000000',
                key: 'urn:stereotype:isTest',
                value: 'true',
                resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                createdAt: '2018-11-01T13:08:11.884Z',
                createdBy: '[SUB]',
                _links: {
                    "self": {
                        "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                    }
                }
            }
            */
        })
    

    // Creates a tag in a specific resource

    const tagValue = true;
    tagliatelle
        .createTag(accessToken, resourceUri, tagKey, tagValue) 
        .then(tag => {
            console.log(tag);
            /*
            {
                id: '00000000-0000-0000-0000-000000000000',
                key: 'urn:stereotype:isTest',
                value: 'true',
                resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                createdAt: '2018-11-01T13:08:11.884Z',
                createdBy: '[SUB]',
                _links: {
                    "self": {
                        "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                    }
                }
            }
            */
        })
            

    // Updates a tag

    const tagValue = true;
    tagliatelle
        .updateTag(accessToken, id, resourceUri, key, tagValue) 
        .then(tag => {
            console.log(tag);
            /*
            {
                id: '00000000-0000-0000-0000-000000000000',
                key: 'urn:stereotype:isTest',
                value: 'true',
                resourceUri: 'https://stereotype.trdlnk.cimpress.io/v1/templates/demo',
                createdAt: '2018-11-01T13:08:11.884Z',
                createdBy: '[SUB]',
                _links: {
                    "self": {
                        "href": "https://tagliatelle.trdlnk.cimpress.io/v0/tags/00000000-0000-0000-0000-000000000000"
                    }
                }
            }
            */
        })

    // Deletes a tag

    const tagValue = true;
    tagliatelle
        .deleteTag(accessToken, id) 
        .then(tag => { /* no-content */})

```

## Support

For any inquiries, we invite you to reach out to the Trdelnik Squad at TrdelnikSquad@cimpress.com.

---
_Source: https://npm.io/package/cimpress-tagliatelle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
