api

package
v0.0.0-...-085d234 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongGeneration = errors.New("wrong generation")
	ErrNotFound        = errors.New("not found")

	ErrUnauthorized = errors.New("401 Unauthorized")
	ErrConflict     = errors.New("409 Conflict")
)

Functions

func AuthenticateHTTP

func AuthenticateHTTP(httpClientCtx *HTTPClientCtx, reAuth bool) error

func LoadTokens

func LoadTokens() (*authToken, error)

Types

type AuthType

type AuthType int
const (
	EmptyBearer AuthType = iota
	DeviceBearer
	UserBearer

	HeaderGeneration = "x-goog-generation"
	EmptyBody        = ""
)

type BodyString

type BodyString struct {
	Content string
}

type HTTPClientCtx

type HTTPClientCtx struct {
	Client  *http.Client
	Token   *authToken
	Context context.Context
}

func CreateHTTPClientCtx

func CreateHTTPClientCtx(token *authToken, ctx context.Context) (*HTTPClientCtx, error)

func (HTTPClientCtx) Delete

func (ctx HTTPClientCtx) Delete(authType AuthType, url string, reqBody, resp interface{}) error

func (HTTPClientCtx) Get

func (ctx HTTPClientCtx) Get(authType AuthType, url string, body interface{}, target interface{}) error

func (HTTPClientCtx) GetBlobStream

func (ctx HTTPClientCtx) GetBlobStream(url string) (io.ReadCloser, int64, error)

func (HTTPClientCtx) GetStream

func (ctx HTTPClientCtx) GetStream(authType AuthType, url string) (io.ReadCloser, error)

func (HTTPClientCtx) Post

func (ctx HTTPClientCtx) Post(authType AuthType, url string, reqBody, resp interface{}) error

func (HTTPClientCtx) Put

func (ctx HTTPClientCtx) Put(authType AuthType, url string, reqBody, resp interface{}) error

func (HTTPClientCtx) PutStream

func (ctx HTTPClientCtx) PutStream(authType AuthType, url string, reqBody io.Reader) error

func (HTTPClientCtx) Request

func (ctx HTTPClientCtx) Request(authType AuthType, verb, url string, body io.Reader) (*http.Response, error)

Jump to

Keyboard shortcuts

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