googleapi

package
v0.0.0-...-a3d915e Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package googleapi contains the common code shared by all Google API libraries.

Index

Constants

View Source
const Version = "0.5"

Variables

View Source
var WithDataWrapper = MarshalStyle(true)
View Source
var WithoutDataWrapper = MarshalStyle(false)

Functions

func CheckResponse

func CheckResponse(res *http.Response) error

func ConditionallyIncludeMedia

func ConditionallyIncludeMedia(media io.Reader, bodyp *io.Reader, ctypep *string) (totalContentLength int64, ok bool)

ConditionallyIncludeMedia does nothing if media is nil.

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 the content-length of the entire multpart body.

func ResolveRelative

func ResolveRelative(basestr, relstr string) string

func SetOpaque

func SetOpaque(u *url.URL)

SetOpaque sets u.Opaque from u.Path such that HTTP requests to it don't alter any hex-escaped characters in u.Path.

Types

type ContentTyper

type ContentTyper interface {
	ContentType() string
}

ContentTyper is an interface for Readers which know (or would like to override) their Content-Type. If a media body doesn't implement ContentTyper, the type is sniffed from the content using http.DetectContentType.

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type Lengther

type Lengther interface {
	Len() int
}

type MarshalStyle

type MarshalStyle bool

func (MarshalStyle) JSONReader

func (wrap MarshalStyle) JSONReader(v interface{}) (io.Reader, error)

Directories

Path Synopsis
Package transport contains HTTP transports used to make authenticated API requests.
Package transport contains HTTP transports used to make authenticated API requests.

Jump to

Keyboard shortcuts

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