1 | GroupBy Search API
|
2 | ========
|
3 |
|
4 | [![CircleCI](https://circleci.com/gh/groupby/api-javascript.svg?style=svg)](https://circleci.com/gh/groupby/api-javascript)
|
5 | [![Codecov](https://img.shields.io/codecov/c/github/groupby/api-javascript.svg)](https://codecov.io/gh/groupby/api-javascript)
|
6 |
|
7 | ![license](https://img.shields.io/github/license/groupby/api-javascript.svg)
|
8 | [![npm](https://img.shields.io/npm/dm/groupby-api.svg)](https://www.npmjs.com/package/groupby-api)
|
9 | [![npm](https://img.shields.io/npm/v/groupby-api.svg)](https://www.npmjs.com/package/groupby-api)
|
10 | [![Greenkeeper badge](https://badges.greenkeeper.io/groupby/api-javascript.svg)](https://greenkeeper.io/)
|
11 |
|
12 | Please follow the steps carefully to ensure a successful build.
|
13 |
|
14 | Before running the install steps, ensure `node` and `npm` are installed on your system.
|
15 |
|
16 | ### Install global dependencies:
|
17 |
|
18 | npm i -g gulp typings
|
19 |
|
20 | ### To install:
|
21 |
|
22 | npm i
|
23 |
|
24 | This will by default install the typings as well.
|
25 |
|
26 |
|
27 | ### To test:
|
28 |
|
29 | npm test
|
30 |
|
31 | This will install the project and run all tests.
|
32 |
|
33 |
|
34 | ### Add this library as a dependency to your project:
|
35 |
|
36 | #### NPM
|
37 |
|
38 | npm i --save groupby-api
|
39 |
|
40 | ### Examples
|
41 |
|
42 | #### Searching (typescript)
|
43 |
|
44 | ```javascript
|
45 | import { CloudBridge, Query, Results } from 'groupby-api';
|
46 |
|
47 | let bridge = new CloudBridge('<client-key>', '<customer-id>');
|
48 | let query = new Query('dvd');
|
49 | bridge.search(query)
|
50 | .then(results: Results => {
|
51 | // operate on results
|
52 | });
|
53 |
|
54 | // OR
|
55 |
|
56 | bridge.search(query, results: Results => {
|
57 | // operate on results
|
58 | });
|
59 | ```
|
60 |
|
61 | #### Searching (ES5/CommonJS)
|
62 |
|
63 | ```javascript
|
64 | var groupby = require('groupby-api');
|
65 | var CloudBridge = groupby.CloudBridge,
|
66 | Query = groupby.Query,
|
67 | Results = groupby.Results;
|
68 |
|
69 | var bridge = new CloudBridge('<client-key>', '<customer-id>');
|
70 | var query = new Query('dvd');
|
71 | bridge.search(query)
|
72 | .then(function(results) {
|
73 | // operate on results
|
74 | });
|
75 |
|
76 | // OR
|
77 |
|
78 | bridge.search(query, function(results) {
|
79 | // operate on results
|
80 | });
|
81 | ```
|