1 | # node-utopian-rocks
|
2 |
|
3 | [![GitHub license](https://img.shields.io/github/license/gigatoride/node-utopian-rocks.svg)](https://github.com/gigatoride/node-utopian-rocks/blob/master/LICENSE)
|
4 | ![GitHub license](https://img.shields.io/badge/powered%20by-utopian.io-ff69b4.svg)
|
5 |
|
6 | An API wrapper for utopian.rocks.
|
7 |
|
8 | # Installing
|
9 |
|
10 | Using npm:
|
11 |
|
12 | ```cmd
|
13 | npm install node-utopian-rocks
|
14 | ```
|
15 |
|
16 |
|
17 | # Usage
|
18 |
|
19 | First add it to your project
|
20 |
|
21 | ```js
|
22 | // Using CommonJS modules
|
23 | const utopian = require('node-utopian-rocks');
|
24 | ```
|
25 |
|
26 | For example retrieving posts by category and status ``Asynchronously``:
|
27 |
|
28 | ```js
|
29 | await utopian.getPosts('development', 'reviewed')
|
30 |
|
31 | ```
|
32 |
|
33 | or by using ``.then()`` method:
|
34 |
|
35 | ```js
|
36 | utopian.getPosts('development', 'reviewed').then(posts => posts);
|
37 | ```
|
38 |
|
39 | Or Let's run some tests:
|
40 |
|
41 | ```
|
42 | npm test
|
43 | ```
|
44 |
|
45 | # API
|
46 |
|
47 | ## Request method aliases
|
48 |
|
49 | `` utopian.getPosts(params) ``
|
50 |
|
51 | `` utopian.getModerators() ``
|
52 |
|
53 | `` utopian.getStats(params) ``
|
54 |
|
55 |
|
56 | ## Request parameters
|
57 | These are the available parameters for making requests.
|
58 |
|
59 | We will start with posts ``object``:
|
60 |
|
61 | ```js
|
62 | utopian.getPosts(category, status, author, moderator, staff_picks)
|
63 | ```
|
64 |
|
65 | Any parameter can be ignored by empty string or just null
|
66 |
|
67 | ```js
|
68 | utopian.getPosts(category, null, author, null, staff_picks)
|
69 | ```
|
70 |
|
71 | For moderators ``object`` it should be called without any parameters.
|
72 |
|
73 | ```js
|
74 | utopian.getModerators();
|
75 | ```
|
76 |
|
77 | For Statistics
|
78 |
|
79 | ```js
|
80 | /**
|
81 | * you can use a specificDate like 2018-05-24 or today, weekly.
|
82 | * Those are the available sections for stats:
|
83 | * moderators, categories, projects, staff_picks, task_requests
|
84 | * any thing else will retrieve all sections.
|
85 | */
|
86 | utopian.getStats(specificDate, section);
|
87 | ```
|
88 |
|
89 | # Roadmap
|
90 |
|
91 | - Adding any upcoming API calls that will be available on https://utopian.rocks
|
92 | - More improvements and more advanced options, configs.
|
93 |
|
94 | # Contributing
|
95 |
|
96 | Feel free to create any [pull requests](https://github.com/gigatoride/node-utopian-rocks/compare).
|
97 |
|
98 | # Bugs
|
99 |
|
100 | If there is any bug please report it by opening a [new issue](https://github.com/gigatoride/node-utopian-rocks/issues/new). |
\ | No newline at end of file |