npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hakuna-client

v2.0.1

Published

Client to the Hakuna API

Downloads

8

Readme

hakuna-client

Standard - JavaScript Style Guide

This is a JavaScript client for the Hakuna API. It supports all API functions and can be used with npm:

npm install --save hakuna-client

Example

const HakunaClient = require('hakuna-client')

const client = new HakunaClient({
  authToken: 'yourAuthToken',
  company: 'yourCompanyName'
})

client.overview(function (err, result) {
  if (err) console.error(err)

  console.log(result)
})

Documentation

The official API documentation can be found on the official site.

To use the client you need to get your personal API key, you can find it by clicking your name on the top right in your Hakuna and select "API".

Please note that the callbacks are node style, error first. The first parameter to the callback function always is an error. This makes error handling pretty easy:

client.overview(function (err, result) {
  if (err) // handle error here
})

New in 2.0.0: If no callback function was given, a promise will be returned.

Example:

let overview = await client.overview()

Personal

Those endpoints allow you to make the requests in the context of another user that you can manage. This can be specially useful when you're a team leader and want to get information for your team members.

This client knows the "personal user mode" which can be enabled like follows:

client.setPersonalUserMode('anotherUserId')

client.listTimeEntries('2016-11-11', (err, results) => {
  if (err) console.error(err)

  console.log(results)
})

client.resetPersonalUserMode()

overview(cb)

cb - function (err, result)

Quick overview over your key metrics.

getOwnUser(cb)

cb - function (err, user)

Get information on own user.

getTimer(cb)

cb - function (err, result)

Retrieves the timer.

startTimer(taskId, opts, cb)

taskId - The ID of the task
opts - object (optional)
  projectId - The id of the project
  startTime - Another start time
  note - A note
cb - function (err, result)

Starts a timer.

stopTimer(endTime, cb)

endTime - alternative end time (optional)
cb - function (err, result)

Stops a running timer.

cancelTimer(cb)

cb - function (err)

Cancels a running timer.

listTimeEntries(date, cb)

date - Date as string YYYY-MM-DD
cb - function (err, results)

Lists time entries for a given date.

getTimeEntry(id, cb)

id - ID of the time entry
cb - function (err, result)

Gets a single time entry.

createTimeEntry(entry, cb)

entry - object
  starts - Start date and time in ISO 8601 format
  ends - End date and time in ISO 8601 format
  taskId - The task id
  projectId - The project's id (optional)
  note - A note (optional)
cb - function (err, result)

Create a new time entry.

updateTimeEntry(entry, cb)

entry - object
  id - The id of the entry
  starts - Start date and time in ISO 8601 format
  ends - End date and time in ISO 8601 format
  taskId - The task id
  projectId - The project's id (optional)
  note - A note (optional)
cb - function (err, result)

Update an existing time entry.

deleteTimeEntry(id, cb)

id - The id of the entry
cb - function (err)

Delete an entry by it's id.

listAbsences(year, cb)

year - Year as string
cb - function (err, results)

List absences for a given year.

listManageableUsers(cb)

cb - function (err, results)

List users that can be managed.

Global

listTasks(cb)

cb - function (err, results)

List all available tasks.

listProjects(cb)

cb - function (err, results)

List all active and archived projects.

Organization

Note: An organizational API key is needed for this. If you've set up your client with a personal API key but still want to use this functionality, you can pass another API key as parameter.

getOrganizationStatus(apiKey, cb)

apiKey - organizational API key (optional)
cb - function (err, result)

Retrieves today’s presence/absence information about all users in your organization.

Tests

Right now the only thing that is being tested is the standard compliant coding style. Run this with npm test.

License

MIT