All Projects → danillouz → Devrant

danillouz / Devrant

Licence: apache-2.0
Unofficial wrapper for the public devRant API.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Devrant

Pyowm
A Python wrapper around the OpenWeatherMap web API
Stars: ✭ 654 (+1262.5%)
Mutual labels:  api, api-client
Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (-64.58%)
Mutual labels:  api, api-client
Unifi Api Browser
Tool to browse data exposed by Ubiquiti's UniFi Controller API (demo: https://api-browser-demo.artofwifi.net/)
Stars: ✭ 677 (+1310.42%)
Mutual labels:  api, api-client
Datafire
A framework for building integrations and APIs
Stars: ✭ 487 (+914.58%)
Mutual labels:  api, api-client
Genius Php
PHP library for Genius API (http://genius.com/developers)
Stars: ✭ 10 (-79.17%)
Mutual labels:  api, api-client
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (+1154.17%)
Mutual labels:  api, api-client
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+1558.33%)
Mutual labels:  api, api-client
Hubspot Php
HubSpot PHP API Client
Stars: ✭ 273 (+468.75%)
Mutual labels:  api, api-client
Abclinuxuapi
API for http://abclinuxu.cz.
Stars: ✭ 8 (-83.33%)
Mutual labels:  api, api-client
Cortex4py
Python API Client for Cortex
Stars: ✭ 22 (-54.17%)
Mutual labels:  api, api-client
Node Vault
Client for HashiCorp's Vault
Stars: ✭ 391 (+714.58%)
Mutual labels:  api, api-client
Hoppscotch
👽 Open source API development ecosystem https://hoppscotch.io
Stars: ✭ 34,569 (+71918.75%)
Mutual labels:  api, api-client
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (+645.83%)
Mutual labels:  api, api-client
Client
DigitalOcean API v2 client for PHP
Stars: ✭ 604 (+1158.33%)
Mutual labels:  api, api-client
Insomnia
The open-source, cross-platform API client for GraphQL, REST, and gRPC.
Stars: ✭ 18,969 (+39418.75%)
Mutual labels:  api, api-client
Client
GitLab API v4 client for PHP
Stars: ✭ 763 (+1489.58%)
Mutual labels:  api, api-client
Pymisp
Python library using the MISP Rest API
Stars: ✭ 254 (+429.17%)
Mutual labels:  api, api-client
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+5947.92%)
Mutual labels:  api, api-client
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+1781.25%)
Mutual labels:  api, api-client
Hashapi Lib Node
Tierion Hash API client library for Node.js
Stars: ✭ 20 (-58.33%)
Mutual labels:  api, api-client

devRant

NPM Version Build Status

Unofficial wrapper for the public devRant API.

devRant

Requirements

You need node version 6 or greater.

Installation

npm i -S devrant

Interface

This module exposes methods to fetch rants (posts) from devRant and to fetch the profile of a devRant user by username.

devRant Display Requirements

When displaying the contents of a rant fetched from the devRant API, it is required to credit the author of a rant by displaying their devRant username.

Syntax

devRant
  .rants()
  .then()
  .catch();

Methods

After requiring the module, the following methods can be used:

METHOD ARGUMENTS RETURNS DESCRIPTION
rant Yes Promise Retrieve a single rant from devRant. Use this method to retrieve a rant with its full text and comments. The retrieved rant is a Full Rant Object.
rants Optional Promise Retrieve rants from devRant. The retrieved rants are Simple Rant Objects.
search Yes Promise Retrieve rants from devRant that match a specific search term. The retrieved rants are Simple Rant Objects.
profile Yes Promise Retrieve the profile of a devRant user by username. The retrieved profile is a Profile Object.

.rant(id)

Retrieve a single rant from devRant. Use this method to retrieve a rant with its full text and comments.

The retrieved rant is a Full Rant Object.

Arguments
NAME TYPE DESCRIPTION
id Number The rant id. For example 43511.
Returns

Promise.

.rants(options)

Retrieve rants from devRant.

By providing an options Object as an argument, it's possible to sort by algo, recent and top rants. As well as limiting and skipping the amount of rants to be fetched.

The retrieved rants are Simple Rant Objects.

Arguments
NAME TYPE DESCRIPTION
options Object Optional. The options to control the rants to be fetched. When omitted, 50 rants of type algo will be fetched and 0 rants will be skipped.
Options
OPTIONS KEY TYPE DESCRIPTION
sort String Optional. The type of rants to be fetched. Must be algo, recent or top. When omitted, it defaults to algo.
limit Number Optional. The amount of rants to be fetched. When omitted, it defaults to 50.
skip Number Optional. The amount of rants to be skipped. When omitted, it defaults to 0.
Returns

Promise.

.search(term)

Retrieve rants from devRant that match a specific search term.

The retrieved rants are Simple Rant Objects.

Arguments
NAME TYPE DESCRIPTION
term String The search term used to match specific rants. For example javascript, xcode, wk2, devrant, etc.
Returns

Promise.

.profile(username)

Retrieve the profile of a devRant user by username.

The retrieved profile is a Profile Object.

Arguments
NAME TYPE DESCRIPTION
username String The devRant username. For example danillouz, dfox, localhost, etc.
Returns

Promise.

