oauth2

package
v0.0.0-...-312375d Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedirectError

func RedirectError(u *url.URL) error

func RedirectErrorCode

func RedirectErrorCode(u *url.URL, code int) error

code can be one of http.StatusMovedPermanently or http.StatusFound or any 3xx http status code

func SendRedirect

func SendRedirect(w http.ResponseWriter, url string, code int)

Types

type OAuth2

type OAuth2 struct {
	http.Client
	http.Transport
	// contains filtered or unexported fields
}

func FromDisk

func FromDisk(clientId, endpoint string) (*OAuth2, error)

func NewOAuth2

func NewOAuth2(endpoint, clientId, redirectUri, code string) (*OAuth2, error)

func (*OAuth2) Rest

func (o *OAuth2) Rest(req, method string, param RestParam) (*RestResponse, error)

func (*OAuth2) RoundTrip

func (o *OAuth2) RoundTrip(r *http.Request) (*http.Response, error)

type RestParam

type RestParam map[string]interface{}

type RestResponse

type RestResponse struct {
	Result string      `json:"result"` // "success" or "error" (or "redirect")
	Data   interface{} `json:"data"`
	Error  string      `json:"error"`

	Paging interface{} `json:"paging"`
	Job    interface{} `json:"job"`
	Time   interface{} `json:"time"`
	Access interface{} `json:"access"`

	RedirectUrl  string `json:"redirect_url"`
	RedirectCode int    `json:"redirect_code"`
}

type Upload

type Upload struct {
	ContentType string
	// contains filtered or unexported fields
}

func NewUpload

func NewUpload(o *OAuth2, req string, param RestParam) (*Upload, error)

func (*Upload) Complete

func (u *Upload) Complete() (*RestResponse, error)

func (*Upload) Len

func (u *Upload) Len() int64

func (*Upload) Write

func (u *Upload) Write(d []byte) (int, error)

Jump to

Keyboard shortcuts

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