1 | # AppFollow API js
|
2 | <p>
|
3 | <a href="https://www.npmjs.com/package/appfollow-api-js">
|
4 | <img src="https://img.shields.io/npm/v/appfollow-api-js.svg?style=flat-square" alt="version">
|
5 | </a>
|
6 | <a href="https://github.com/AppFollow/appfollow-api-js/blob/master/LICENSE">
|
7 | <img src="https://img.shields.io/npm/l/appfollow-api-js.svg?style=flat-square" alt="ISC license">
|
8 | </a>
|
9 | <a href="http://npmcharts.com/compare/appfollow-api-js">
|
10 | <img src="https://img.shields.io/npm/dm/appfollow-api-js.svg?style=flat-square" alt="downloads">
|
11 | </a>
|
12 | </p>
|
13 |
|
14 | ## Install
|
15 |
|
16 | ```sh
|
17 | npm install appfollow-api-js
|
18 | # or
|
19 | yarn add appfollow-api-js
|
20 | ```
|
21 |
|
22 | ###### Download
|
23 |
|
24 | - [Minified](https://cdn.jsdelivr.net/npm/appfollow-api-js/dist/api-sign.min.js)
|
25 |
|
26 | ###### CDN
|
27 |
|
28 | - [jsDelivr](https://www.jsdelivr.com/package/npm/appfollow-api-js)
|
29 | - [unpkg](https://unpkg.com/appfollow-api-js/)
|
30 |
|
31 | ## Functions and parameters
|
32 | * `BASE_URL`: API url
|
33 | * `sortObject(obj)`: The function of sorting the properties of the object in alphabetical order
|
34 | * `sign(message)`: Function for hashing a string
|
35 | * `makeSign(params, endpoint, apiSecret)`: Function for get a signature, parameters: object of params, end point, api secret
|
36 |
|
37 | ## Example
|
38 | Get a list of all collections:
|
39 | ```
|
40 | import {makeSign, BASE_URL} from 'appfollow-api-js';
|
41 |
|
42 | const cid = 777;
|
43 | const apiSecret = 'appfollow';
|
44 | const endpoint = '/apps';
|
45 | const sign = makeSign({cid}, endpoint, apiSecret);
|
46 | const url = `${BASE_URL}${endpoint}?cid=${cid}&sign=${sign}`;
|
47 | ```
|