api

package
v3.0.0-alpha.7.v2+inco... Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2018 License: MIT Imports: 11 Imported by: 57

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UserAgent lets the API know where the call is being made from.
	// It's overridden from the root command so that we can set the version.
	UserAgent = "github.com/exercism/cli"

	// DefaultHTTPClient configures a timeout to use by default.
	DefaultHTTPClient = &http.Client{Timeout: 10 * time.Second}
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	APIConfig   *config.APIConfig
	UserConfig  *config.UserConfig
	ContentType string
}

Client is an http client that is configured for Exercism.

func NewClient

func NewClient() (*Client, error)

NewClient returns an Exercism API client.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do performs an http.Request and optionally parses the response body into the given interface.

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, body io.Reader) (*http.Request, error)

NewRequest returns an http.Request with information for the Exercism API.

Jump to

Keyboard shortcuts

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