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

isleclient

v1.0.0-d

Published

Frontend library to make the use of the ManyIsles API easier

Downloads

3

Readme

IsleClient

Frontend library to make the use of the ManyIsles API easier

The library is compiled to ES2016 with commonjs modules, thus it can be used in nodejs and in the browser.

To use it in the browser you need to use a bundler like webpack or rollup.

Installation

npm install isleclient

Description:

The package exports a Client class which needs to be constructed with a baseUrl parameter. This is the base url of the API. In most cases this will be ToAdd

Token

To use the API you need to have a token. This token can be obtained during the login process.

Usage

The Client class has 4 subfields:

  • authentication - Authentication related methods
  • users - User related methods
  • groups - Group related methods
  • permissions - Permission related methods

Authentication

Methods

class AuthenticationEndpoints {
    login(data: LoginRequest): Promise<LoginResponse>
    checkToken(token: string): Promise<void>
    checkCredentials(data: LoginRequest): Promise<void>
    updatePassword(id: string, data: UpdatePasswordRequest): Promise<void>
}

Types

Either username or email is required

  • username - The username of the user [string] [optional]
  • email - The email of the user [string] [optional]
  • password - The password of the user [string] [required]
  • data - The data of the response SelfUser
  • token - The token of the user [string]

Either username or email is required

  • username - The username of the user [string] [optional]
  • email - The email of the user [string] [optional]
  • oldPassword - The old password of the user [string] [required]
  • newPassword - The new password of the user [string] [required]

Users

Methods

class UserEndpoints {
    getById(id: string): Promise<PublicUser | SelfUser | AdminUser>;
    getByUsername(username: string): Promise<PublicUser | SelfUser | AdminUser>;
    getByEmail(email: string): Promise<AdminUser>;
    query(data?: UserSearchRequest): Promise<(PublicUser | SelfUser | AdminUser)[]>;
    register(data: UserCreateRequest): Promise<PublicUser>;
    update(id: string, data: UserPatchRequest): Promise<(SelfUser | AdminUser)>;
    delete(id: string): Promise<void>;
    getPermissions(id: string, hierarchical?: boolean): Promise<Permission[]>;
}

Types

  • id - The id of the user [string]

  • username - The username of the user [string]

  • title - The title of the user [string]

  • groups - The groups of the user Group[]

Extends PublicUser

  • email - The email of the user [string]

  • firstName - The first name of the user [string]

  • lastName - The last name of the user [string]

Extends SelfUser

  • emailVerified - Whether the email of the user is verified [boolean]

  • deactivated - Whether the user is deactivated [boolean]

  • keycloakId - The keycloak id of the user [string]

  • username - The username of the user [string] [required]
  • email - The email of the user [string] [required]
  • firstName - The first name of the user [string] [required]
  • lastName - The last name of the user [string] [required]
  • title - The title of the user [string] [required]
  • groups - The groups of the user [string[]] [required]
  • password - The password of the user [string] [required]
  • emailVerified - Whether the email of the user is verified [boolean] [optional] [admin only]
  • deactivated - Whether the user is deactivated [boolean] [optional] [admin only]
  • username - The username of the user [string] [optional]
  • email - The email of the user [string] [optional]
  • firstName - The first name of the user [string] [optional]
  • lastName - The last name of the user [string] [optional]
  • title - The title of the user [string] [optional]
  • groupsToAdd - The groups to add to the user [string[]] [optional] [admin only]
  • groupsToRemove - The groups to remove from the user [string[]] [optional] [admin only]
  • emailVerified - Whether the email of the user is verified [boolean] [optional] [admin only]
  • deactivated - Whether the user is deactivated [boolean] [optional] [admin only]
  • username - The username of the user [string] [optional]
  • email - The email of the user [string] [optional] [admin only]
  • firstName - The first name of the user [string] [optional] [admin only]
  • lastName - The last name of the user [string] [optional] [admin only]
  • emailVerified - Whether the email of the user is verified [boolean] [optional] [admin only]

Groups

Methods

class GroupEndpoints {
    getById(id: string): Promise<Group>;
    getMembers(id: string): Promise<SelfUser[]>;
    create(data: GroupCreateRequest): Promise<Group>;
    update(id: string, data: GroupPatchRequest): Promise<Group>;
    delete(id: string): Promise<void>;
}

Types

  • id - The id of the group [string]
  • name - The name of the group [string]
  • permissions - The permissions of the group [string[]]
  • parent- The parent group of the group ParentGroup [optional]
  • id - The id of the parent group [string]
  • name - The name of the parent group [string]
  • name - The name of the group [string] [required]
  • parent - The parent group of the group [string] [optional]
  • permissions - The permissions of the group [string[]] [optional]
  • name - The name of the group [string] [optional]
  • parent - The parent group of the group [string] [optional]
  • permissionsToAdd - The permissions to add to the group [string[]] [optional]
  • permissionsToRemove - The permissions to remove from the group [string[]] [optional]

Permissions

Methods

class PermissionEndpoints {
    getAll(): Promise<Permission[]>;
    getById(id: string): Promise<Permission>;
    create(data: PermissionCreateRequest): Promise<Permission>;
    delete(id: string): Promise<void>;
}

Types

  • id - The id of the permission [string]
  • name - The name of the permission [string]
  • description - The description of the permission [string]
  • name - The name of the permission [string] [required]
  • description - The description of the permission [string] [optional]

Example

Register and login

import { Client } from 'isleclient';

const client = new Client('https://api.example.com');

await client.users.register({
    username: 'username',
    email: '[email protected]',
    firstName: 'Your',
    lastName: 'Name',
    title: 'Master',
    groups: ['group1', 'group2'],
    password: 'password'
});

const {token,data} = await client.authentication.login({
    username: 'username',
    password: 'password'
});

client.setToken(token);

// Do other stuff

Change your first and last name

import { Client } from 'isleclient';

const client = new Client('https://api.example.com');

const {token, data} = await client.authentication.login({
    username: 'username',
    password: 'password'
});

client.setToken(token);

await client.users.update(data.id, {
    firstName: 'John',
    lastName: 'Doe'
});