Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jayeshsolanki93/devgorant
Unofficial golang wrapper for the devrant API
https://github.com/jayeshsolanki93/devgorant
devgorant devrant golang golang-wrapper rant
Last synced: 3 months ago
JSON representation
Unofficial golang wrapper for the devrant API
- Host: GitHub
- URL: https://github.com/jayeshsolanki93/devgorant
- Owner: jayeshsolanki93
- License: mit
- Created: 2016-08-08T08:52:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-10T17:20:04.000Z (about 8 years ago)
- Last Synced: 2024-06-22T19:58:17.012Z (5 months ago)
- Topics: devgorant, devrant, golang, golang-wrapper, rant
- Language: Go
- Homepage: https://godoc.org/github.com/jayeshsolanki93/devgorant
- Size: 10.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-devrant - devGoRant - A Go wrapper for the devRant API (Uncategorized / Uncategorized)
README
# devgorant [![GoDoc](https://godoc.org/github.com/jayeshsolanki93/devgorant?status.svg)](https://godoc.org/github.com/jayeshsolanki93/devgorant) [![Build Status](https://travis-ci.org/jayeshsolanki93/devgorant.svg?branch=master)](https://travis-ci.org/jayeshsolanki93/devgorant)
Unofficial golang wrapper for the [devRant API](https://www.devrant.io/)
## Installation
```bash
go get github.com/jayeshsolanki93/devgorant
```## Usage
Simple implementation to get the user score(points):```go
package mainimport (
"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:**
```go
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:**
```go
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:**
```go
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:**
```go
devrant := devgorant.New()
rants, err := devrant.Search("golang")
```
---
### `Surprise` : Returns a random rant**Example:**
```go
devrant := devgorant.New()
rant, err := devrant.Surprise()
```
---
### `WeeklyRants` : Returns the rants tagged for 'weekly'**Example:**
```go
devrant := devgorant.New()
rants, err := devrant.WeeklyRants()
```
---## Tests
To run the tests locally:
```bash
go test -v
```## TODO
// TODO