rest

package
v0.0.0-...-214bf7a Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

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.