payrex-js-sdk-base

1.2.2 • Public • Published

PAYREX-JS-SDK-BASE

Build Status codecov

Base class for Payrex JS SDK. Don't use this repo directly, you should use payrex/js-sdk-node instead.

Install

npm install --save payrex-js-sdk-base

Usage

const PayrexSdkBase = require('payrex-js-sdk-base');

const options = {/* ... options ... */};
const sdkBase = new PayrexSdkBase(options);
Option Type Usage Description
credentials string optional API secret key
baseUrl string optional API base url (default "http://localhost:3000/")
fetch function required Fetch function
Headers function required Fetch Headers
Url object required Url class

get(path, [options])

Make HTTP-GET request to API.

Param Type Description
path string Path (ex. "/users" or "/users/1")
options object Options
options.queryParams object Additional query params to merge
sdkBase
  .get('/users?status=ACTIVE')
  .then(response => { /* ... */})
  .catch(err => {/* Process error */})

post(path, body, [options])

Make HTTP-POST request to API.

Param Type Description
path string Path (ex. "/users" or "/users/1")
body object Body data
options object Options
options.queryParams object Additional query params to merge
sdkBase
  .post('/users', {
    name: 'John Doe',
    status: 'ACTIVE'
  })
  .then(response => { /* ... */})
  .catch(err => {/* Process error */})

put(path, body, [options])

Make HTTP-PUT request to API.

Param Type Description
path string Path (ex. "/users" or "/users/1")
body object Body data
options object Options
options.queryParams object Additional query params to merge
sdkBase
  .put('/users', {
    name: 'Johnny Doe'
  })
  .then(response => { /* ... */})
  .catch(err => {/* Process error */})

remove(path, [options])

Make HTTP-DELETE request to API.

Param Type Description
path string Path (ex. "/users" or "/users/1")
options object Options
options.queryParams object Additional query params to merge
sdkBase
  .remove('/users/1')
  .then(response => { /* ... */})
  .catch(err => {/* Process error */})

Readme

Keywords

none

Package Sidebar

Install

npm i payrex-js-sdk-base

Weekly Downloads

14

Version

1.2.2

License

MIT

Unpacked Size

42.4 kB

Total Files

13

Last publish

Collaborators

  • devprex