rest

package
v0.0.0-...-15033f0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package rest provides common functions for consuming REST APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rest

type Rest struct {
	// HTTPClient abstracts the http client for testing purposes.
	HTTPClient httpClient

	// tokenGetter abstracts getting default oauth2 access token for testing purposes.
	TokenGetter defaultTokenGetter
}

Rest is a struct for making REST API calls.

func (*Rest) GetResponse

func (r *Rest) GetResponse(ctx context.Context, method string, baseURL string, data []byte) ([]byte, error)

GetResponse creates a new request with given method, url and data and returns the response.

func (*Rest) NewRest

func (r *Rest) NewRest()

NewRest initializes the Rest with a new http client.

Jump to

Keyboard shortcuts

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