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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@accentor/api-client-js

v0.23.3

Published

A javascript client for the Accentor API

Downloads

140

Readme

Accentor API Client

Install

Install using your package manger of choice:

yarn add @accentor/api-client-js
npm install @accentor/api-client-js

How to use

To intialize the API client:

import { createApiClient } from "@accentor/api-client-js";

const baseURL = /* Your logic for baseURL, including /api/ */

const api = createApiClient(baseURL);

Overview of functions

All functions should be provided with an auth object containing the device_id and secret. When creating an auth token, you can leave out this object.

Not every function is available for every model. Only the routes available to that model can be called.

// Index (some indexes can be called with an optional scope, see below)
const generator = api.users.index(auth);
const { results, done } = await generator.next();

// Create
const result = await api.tracks.create(auth, objectToCreate);

// Read
const result = await api.tracks.read(auth, id);

// Update
const result = await api.tracks.update(auth, id, object);

// Destroy
const true = await api.tracks.destroy(auth, id);

// Destroy empty
const true = await api.albums.destroyEmpty(auth, id);

// Merge
const result = await api.tracks.merge(auth, newId, oldID);

// Start rescan
const result = await api.rescan.start(auth);

// Get rescan status
const result = await api.rescan.show(auth);

Adding scopes to indexes

If you want to filter the items fetched by through indexGenerator, you can pass an optional scope. We currently have scopes for albums, artists and tracks

An example of a scope used:

import { AlbumsScope } from "@accentor/api-client-js";

const scope = new AlbumsScope.label(1);
const generator = api.albums.index(auth, scope)

You can create scopes in different ways:

  • created on a single line new AlbumsScope.label(id)
  • chained for more complex queries new AlbumsScope.label(id).artist(id).filter(string)
  • created and then modified:
const scope = new AlbumsScope()
scope.label(id)
scope.artist(id)
scope.finalQuery

Overview of available scopes

// Albums
new AlbumsScope.artist(artist_id) 
new AlbumsScope.label(label_id)
new AlbumsScope.labels([label_id, label_id, ...])
new AlbumsScope.filter(string) // Search in album titles

// Artists
new ArtistsScope.filter(string) // Search in artist names

// Tracks
new TracksScope.album(album_id)
new TracksScope.artist(artist_id)
new TracksScope.genre(genre_id)
new TracksScope.filter(string) // Search in track titles

Versioning

This package bases its versioning on the major and minor versions of the API. This way, changes in routes and scopes are introduced in the same version that they are introduced in the API. Patch releases can be issued to fix issues in this package itself.