npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bootic

v0.2.1

Published

Javascript client for the Bootic API

Downloads

6

Readme

Bootic JS API Client

Client for the Bootic API, written in pure Javascript, like real men do.

Usage

const bootic = require('bootic')

bootic
  .auth('bearer', { accessToken: 'aabbcc...xxyyzz' })
  .then(function(root) {
    return root.shops.first()
  })
  .then(function(shop) {
    return shop.orders.last()
  })
  .then(function(order) {
    console.log(order)
  })

Or for a more advanced example, let's say we want to hide all products contained in the 'Offers' collection.

bootic
  .auth({ clientId: '123abc...', clientSecret: 'zxy321...' }) // credentials strategy
  .then(function(root) {
    // both callback and promises are allowed.
    root.shops.first(function(shop) {
      console.log(`Processing ${shop.subdomain}`) // Entity attribute

      // follow `products` link, that returns a collection and iterate over items
      shop.products.where(collection: 'Offers').each(function(product) {

        // and call the `update` action
        product.update(status: 'hidden').then(function(res) {
          console.log(res)
        })
      })
    })

Install

npm install -g bootic (or yarn add)

Using the client

Starting from the root Element (initialized using the response from the API's rootUrl), an Element has attributes (strings, numbers, dates, etc), links, and embedded items (which can be either other Elements or Collections of Elements). Links can either return other Elements or Collections, as with embedded items, but they can also perform actions on the current Element in which case a success/error status is returned.

This client supports chaining methods from Elements and Collections until a method is finally called. This means that both Elements and Collections can either be Embedded (its contents are known, since the data has already been received), Linked (unknown contents, linked from the current Element) or even Virtual (when the caller isn't Embedded but Virtual, e.g. contact in shop.orders.first.contact).

Authentication

.auth(strategy, opts)

Initializes the client with the given options and strategy provided. strategy can be either bearer, credentials or authorized, or even skipped, in which case the strategy is deduced from the given credentials.

Options:

  • accessToken: Required for bearer and authorized strategies.
  • clientId: For credentials and authorized strategies.
  • clientSecret: Same as above.
  • rootUrl: To use an alternate endpoint for the API root.
  • strategy: Yes, you can also pass it as an option.

Examples

Check the examples directory contained in this repository.

Contributing

Just with silence for the time being. This is kind of experimental stuff so until the interface stabilizes a bit I won't accept any patches.

Copyright

(c) Tomas Pollak, Inventario SpA. Licensed under the Mozilla Public License (MPL).