api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 8 Imported by: 4

Documentation

Overview

Package api implements request and response parsing logic shared between different OAuth strategies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	// The token value, typically a 40-character random string.
	Token string
	// The refresh token value, associated with the access token.
	RefreshToken string
	// The token type, e.g. "bearer".
	Type string
	// Space-separated list of OAuth scopes that this token grants.
	Scope string
}

AccessToken is an OAuth access token.

type Error

type Error struct {
	Code         string
	ResponseCode int
	RequestURI   string
	// contains filtered or unexported fields
}

Error is the result of an unexpected HTTP response from the server.

func (Error) Error

func (e Error) Error() string

type FormResponse

type FormResponse struct {
	StatusCode int
	// contains filtered or unexported fields
}

FormResponse is the parsed "www-form-urlencoded" response from the server.

func PostForm

func PostForm(c httpClient, u string, params url.Values) (*FormResponse, error)

PostForm makes an POST request by serializing input parameters as a form and parsing the response of the same type.

func (FormResponse) AccessToken

func (f FormResponse) AccessToken() (*AccessToken, error)

AccessToken extracts the access token information from a server response.

func (FormResponse) Err

func (f FormResponse) Err() error

Err returns an Error object extracted from the response.

func (FormResponse) Get

func (f FormResponse) Get(k string) string

Get the response value named k.

Jump to

Keyboard shortcuts

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