Unofficial golang wrapper for the devRant API
go get github.com/jayeshsolanki93/devgorant
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)
}
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)
Parameters:
| Name | Type | Description | Default |
| ---- | ---- | -------- | ----------- | ------- |
| rantId
| integer | rant_id of a posted rant | |
Example:
devrant := devgorant.New()
rant, comments, err := devrant.Rant(27317)
Parameters:
| Name | Type | Description | Default |
| ---- | ---- | -------- | ----------- | ------- |
| username
| string | a valid username on devRant | |
Example:
devrant := devgorant.New()
user, content, err := devrant.Profile("jayeshs")
Parameters:
| Name | Type | Description | Default |
| ---- | ---- | -------- | ----------- | ------- |
| term
| string | any string to use as the search term | |
Example:
devrant := devgorant.New()
rants, err := devrant.Search("golang")
Example:
devrant := devgorant.New()
rant, err := devrant.Surprise()
Example:
devrant := devgorant.New()
rants, err := devrant.WeeklyRants()
To run the tests locally:
go test -v
// TODO