request-bin
v1.0.3
Published
Client for the RequestBin service
Downloads
2
Readme
Request Bin Client
Introduction
Request Bin is a pretty useful service (I've used it to test webhooks, for example) and it's API is relatively straight-forward, to boot!
Currently, there's a Request Bin client via the requestbin
NPM package, however, it has a callback-based API while this client is Promise
-based.
Installation
Install via the NPM package
npm install request-bin
API
createBin
- Creates a bin and returns a
Promise
containing bin details - Takes an optional
isPrivate
parameter - the default value isfalse
import { RequestBinClient } from 'request-bin';
// Prints public bin details
RequestBinClient.createBin().then(binDetails => console.log(binDetails));
// Prints private bin details
RequestBinClient.createBin(true).then(binDetails => console.log(binDetails));
getBin(binId)
- Returns a
Promise
containing bin details for a givenbinId
import { RequestBinClient } from 'request-bin';
const binId = 'someBinId';
// Prints bin's details
RequestBinClient.getBin(binId).then(binDetails => console.log(binDetails));
getRequests(binId)
- Returns a
Promise
containing for HTTP request details for a specific bin
import { RequestBinClient } from 'request-bin';
const binId = 'someBinId';
// Prints bin's requests details
RequestBinClient.getRequests(binId).then(requestsDetails => console.log(requestsDetails));
getRequest(binId, requestId)
- Returns a
Promise
containing details for a specific HTTP request made against a specific bin
import { RequestBinClient } from 'request-bin';
const binId = 'someBinId';
const requestId = 'someRequestId';
// Prints request details for a specific request in a bin
RequestBinClient.getRequest(binId, requestId).then(requestDetails => console.log(requestDetails));