Rant Object Simple

{
  "id": 43511,
  "text": "when people think you know everything...",
  "num_upvotes": 38,
  "num_downvotes": 1,
  "score": 37,
  "created_time": 1464610498,
  "attached_image": {
    "url": "https://d1fvlyhrbsf219.cloudfront.net/devrant/rant/r_43511_uQDW4.jpg",
    "width": 600,
    "height": 300
  },
  "num_comments": 5,
  "tags": [ ],
  "vote_state": 0,
  "user_id": 15601,
  "user_username": "Mung00se",
  "user_score": 272
}

Rant Object Full

{
  "rant": {
    "id": 43511,
    "text": "when people think you know everything...",
    "num_upvotes": 39,
    "num_downvotes": 1,
    "score": 38,
    "created_time": 1464610498,
    "attached_image": {
      "url": "https://d1fvlyhrbsf219.cloudfront.net/devrant/rant/r_43511_uQDW4.jpg",
      "width": 600,
      "height": 300
    },
    "num_comments": 5,
    "tags": [ ],
    "vote_state": 0,
    "user_id": 15601,
    "user_username": "Mung00se",
    "user_score": 273
  },
  "comments": [
    {
      "id": 43529,
      "rant_id": 43511,
      "body": "But at some point we all do it.",
      "num_upvotes": 2,
      "num_downvotes": 0,
      "score": 2,
      "created_time": 1464611516,
      "vote_state": 0,
      "user_id": 505,
      "user_username": "Jumpshot44",
      "user_score": 2233
    }
  ],
  "success": true
}

Profile Object

{
  "username": "danillouz",
  "score": 207,
  "about": "I spend too much time tweaking my terminal and color schemes..",
  "location": "The Netherlands",
  "created_time": 1463432703,
  "skills": "Node.js, JavaScript, mongoDB, GraphQL, ObjectiveC, Go",
  "github": "danillouz",
  "content": {
    "content": {
      "rants": [
        {
          "id": 38898,
          "text": "Me and my team are working on a system where we depend on a component that was built by a different dev team and hasn't been integration tested yet, because it's that new. This is how it's going..",
          "num_upvotes": 35,
          "num_downvotes": 0,
          "score": 35,
          "created_time": 1464211080,
          "attached_image": {
            "url": "https://d1fvlyhrbsf219.cloudfront.net/devrant/rant/r_38898_Z93E9.gif",
            "width": 380,
            "height": 230
          },
          "num_comments": 2,
          "tags": [
            "teams",
            "integration-testing",
            "dependencies"
          ],
          "vote_state": 0,
          "user_id": 27942,
          "user_username": "danillouz",
          "user_score": 207
        }
      ],
      "upvoted": [
        {
          "id": 42586,
          "text": "My office desk",
          "num_upvotes": 65,
          "num_downvotes": 0,
          "score": 65,
          "created_time": 1464530939,
          "attached_image": {
            "url": "https://d1fvlyhrbsf219.cloudfront.net/devrant/rant/r_42586_9jWtu.jpg",
            "width": 800,
            "height": 600
          },
          "num_comments": 18,
          "tags": [
            "mydesk"
          ],
          "vote_state": 0,
          "user_id": 13541,
          "user_username": "dvlpr",
          "user_score": 104
        }
      ],
      "comments": [
        {
          "id": 41422,
          "rant_id": 41065,
          "body": "@xroad Hodor",
          "num_upvotes": 3,
          "num_downvotes": 0,
          "score": 3,
          "created_time": 1464425475,
          "vote_state": 0,
          "user_id": 27942,
          "user_username": "danillouz",
          "user_score": 207
        }
      ]
    },
    "counts": {
      "rants": 5,
      "upvoted": 37,
      "comments": 16
    }
  }
}

Examples

Fetch rant with id 43511

'use strict';

const devRant = require('devrant');

devRant
  .rant(43511)
  .then(function receiveRant(rant) {
    console.log('rant: ', rant);
  })
  .catch(function errorHandler(err) {
    console.log('err: ', err.message);
  });

Fetch 10 rants of type top and skip the first 10

const devRant = require('devrant');

devRant
  .rants({
	sort: 'top',
	limit: 10,
	skip: 10
  })
  .then(function receiveRants(rants) {
    console.log('rants: ', rants);
  })
  .catch(function errorHandler(err) {
    console.log('err: ', err.message);
  });

Fetch 50 rants of type algo and skip 0 by using default behavior

'use strict';

const devRant = require('devrant');
const co = require('co');

function algoRants() {
  return co(function *fetchRants() {	  
    const rants = yield devRant.rants();

    console.log(`rants: ${rants}`);
  });
}

algoRants();

Fetch all rants that match the search term javascript

'use strict';

const devRant = require('devrant');
const co = require('co');

function search(term) {
  return co(function *searchRants() {	  
    const rants = yield devRant.search(term);

    console.log(`rants: ${rants}`);
  });
}

search('javascript');

Fetch the profile of the devRant user with username dfox

'use strict';

const devRant = require('devrant');
const co = require('co');

function getProfile(username) {
  return co(function *fetchProfile() {	  
    const profile = yield devRant.profile(username);

    console.log(`profile: ${profile}`);
  });
}

getProfile('dfox');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].