rest

package
v2.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBody added in v2.1.9

func CopyBody(req *http.Request) ([]byte, error)

func Decode

func Decode(body io.ReadCloser, v interface{}) error

func ExponentialBackoff added in v2.1.9

func ExponentialBackoff(retry int)

func IsClosedConnectionErr added in v2.1.9

func IsClosedConnectionErr(err error) bool

func NewClientAssertion

func NewClientAssertion(tokenUrl string, clientId string, clientCert string, signingKey string, keyPassphrase string) (string, error)

func NewHTTPClient

func NewHTTPClient(proxyUrl string) (*http.Client, error)

func NewRequest

func NewRequest(
	ctx context.Context,
	verb string,
	endpoint *url.URL,
	body interface{},
	params map[string]string,
	headers map[string]string,
) (*http.Request, error)

func ParseAud

func ParseAud(accessToken string) (string, error)

func ParseBody

func ParseBody(accessToken string) (map[string]interface{}, error)

Types

type RestClient

type RestClient interface {
	Authenticate() error
	Delete(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error)
	Get(ctx context.Context, path string, params, headers map[string]string) (*http.Response, error)
	Patch(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error)
	Post(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error)
	Put(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error)
	Send(req *http.Request) (*http.Response, error)
	CloseIdleConnections()
}

func NewRestClient

func NewRestClient(apiUrl string, config config.Config) (RestClient, error)

type Token

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

func (Token) IsExpired

func (s Token) IsExpired() bool

func (Token) String

func (s Token) String() string

func (*Token) UnmarshalJSON

func (s *Token) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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