Coder Social home page Coder Social logo

wm-pricer's Introduction

wm-pricer npm version js-standard-style

An inelegant helper for checking brickseek for Walmart inventory based on a query to Walmart API.

install

npm i wm-pricer

programmatic usage

Only one function exported with signature (opts, callback). Callback will be invoked with (err, data) with data being an array of item objects.

The api limits to 25 results each time. So the start arg allows pagination (i.e. for page 2 start at 26).

Provide API key (required)

const WmPricerApi = require('wm-pricer').api
const secrets = require('./secrets.json')
const opts = {zip: 33803, query: '4k tv', start: 1}

const main = async () => {
  let data = await new Promise((resolve, reject) => {
    let wmp = WmPricerApi.new(secrets.apiKey)
    wmp.on('error', reject)
    wmp.once('store-query-done', resolve)
    wmp.storeQuery(opts)
  })
}

cli usage

npm i -g wm-pricer

wmp -h

or

WM-Pricer
===========
usage:
  wmp [options]
  wmp [zip] query

options:
  -r, --remember  Store options (i.e. store apiKey / zip for future calls)
  -k, --apiKey    Required to be set either when called or stored for subsequent calls
  -q, --query     Search terms (use double quotes if query contains whitespace)
  -z, --zip       Zip code to search within (50 mile radius)
  -l, --limit     Number of results to return (up to 25, limited by WM API)
  -s, --start     Result to start at, for pagination
  -d, --diff      In store price difference threshold
    (i.e. only show results with X percent lower price in store than online)

To store apiKey and optionally zip
  ~ wmp -r -k xyz123 -z 33803

If apiKey is stored and no other options supplied you can call with
  ~ wmp zip query

If apiKey and zip is stored and no other options supplied you can call with
  ~ wmp query

wm-pricer's People

Contributors

doesdev avatar vkana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.