client

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDebrickedUri = "https://debricked.com"
View Source
const DefaultTimeout = 15

Variables

View Source
var NoResErr = errors.New("failed to get response. Check out the Debricked status page: https://status.debricked.com/")
View Source
var SupportedFormatsFallbackError = errors.New("get supported formats from the server. Using cached data instead")

Functions

func NewRetryClient

func NewRetryClient() *retryablehttp.Client

Types

type DebClient

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

func NewDebClient

func NewDebClient(accessToken *string, httpClient IClient) *DebClient

func (*DebClient) Get

func (debClient *DebClient) Get(uri string, format string) (*http.Response, error)

func (*DebClient) Post

func (debClient *DebClient) Post(uri string, contentType string, body *bytes.Buffer, timeout int) (*http.Response, error)

func (*DebClient) SetAccessToken added in v1.1.0

func (debClient *DebClient) SetAccessToken(accessToken *string)

type IClient

type IClient interface {
	Do(req *retryablehttp.Request) (*http.Response, error)
	Post(url, bodyType string, body interface{}) (*http.Response, error)
}

type IDebClient

type IDebClient interface {
	// Post makes a POST request to one of Debricked's API endpoints
	Post(uri string, contentType string, body *bytes.Buffer, timeout int) (*http.Response, error)
	// Get makes a GET request to one of Debricked's API endpoints
	Get(uri string, format string) (*http.Response, error)
	SetAccessToken(accessToken *string)
}

Jump to

Keyboard shortcuts

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