rest

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec() error

Exec creates an API Client and uses its GetGoogle method, then prints the result

Types

type APIClient

type APIClient struct {
	*http.Client
}

APIClient is our custom client

func NewAPIClient

func NewAPIClient(username, password string) *APIClient

NewAPIClient constructor initializes the client with our custom Transport

func (*APIClient) GetGoogle

func (c *APIClient) GetGoogle() (int, error)

GetGoogle is an API Call - we abstract away the REST aspects

type APITransport

type APITransport struct {
	*http.Transport
	// contains filtered or unexported fields
}

APITransport does a SetBasicAuth for every request

func (*APITransport) RoundTrip

func (t *APITransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip does the basic auth before deferring to the default transport

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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