UNPKG

1.48 kBMarkdownView Raw
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
17npm install appfollow-api-js
18# or
19yarn 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
38Get a list of all collections:
39```
40import {makeSign, BASE_URL} from 'appfollow-api-js';
41
42const cid = 777;
43const apiSecret = 'appfollow';
44const endpoint = '/apps';
45const sign = makeSign({cid}, endpoint, apiSecret);
46const url = `${BASE_URL}${endpoint}?cid=${cid}&sign=${sign}`;
47```