platform

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AccessTokenTTL          int    = 3600
	RefreshTokenTTL         int    = 36000  // 10 hours
	RefreshTokenTTLRemember int    = 604800 // 1 week
	AccountPrefix           string = "/account/"
	AccountID               string = "~"
	TokenEndpoint           string = "/restapi/oauth/token" // #nosec G101
	RevokeEndpoint          string = "/restapi/oauth/revoke"
	APIVersion              string = "v1.0"
	URLPrefix               string = "/restapi"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth() Auth

func (*Auth) GetAccessToken

func (a *Auth) GetAccessToken() string

func (*Auth) GetTokenType

func (a *Auth) GetTokenType() string

func (*Auth) Reset

func (a *Auth) Reset() *Auth

func (*Auth) SetData

func (a *Auth) SetData(authData AuthCallResponseData) *Auth

type AuthCallResponseData

type AuthCallResponseData struct {
	AccessToken           string `json:"access_token"`
	TokenType             string `json:"token_type"`
	ExpiresIn             int    `json:"expires_in"`
	RefreshToken          string `json:"refresh_token"`
	RefreshTokenExpiresIn int    `json:"refresh_token_expires_in"`
	Scope                 string `json:"scope"`
	OwnerId               string `json:"owner_id"`
}

func NewAuthCallResponseData

func NewAuthCallResponseData(body []byte) (AuthCallResponseData, error)

type Platform

type Platform struct {
	Auth Auth
	// contains filtered or unexported fields
}

func NewPlatform

func NewPlatform(context core.Context, appKey string, appSecret string, server string) Platform

func (*Platform) APICall

func (p *Platform) APICall(ctx context.Context, req httpsimple.Request) (*http.Response, error)

func (*Platform) APIURL added in v0.3.3

func (p *Platform) APIURL(url string) string

func (*Platform) Authorize

func (p *Platform) Authorize(ctx context.Context, username string, extension string, password string, remember bool) (*http.Response, error)

func (*Platform) Delete

func (p *Platform) Delete(url string, queryParameters url.Values, body io.Reader, headers http.Header) (*http.Response, error)

func (*Platform) Get

func (p *Platform) Get(url string, queryParameters url.Values, body io.Reader, headers http.Header) (*http.Response, error)

func (*Platform) GetApiKey

func (p *Platform) GetApiKey() string

func (*Platform) GetAuthHeader

func (p *Platform) GetAuthHeader() string

func (*Platform) IsAuthorized

func (p *Platform) IsAuthorized() *Platform

func (*Platform) Post

func (p *Platform) Post(url string, queryParameters url.Values, body io.Reader, headers http.Header) (*http.Response, error)

func (*Platform) Put

func (p *Platform) Put(url string, queryParameters url.Values, body io.Reader, headers http.Header) (*http.Response, error)

func (*Platform) Send

func (p *Platform) Send(req rchttp.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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