@doocacommerce/anymarket-sdk
v1.0.0-beta.6
Published
SDK for Requests of Anymarket HUB
Downloads
40
Readme
SDK for Anymarket HUB
Documentation http://developers.anymarket.com.br/tools.html
Usage
$ sudo yarn add @doocacommerce/anymarket-sdk
or
$ sudo npm i @doocacommerce/anymarket-sdk
const anymartket = require('anymarket-sdk');
anymarket.configure({
mode: 'sandbox',
gumgaToken: '{gumgaToken}',
});
Sample
const anymartket = require('anymarket-sdk');
try {
const params = {}; // optional params
const getData = await anymarket.brands.get(params);
console.log('getData', getData);
} catch (err) {
console.log(err.toString());
}
Or getFirst
sample
const { brands } = require('anymarket-sdk');
try {
const id = 123;
const getData = await brands.getFirst(id);
console.log('getData', getData);
} catch (err) {
console.log(err.toString());
}
Development
Available methods of SDK request:
- brands / Marca
- categories / Categoria
- products / Produto
- skus / SKU
- variations / Tipos de variação
- variationsValues / Valores de variação
- stocks / Estoque
- images / Imagem
- orders / Pedido
- ordersFeed / Feed pedido
Brands
const { brands } = require('anymarket-sdk');
brands.create({ Object });
brands.get({ Object }); // params { limit:5, offset: 5 }
brands.getFirst(123);
brands.update(id, { Object });
brands.delete(123); // or { id: 123 }
Categories
const { categories } = require('anymarket-sdk');
categories.create({ Object });
categories.get({ Object }); // params { limit:5, offset: 5 }
categories.getFirst(123);
categories.getFullPath({ Object }); // get category tree { limit: 5, offset: 5 }
categories.update(id, { Object });
categories.delete(123); // or { id: 123 }
Products
const { products } = require('anymarket-sdk');
products.create({ Object });
products.get({ Object }); // params { limit:5, offset: 5 }
products.getFirst(123);
products.update(id, { Object });
Variations
const { variations } = require('anymarket-sdk');
variations.create({ Object });
variations.get({ Object }); // params { limit:5, offset: 5 }
variations.getFirst(123);
variations.update(id, { Object });
variations.delete(123); // or { id: 123 } - (productId as id)
Variations Values
const { variationsValues } = require('anymarket-sdk');
const variationId = 123;
variationsValues.create(variationId, { Object });
variationsValues.get({ Object }); // params { id: 123, limit:5, offset: 5 } - *required id of variation
variationsValues.getFirst(123); // get all values of variation group
variationsValues.update({ id: productId, valueId: skuId }, { Object });
variationsValues.delete({ id: productId, valueId: skuId });
SKUS
const { skus } = require('anymarket-sdk');
const productId = 123;
skus.create(productId, { Object });
skus.get({ Object }); // params { id: productId, limit:5, offset: 5 } *required id of product
skus.getFirst(productId); // get all skus of product
skus.update({ id: productId, skuId: skuId }, { Object });
Images
const { images } = require('anymarket-sdk');
const productId = 123;
images.create(productId, { Object });
images.get({ Object }); // params { limit:5, offset: 5 }
images.getFirst(productId); // get all images of product
images.delete({ id: productId, imageId: imageId });
Stocks
const { stocks } = require('anymarket-sdk');
stocks.update({Object}[]); // array of objects
Orders
const { orders } = require('anymarket-sdk');
orders.get();
orders.create({ Object });
orders.update(123, { Object });
orders.updateNfe(123, { Object });
Orders Feed
const { ordersFeed } = require('anymarket-sdk');
ordersFeed.get();
ordersFeed.update(123, { Object });