Documentation ¶
Overview ¶
Package googleapi contains the common code shared by all Google API libraries.
Index ¶
- Constants
- Variables
- func CheckResponse(res *http.Response) error
- func ConditionallyIncludeMedia(media io.Reader, bodyp *io.Reader, ctypep *string) (totalContentLength int64, ok bool)
- func ResolveRelative(basestr, relstr string) string
- func SetOpaque(u *url.URL)
- type ContentTyper
- type Error
- type Lengther
- type MarshalStyle
Constants ¶
const Version = "0.5"
Variables ¶
var WithDataWrapper = MarshalStyle(true)
var WithoutDataWrapper = MarshalStyle(false)
Functions ¶
func CheckResponse ¶
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 ¶
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 MarshalStyle ¶
type MarshalStyle bool
func (MarshalStyle) JSONReader ¶
func (wrap MarshalStyle) JSONReader(v interface{}) (io.Reader, error)