Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gutenfries/wakatimejs
Type safe JavaScript client for the WakaTime REST API
https://github.com/gutenfries/wakatimejs
browser gulp jest node typescript wakatime wakatime-api wakatime-client
Last synced: 26 days ago
JSON representation
Type safe JavaScript client for the WakaTime REST API
- Host: GitHub
- URL: https://github.com/gutenfries/wakatimejs
- Owner: gutenfries
- Created: 2023-06-06T05:30:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-16T19:22:35.000Z (11 months ago)
- Last Synced: 2024-11-18T01:37:25.675Z (3 months ago)
- Topics: browser, gulp, jest, node, typescript, wakatime, wakatime-api, wakatime-client
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/wakatimejs
- Size: 638 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# WakaTimeJS
Type safe JavaScript client for the WakaTime REST API
## Installation
```bash
npm install wakatimejs
```or
```bash
yarn add wakatimejs
```## Usage
consumption is super straight forward, just import the class and instantiate it with your api key.
```javascript
import { WakaTime } from "wakatimejs"; // or const { WakaTime } = require('wakatimejs');const wakaTime = new WakaTime("your-api-key");
wakaTime.users.current().then((user) => {
console.log(user);
});
```Alternatively, if you don't have access to the api key at the time of instantiation, you can use the `setApiKey` method.
```javascript
import { WakaTime } from "wakatimejs";const wakatime = new WakaTime();
// ... later on
wakaTime.setApiKey("your-api-key");
wakaTime.users.current().then((user) => {
console.log(user);
});
```## API
The API follows the samme nameing convention for the endpoints as the [REST API](https://wakatime.com/developers).
some of the routes in the REST API require a user id or authentication, but these are handled by the client, so you don't have to worry about them.