@praekelt/seed-auth

0.1.4 • Public • Published

seed-auth-js

js client for seed-auth-api

install

$ npm install @praekelt/seed-auth

usage

const auth = require('@praekelt/seed-auth');

auth.users.list()
  .then(res => console.log(resp.data));

api

configuration

Configuration can be provided as an options object for each api method:

auth.users.list({conf: {token: '1234'}});

or set for all api methods:

auth.conf.token = '1234';

conf.prefix

The prefix to use for requests. Defaults to http://localhost:8000.

conf.token

The authentication token to use for requests.

query params

Query params for api methods can be provided directly in the options object for each api method:

auth.users.list({archived: true});

pagination

The result object contains next(), prev(), hasNext() and hasPrev() methods for traversing paginated results:

auth.users.list({
    page: 1,
    page_size: 2
  })
  .then(res => {
    // `true` if there is a next page, otherwise `false`
    console.log(res.hasNext());

    // `true` if there is a previous page, otherwise `false`
    console.log(res.hasPrev());

    return res
  })
  .then(res => res.next()) // next page (or `null` if there is no next page)
  .then(res => res.prev()); // prev page (or `null` if there is no prev page)

auth.user

auth.tokens

auth.passwords

auth.users

auth.organizations

auth.teams

Readme

Keywords

none

Package Sidebar

Install

npm i @praekelt/seed-auth

Weekly Downloads

1

Version

0.1.4

License

BSD-3-Clause

Last publish

Collaborators

  • praekeltdev