client

package
Version: v0.0.0-...-bf65384 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package client contains an implementation of a HTTP client aware of all the Github rules like rate limiting or authenticating

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient
	LastResponse *http.Response
	Log
}

Client is a top-level HTTPClient that remembers the last response and can log information out during the process

func New

func New(httpClient HTTPClient, opts Options) Client

New creates a new instance of Client chaining all the clients together given Options

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do is HTTPClient.Do

type Credentials

type Credentials struct {
	Username            string
	PersonalAccessToken string
}

Credentials struct contains user's name and access token to access the Github API

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is in interface for a HTTP client which "transforms" a http.Request into http.Response (like http.Client)

type Log

type Log func(message string)

Log is a which is used to report for logging

type Options

type Options struct {
	*Credentials
	RateLimiter *<-chan time.Time
	MaxRetries  int
	Log
}

Options is a set of configurable options to create a whole chain of clients

Jump to

Keyboard shortcuts

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