gensupport

package
Version: v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gensupport is an internal implementation detail used by code generated by the google-api-go-generator tool.

This package may be modified at any time without regard for backwards compatibility. It should not be used directly by API users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectMediaType

func DetectMediaType(media io.ReaderAt) string

DetectMediaType detects and returns the content type of the provided media. If the type can not be determined, "application/octet-stream" is returned.

func IncludeMedia

func IncludeMedia(media io.Reader, bodyp *io.Reader, ctypep *string) func()

IncludeMedia combines an existing HTTP body with media content to create a multipart/related HTTP body.

bodyp is an in/out parameter. It should initially point to the reader of the application/json (or whatever) payload to send in the API request. It's updated to point to the multipart body reader.

ctypep is an in/out parameter. It should initially point to the content type of the bodyp, usually "application/json". It's updated to the "multipart/related" content type, with random boundary.

The return value is a function that can be used to close the bodyp Reader with an error.

func MarshalJSON

func MarshalJSON(schema interface{}, forceSendFields []string) ([]byte, error)

MarshalJSON returns a JSON encoding of schema containing only selected fields. A field is selected if:

* it has a non-empty value, or
  * its field name is present in forceSendFields, and
  * it is not a nil pointer or nil interface.

The JSON key for each selected field is taken from the field's json: struct tag.

Types

type ContentSniffer

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

ContentSniffer wraps a Reader, and reports the content type determined by sniffing up to 512 bytes from the Reader.

func NewContentSniffer

func NewContentSniffer(r io.Reader) *ContentSniffer

func (*ContentSniffer) ContentType

func (sct *ContentSniffer) ContentType() (string, bool)

ContentType returns the sniffed content type, and whether the content type was succesfully sniffed.

func (*ContentSniffer) Read

func (sct *ContentSniffer) Read(p []byte) (n int, err error)

type URLParams

type URLParams map[string][]string

URLParams is a simplified replacement for url.Values that safely builds up URL parameters for encoding.

func (URLParams) Encode

func (u URLParams) Encode() string

Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key.

func (URLParams) Set

func (u URLParams) Set(key, value string)

Set sets the key to value. It replaces any existing values.

func (URLParams) SetMulti

func (u URLParams) SetMulti(key string, values []string)

SetMulti sets the key to an array of values. It replaces any existing values. Note that values must not be modified after calling SetMulti so the caller is responsible for making a copy if necessary.

Jump to

Keyboard shortcuts

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