Giter Club home page Giter Club logo

devgorant's Introduction

devgorant GoDoc Build Status

Unofficial golang wrapper for the devRant API

Installation

go get github.com/jayeshsolanki93/devgorant

Usage

Simple implementation to get the user score(points):

package main

import (
  "fmt"
  "github.com/jayeshsolanki93/devgorant"
  "log"
)

func main() {
  devrant := devgorant.New()
  user, _, err := devrant.Profile("jayeshs")
  if err != nil {
    log.Fatal(err)
  }
  fmt.Println(user.Score)
}

API Reference

Rants : Fetches rants

Parameters:

| Name | Type | Description | Default | | ---- | ---- | -------- | ----------- | ------- | | sort | string | Sort by algo, top, recent | algo | | limit | integer | Number of rants required. Cannot be more than 50. | 50 | | skip | integer | Number of rants to skip. | 0 |

Example:

devrant := devgorant.New()
rants, err := devrant.Rants("algo", 20, 0)

Rant : Fetches a rant and its comments given a valid rant id

Parameters:

| Name | Type | Description | Default | | ---- | ---- | -------- | ----------- | ------- | | rantId | integer | rant_id of a posted rant | |

Example:

devrant := devgorant.New()
rant, comments, err := devrant.Rant(27317)

Profile : Fetches ranter's profile data

Parameters:

| Name | Type | Description | Default | | ---- | ---- | -------- | ----------- | ------- | | username | string | a valid username on devRant | |

Example:

devrant := devgorant.New()
user, content, err := devrant.Profile("jayeshs")

Search : Search for rants matching the search term

Parameters:

| Name | Type | Description | Default | | ---- | ---- | -------- | ----------- | ------- | | term | string | any string to use as the search term | |

Example:

devrant := devgorant.New()
rants, err := devrant.Search("golang")

Surprise : Returns a random rant

Example:

devrant := devgorant.New()
rant, err := devrant.Surprise()

WeeklyRants : Returns the rants tagged for 'weekly'

Example:

devrant := devgorant.New()
rants, err := devrant.WeeklyRants()

Tests

To run the tests locally:

go test -v 

TODO

// TODO

devgorant's People

Contributors

jayeshsolanki93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

devgorant's Issues

Authenticating and publishing Rants

Hi!

Are there any plans to add authentication/login and ability to publish rants (Assuming the devRant API supports this)? I also wouldn't mind working on and sending a PR for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.