UNPKG

2.14 kBMarkdownView Raw
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
6An API wrapper for utopian.rocks.
7
8# Installing
9
10Using npm:
11
12```cmd
13npm install node-utopian-rocks
14```
15
16
17# Usage
18
19First add it to your project
20
21```js
22// Using CommonJS modules
23const utopian = require('node-utopian-rocks');
24```
25
26For example retrieving posts by category and status ``Asynchronously``:
27
28```js
29await utopian.getPosts('development', 'reviewed')
30
31```
32
33or by using ``.then()`` method:
34
35```js
36utopian.getPosts('development', 'reviewed').then(posts => posts);
37```
38
39Or Let's run some tests:
40
41```
42npm 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
57These are the available parameters for making requests.
58
59We will start with posts ``object``:
60
61```js
62utopian.getPosts(category, status, author, moderator, staff_picks)
63```
64
65Any parameter can be ignored by empty string or just null
66
67```js
68utopian.getPosts(category, null, author, null, staff_picks)
69```
70
71For moderators ``object`` it should be called without any parameters.
72
73```js
74utopian.getModerators();
75```
76
77For 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 */
86utopian.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
96Feel free to create any [pull requests](https://github.com/gigatoride/node-utopian-rocks/compare).
97
98# Bugs
99
100If 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