rest

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var API = "https://discord.com/api/v10"

Functions

func Authorization

func Authorization(tok string) func(*http.Request)

func CodeBetween

func CodeBetween(resp *http.Response, BigOrEq int, LessOrEq int) error

func ContentType added in v0.7.0

func ContentType(contentType string) func(*http.Request)

func DoJSON added in v0.7.0

func DoJSON(c *http.Client, r *http.Request, v any) (*http.Response, error)

DoJSON executes a request and decodes the response into the given interface It already calls `Close()` on the body

func ExpectCode

func ExpectCode(resp *http.Response, expect int) error

func JSON

func JSON(r *http.Request)

func Multipart

func Multipart(r *http.Request)

func Verify added in v0.5.0

func Verify(publicKey string) func(http.Handler) http.Handler

Verify is a middleware to verify Interaction payloads

Types

type Request

type Request struct {
	// contains filtered or unexported fields
}

func Req

func Req(paths ...any) *Request

func (*Request) AnyBody

func (r *Request) AnyBody(body io.Reader) *Request

func (*Request) Append

func (r *Request) Append(v ...any) *Request

func (*Request) Delete

func (r *Request) Delete(opts ...func(*http.Request)) *http.Request

func (*Request) Get

func (r *Request) Get(opts ...func(*http.Request)) *http.Request

func (*Request) JSONBody

func (r *Request) JSONBody(v any) *Request

func (*Request) Patch added in v0.7.0

func (r *Request) Patch(opts ...func(*http.Request)) *http.Request

func (*Request) Post

func (r *Request) Post(opts ...func(*http.Request)) *http.Request

func (*Request) Put

func (r *Request) Put(opts ...func(*http.Request)) *http.Request

func (*Request) URL

func (r *Request) URL() string

Jump to

Keyboard shortcuts

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