Skip to content

payrex/js-sdk-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 */})

About

Payrex Javascript SDK Base class

Resources

Stars

Watchers

Forks

Packages

No packages published