🛑 node-tempo-client is deprecated 🛑
node-tempo-client
was built to work for version 3 of Tempo's REST API, which is no longer their latest version.
Since version 4, Tempo's REST API implements the OpenAPI specification. This means tools like Swagger Codegen or OpenAPI Generator can be used to generate the code for a client, including Typescript definitions.
It is highly recommended switching over to generated code as you will have greater control over how quickly you can use the new features Tempo adds to their API and you will be less dependent on a 3rd-party package.
For this reason, node-tempo-client
has been deprecated on NPM and you will be warned the next time you install this package.
An unofficial node.js wrapper for the Tempo REST API.
The repo aims to be similar in usage to the node-jira-client.
Install using NPM:
$ npm install tempo-client
The bearerToken
can be retrieved in two ways; Either as an individual user (useful for running personal reports and
basic tests), or as an application developer (Useful for developing apps that seamlessly integrate with Tempo).
Please see the sections "Using the REST API as an individual user" or
"Using the REST API as an application developer" in Tempo's documentation.
Note that the bearer token for Tempo IS NOT the same as the token generated in Jira.
// ES5
const TempoApi = require('tempo-client').default;
// ES6
import TempoApi from 'tempo-client';
const tempo = new TempoApi({
protocol: 'https',
host: 'api.tempo.io',
bearerToken: 'token',
apiVersion: '3'
})
const user = {
accountId: '1111aaaa2222bbbb3333cccc'
};
const dateRange = {
from: '2019-10-07',
to: '2019-10-11'
};
// ES6
const worklogs = tempo.worklogs.getForUser(user.accountId, dateRange)
.then(worklogs => {
console.log(worklogs.results);
})
.catch(err => {
console.log(err);
});
// ES7
async function getWorklogsForUser(user, from, to) {
try {
const worklogs = await tempo.worklogs.getForUser(user.accountId, { from, to });
console.log(worklogs.results);
} catch (err) {
console.log(err);
}
}
// Create a new account using `.post(...)`
let account = {
key: 'CLOUDBAY_DEVELOPMENT',
name: 'Cloudbay: Development',
status: 'OPEN',
leadAccountId: "123456:01234567-89ab-cdef-0123-456789abcdef"
};
let accountId = (await tempo.accounts.post(account)).id;
console.log(`Account "${account.key}" has an id of: ${accountId}`);
// Modify the account using `.putAccount(...)`
account.status = 'CLOSED'
const accountOnTempo = await tempo.accounts.putAccount(account.key, account);
console.log(`Account "${account.key}" is now: ${accountOnTempo.status}`);
// Delete the account using `.deleteAccount(...)`
await tempo.accounts.deleteAccount(account.key);
// `.getAccount(...)` will throw an error now that the account is deleted
try {
await tempo.accounts.getAccount(account.key);
} catch (err) {
console.log(`Account "${account.key}" no longer exists!`);
}
All endpoints listed in the Tempo REST API (https://apidocs.tempo.io/) for the Version 3 REST API are implemented as of November 2019. The REST API documentation will answer most questions about the expected structure of data.
Auto-generated documentation for the Tempo Client can be found at: https://tempo-client.leifgehrmann.com/
For example, if one wants to modify the accounts
collection, one can find the
API methods at
Globals/ "collections/accounts" / Accounts.
It's strongly recommended to use TypeScript as code completion will help quite a bit with navigating the client.
See CONTRIBUTING.md for more information.
Generated using TypeDoc