1.0.7 • Published 7 years ago

bc-api-toolbox v1.0.7

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

BC-API-Toolbox

This is a toolbox to make dealing with the BigCommerce API a bit easier.

##How To Start

###Install Download From NPM

npm install --save bc-api-toolbox

###Using It

Import it

const Store = require('bc-api-toolbox');

Create a JavaScript Object with your Stores Hash, Client ID and Token.

const myStore = new Store(key,id,hash);

Make Requests

myStore.getAllProducts(products => {
    products.forEach(product => {
        console.log(product);
    });
});

##Why? While working with the BigCommerce API I started to notice a lot of the functions I had been declaring were repeating in every app. Thus the BC-API-Toolbox was born.

##What Does it Do? Essentially this is a wrapper for requests and reduces redundancy when dealing with the options object and responding to 429 Responses.

##API Reference

####.getTotalNumber(callback) #####Argumentsfunction(number)

myStore.getTotalNumber(numProducts => {
  console.log(numProducts);
});

####.getProductIds(callback) #####Argumentsfunction(array)

myStore.getProductIds(ids => {
  ids.forEach(id => {
    console.log(id);
  });
});

####.getAllProducts(callback) #####Argumentsfunction(array)

myStore.getAllProducts(products => {
  products.forEach(product => {
    console.log(product);
  });
});

####.getTotalOrders(callback) #####Argumentsfunction(number)

myStore.getTotalOrders(numOrders => {
  console.log(numOrders);
});

####.getAllOrders(callback) #####Argumentsfunction(array)

myStore.getAllOrders(orders => {
  orders.forEach(order => {
    console.log(order);
  });
});

####.getTotalCustomers(callback) #####Argumentsfunction(number)

myStore.getTotalCustomers(numCustomers => {
  console.log(numCustomers);
});

####.getAllCustomers(callback) #####Argumentsfunction(array)

myStore.getAllCustomers(customers => {
  customers.forEach(customer => {
    console.log(customer);
  });
});

####.getProductImageUrls(id, callback) #####ArgumentsproductID, function(array)

myStore.getProductImageUrls(24151, urls => {
  urls.forEach(url => {
    console.log(url);
  });
});

####.getAdminEmail(callback) #####Argumentsfunction(string)

myStore.getAdminEmail(email => {
  console.log(email);
});
1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago