ripple

package module
v0.0.0-...-9dcbf9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 5 Imported by: 4

README

ripple GoDoc build status

go library for the Ripple API.

Documentation

Overview

Package ripple provides a Go library to access the Ripple API.

Index

Constants

View Source
const Self = 0

Self is a special ID used to refer to the user making the request. The Ripple API has a common pattern throughout the requests related to users: you can refer to an user either by their username, by passing the querystring parameter `name`, their user ID, by passing `id`, or reference the user making to the request, case in which you would set `id` to `self`. Instead of having three methods for each request, this package will understand all function calls having id of the user == 0 to reference "self".

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Instance string
	Token    string
	IsBearer bool
	Client   *http.Client
}

Client contains the options for the API which will be sent with each request. By default, the instance is located at https://api.ripple.moe and requests are made without a token (so function as read-only). If Client.Client is not set, http.DefaultClient will be used.

func (*Client) User

func (c *Client) User(id int) (*User, error)

User returns an user knowing their ID. May return nil for the user if the user could not be found.

type StatusError

type StatusError struct {
	Code     int
	Response *http.Response
}

StatusError is returned by requests made from Client when the code is not in the 2XX series.

func (*StatusError) Error

func (s *StatusError) Error() string

Error will attempt to decode the message from the Response, and will otherwise return a generic error stating the status code.

type User

type User struct {
	ID             int       `json:"id"`
	Username       string    `json:"username"`
	UsernameAKA    string    `json:"username_aka"`
	RegisteredOn   time.Time `json:"registered_on"`
	Privileges     uint64    `json:"privileges"`
	LatestActivity time.Time `json:"latest_activity"`
	Country        string    `json:"country"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL