0.1.0 • Published 3 years ago

shutter-sdk-js v0.1.0

Weekly downloads
14
License
MIT
Repository
-
Last release
3 years ago

SHUTTER SDK JS

License Version NPM

A javascript sdk for Shutter built with webpack, babel & es6. This can be used in node or in the browser*.

NOTE: If used in the browser do not publish your private api key in frontend code.


Install

  • Requires node.js >= 14.x
npm i shutter-sdk-js

Setup Client

Next, require the module and instantiate a shutter client by calling new Shutter.client and setup the client with basic auth credentials (email: 'example@mail.com', password: 'your_pass_here'). Also need an api url provided by shutter team.

import Shutter from 'shutter-sdk-js';


const shutter = new Shutter.client({
  email: "example@mail.com",
  password: "your_pass_here",
  uri: "example.shutter.com"
});

Methods

The following service methods are available to instantiated clients. The examples assume you have already created a shutter client as shutter with valid credentials.

Method naming conventions:

  • get or get{{Item}} - expected response for client is a single object
  • list or list{{Items}} - expected response for client is a list of objects
  • create or create{{Item}} - expected response for client is a single object
  • update or update{{Item}} - expected response is an object with a status message
  • delete or delete{{Item}} - expected response is an object with a status message

users

create

shutter.users.create({user})

Example:

try {
  const createdUser = await shutter.users.create({
    name: "test",
    email: "test@shutter.com"
  });
  console.log(createdUser) // logs response data
} catch (err) {
  console.log(err); // logs any error
}

Promise Returns:

{
  id: '609ab5190ae391f4e90d10f1',
  name: 'test',
  email: "test@shutter.com"
}

Options:

ParameterDescription
nameName of the user.
emailEmail address of the user. Example: "Jhon jhon@host.com".
0.1.0

3 years ago

1.3.3-alpha

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago