Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rexlabs/wings-node-api-client

Package Overview
Dependencies
Maintainers
27
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rexlabs/wings-node-api-client

Wings Node Api Client

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
27
Weekly downloads
 
Created
Source

💸 Wings Node Api Client

Very basic API client for node environments to deal with the wings API. It is build on top of the node-fetch library.

Usage

const { create } = require('@rexlabs/wings-node-api-client')

const api = create({ baseUrl: 'http://wings.test/api/rex/' })
api.setAuthToken('xxx');

api('Listings::search', args).then(res => {
  console.log({ res })
});

The client instance (api in the example above) is an executable function in itself, which will trigger a post request to the given path. The second argument is an optional data object that will be used for the body, the third argument can be any options that will override the default options passed into the create call.

The client also comes with the following extra methods:

// Set a specific header field
api.setHeader(headerKey, headerValue);

// Shortcut for `.setHeader('Authorization', 'Bearer ...')`
api.setAuthToken(token);

// Set a specific option (after creating the instance, but storing it on the instance)
api.setOption(optionKey, optionValue);

// Set multiple options
api.setOptions({ optionKey: optionValue });

// Get all records for a specific service
// It will fetch pages of 100 items (in parallel) until all are loaded!
api.searchAll('Listings', args).then(res => {
  console.log({ res })
});

Development

Install dependencies

$ yarn

Available Commands

$ yarn test               # runs all units tests
$ yarn test:watch         # runs unit tests when files change

Copyright (c) 2018 Rex Software All Rights Reserved.

Keywords

FAQs

Package last updated on 11 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc