sendpart

package
v3.0.0-...-04a954d Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func POST

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

POST sends a POST request using client to the given URL and unmarshal the body into v if it's not nil. It will only send using multipart if files is true.

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