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

sg-stores-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sg-stores-sdk

An SDK for Salling Group's Stores API

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Salling Group Stores SDK

This SDK simplifies the process of querying Salling Group's stores. Salling Group owns Netto, Føtex, Bilka, Salling, and more. Through this SDK you will be able to find the name, opening hours, address, and more of stores. The requests are made through the Salling Group API which can be found here.

You will need the module sg-base-sdk in order to authenticate. You can get your credentials through the developer portal.

Getting Started.

The following example gets names of all Netto stores in the ZIP code 8200. You will need to get a JWT secret or Bearer token with access to the Stores API from the developer portal.

const { SallingGroupAPI } = require('sg-base-sdk');
const StoresSDK = require('sg-stores-sdk');
const instance = new StoresSDK(SallingGroupAPI.bearer('my_token'));

const traverser = instance.beginQuery()
    .ofBrand('netto')
    .inZIP(8200)
    .pick('name')
    .execute();

traverser.get().then((page) => console.log(page));

This prints:

[
  { "name": "Netto Storcenter Nord" },
  { "name": "Netto Randersvej Århus" }
]

Documentation

constructor(api)

This initializes a new Stores SDK object. api must be an instance returned by sg-base-sdk.

Example:

const { SallingGroupAPI } = require('sg-base-sdk');
const StoresSDK = require('sg-stores-sdk');
const instance = new StoresSDK(SallingGroupAPI.jwt('my_email', 'my_key'));

get(storeID)

This gets the store with the given ID.

Example:

const storeData = await instance.get('b20359e6-194d-4a33-8dcb-05b01afa93c4');

getAll()

This gets all stores.

Example:

const traverser = instance.getAll();
const page = await traverser.get();

beginQuery()

This begins a query for stores. This should be followed by a chain of these commands:

MethodDescriptionExample
pick(field1, field2, ...)Only returns the given fields..pick('id', 'name')
ofBrand(brand)Returns stores from the given brand..ofBrand('netto')
inCity(city)Returns stores in the given city..inCity('Risskov')
inZIP(zip)Returns stores in the given ZIP..inZIP(8200)
nearCoordinate(long, lat, radius)Returns stores in the given radius (in kilometers) around the coordinates..nearCoordinate(56.18,10.20,0.5)

The chain should be ended with .execute(). This will return a Traverser for the query.

Example:

const traverser = instance.beginQuery()
    .ofBrand('netto')
    .inZIP(8200)
    .pick('name', 'id')
    .execute();
// This will return name and ID of Netto stores in the ZIP code 8200.
const page = await traverser.get();

query(params = {})

This queries the Stores API directly and returns a Traverser. params is the search parameters. This is mostly used internally.

FAQs

Package last updated on 24 Jul 2018

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