0.1.0 • Published 6 years ago

tog v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Modern Toggl API wrapper and Timer.

This package wraps the Toggl API with a promised based approach. This makes the usage of async/await straight forward.

It also has timer functionality build in to easily start, stop and update the a time entry.

Build Status

Requirements

This package requires node 8 or higher, because of async/await usage.

Installation

npm install tog

Usage

Initialisation

import { Toggl } from 'tog'

// Using your API token
const toggl = new Toggl({ apiToken: 'YOUR_API_TOKEN' })

// Using your credentials
const toggl = new Toggl({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
})

Getting data

const { data: clients } = await toggl.getClients()

Using a timer

// Starting a timer
const timer = await toggl.startTimer({ description: 'I\'m very busy' })

// Updating the time entry
await timer.update({ description: 'Still very busy' })

// When you're done
await timer.stop()

// Get details of the timer
console.log(timer.entry)
0.1.0

6 years ago

0.0.1

9 years ago