http

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 9 Imported by: 0

README

HTTP

This is the currently unnamed Discord HTTP API wrapper package that is used in several of Streamcord's microservices.

The package features automatic ratelimit handling to prevent 429s and uses structs to represent objects such as embeds in a friendly format.

While the package itself does not directly interact with Streamcord's Redis cache, it is designed to be fully compatible with it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient http.Client
	Token      string // This should also include the token's prefix, e.g. "Bot <token>"
	URL        string // This is the URL of the API
}

func NewClient

func NewClient(timeout time.Duration, token string) (*Client, error)

func (*Client) AddRole

func (c *Client) AddRole(gID string, uID string, rID string) (*http.Response, error)

func (*Client) MakeRequest

func (c *Client) MakeRequest(r objects.Request) (*http.Response, error)

func (*Client) RemoveRole

func (c *Client) RemoveRole(gID string, uID string, rID string) (*http.Response, error)

func (*Client) SendMessage

func (c *Client) SendMessage(cID string, payload payloads.SendMessage) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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