api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleHTTPError

func HandleHTTPError(resp gorequest.Response) error

HandleHTTPError catches HTTP errors and prints them out

Types

type Client

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

Client facilitates making HTTP requests to the Karma API

func NewClient

func NewClient(host string, token string, teamID string, version string) Client

NewClient returns an authenticated client

func (Client) Get

func (c Client) Get(endpoint string, data interface{}) error

Get makes a GET request to API server and assign response to data struct

func (Client) Post

func (c Client) Post(endpoint string, payload interface{}, data interface{}) error

Post makes a POST request to server

type HTTPError

type HTTPError struct {
	StatusCode int
	RequestURL *url.URL
	Message    string
}

HTTPError is an error returned by a failed API call

func (HTTPError) Error

func (err HTTPError) Error() string

Jump to

Keyboard shortcuts

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