sendpart

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(c *httputil.Client, method string, data DataMultipartWriter, v interface{}, url string) error

Do sends an HTTP request using client to the given URL and unmarshals the body into v if it's not nil. It will only send using multipart if needed.

func PATCH

func PATCH(c *httputil.Client, data DataMultipartWriter, v interface{}, url string) error

PATCH sends a PATCH request using client to the given URL and unmarshals the body into v if it's not nil. It will only send using multipart if needed. It is equivalent to calling Do with "PATCH"

func POST

func POST(c *httputil.Client, data DataMultipartWriter, v interface{}, url string) error

PATCH sends a PATCH request using client to the given URL and unmarshals the body into v if it's not nil. It will only send using multipart if needed. It is equivalent to calling Do with "POST"

func Write

func Write(body *multipart.Writer, item interface{}, files []File) error

Write writes the item into payload_json and the list of files into the multipart writer. Write does not close the body.

Types

type DataMultipartWriter

type DataMultipartWriter interface {
	// NeedsMultipart returns true if the data interface must be sent using
	// multipart form.
	NeedsMultipart() bool

	httputil.MultipartWriter
}

DataMultipartWriter is a MultipartWriter that also contains data that's JSON-marshalable.

type File

type File struct {
	Name   string
	Reader io.Reader
}

File represents a file to be uploaded to Discord.

func (File) AttachmentURI

func (f File) AttachmentURI() string

AttachmentURI returns the file encoded using the attachment URI required for embedding an attachment image.

Jump to

Keyboard shortcuts

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