New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details → →
Socket
Book a DemoSign in
Socket

wakaclient

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wakaclient

đź§® Retrieve data from WakaTime

latest
npmnpm
Version
1.1.1
Version published
Maintainers
0
Created
Source

WakaClient

WakaClient is an API wrapper for interacting with WakaTime. This project was created as a result for a need for filtering data by ALL_TIME, but no existing libraries had this.

Usage

To import the base class, you can use

import { WakaClient } from "wakaclient";

You will then need to create a new instance of the class, where the first parameter is your API key - This can be retrieved here

const wakaClient = new WakaClient(YOUR_API_KEY);

Now that you have initialized a client, you can call the methods on it.

Range

In order to access data ranges, you can import the enum type

import { WakaClient, Range } from "wakaclient";

You will then have access to the data ranges

enum Range {
  LAST_7_DAYS,
  LAST_30_DAYS,
  LAST_6_MONTHS,
  LAST_YEAR,
  ALL_TIME,
}

Methods

getCurrentUser

This method will get the currently authenticated user

const user = await wakaClient.getCurrentUser();

getUserByID

This method will get a user based on their User-Id

const user = await wakaClient.getUserByID(
  "c4bfb54e-3722-4b4e-b236-50c8d60077d1",
);

getStats

This method will get all stats for a user in the time period

const stats = await wakaclient.getStats({}); // will get all time stats for the current user
const stats = await wakaClient.getStats({ range: Range.LAST_7_DAYS }); // will get stats for the last 7 days for the current user
const stats = await wakaClient.getStats({
  identifier: "c4bfb54e-3722-4b4e-b236-50c8d60077d1",
  range: Range.LAST_7_DAYS,
}); // will get stats for the last 7 days of the user supplied

getProjects

This method will get a users projects

const projects = await wakaClient.getProjects(); // will get the projects for the current user
const projects = await wakaClient.getProjects(
  "c4bfb54e-3722-4b4e-b236-50c8d60077d1",
); // will get the projects for the user

getDurations

This method will get a users durations (heartbeat total time)

const durations = await wakaClient.getDurations();
const durations = await wakaClient.getDurations({ identifier: "c4bfb54e-3722-4b4e-b236-50c8d60077d1", date: new Date(), project: "wakaclient" });

FAQs

Package last updated on 12 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts