client

package
v0.0.0-...-b0114cf Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeaders

func GetHeaders(
	tr authorisation.TokenRetriever,
	useStableAPI bool,
	etag, lastModified string,
) (map[string]string, error)

GetHeaders gets the headers required for a GET request

func PostHeaders

func PostHeaders(tr authorisation.TokenRetriever, useStableAPI bool) (map[string]string, error)

PostHeaders gets the headers required for a POST request

Types

type GithubPageIterator

type GithubPageIterator struct {
	StartURL string
	Current  *Page
	// contains filtered or unexported fields
}

GithubPageIterator is an iterator over Github results pages

func NewGithubPageIterator

func NewGithubPageIterator(startURL string, pageGetter PageGetter) *GithubPageIterator

NewGithubPageIterator creates a new PageIterator type for iterating over Github pages of results

func (*GithubPageIterator) Error

func (i *GithubPageIterator) Error() error

func (*GithubPageIterator) Next

func (i *GithubPageIterator) Next() *Page

func (*GithubPageIterator) NextWithContext

func (i *GithubPageIterator) NextWithContext(ctx context.Context) *Page

NextWithContext will return the next page in the results, and a boolean to indicate if there is a subsequent page

type IGithubClient

type IGithubClient interface {
	Post(string, bool, map[string]string) int
	Patch(string, bool, map[string]string) int
	PageGetter
}

IGithubClient provides a Github client interface

type Page

type Page struct {
	URL        string
	Content    *Payload
	Err        error
	StatusCode int
}

Page holds links to the current, next and last pages of results Github results

func (*Page) IsLast

func (p *Page) IsLast() bool

IsLast indicates if there is another page after this one

func (*Page) NoContent

func (p *Page) NoContent() bool

func (*Page) String

func (p *Page) String() string

type PageGetter

type PageGetter interface {
	Get(string, bool) *Page
	GetWithContext(context.Context, string, bool) *Page
}

PageGetter defines an interface for retrieving Github results pages

type PageIterator

type PageIterator interface {
	Next() *Page
	NextWithContext(context.Context) *Page
	Error() error
}

PageIterator defines the interface for iterating over multi-page results from an HTTP GET

type Payload

type Payload struct {
	Data         string // json string
	ETag         string
	LastModified string
	NextLink     string
}

Payload represents the returned data from a Github GET It is a "page" data.

func (*Payload) Empty

func (p *Payload) Empty() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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