cachedclient

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheData

type CacheData map[string]client.Payload

CacheData represents the mapping of hash key to the corresponding payload

type PickledCache

type PickledCache struct {
	Path string
	Data CacheData
}

PickledCache represents a pickled cache

func NewCache

func NewCache() (*PickledCache, error)

NewCache will create and initialise a new PickledCached file

func (*PickledCache) Load

func (pc *PickledCache) Load() error

Load retieves the cache data from file and puts in the cache data member

func (PickledCache) Save

func (pc PickledCache) Save() error

Save dumps the in-memory cache data to file

type PickledCachedClient

type PickledCachedClient struct {
	APIToken *authorisation.GithubToken
	APIURL   string
	// contains filtered or unexported fields
}

PickledCachedClient represents a Github client that caches data

func NewClient

func NewClient() *PickledCachedClient

NewClient creates and initialises a new PickledCachedClient

func (*PickledCachedClient) Get

func (c *PickledCachedClient) Get(
	url string,
	useStableAPI bool,
) *client.Page

Get executes an HTTP GET operation, returning a Page object (that may link to further pages if there are more results to come).

func (*PickledCachedClient) GetWithContext

func (c *PickledCachedClient) GetWithContext(
	ctx context.Context,
	url string,
	useStableAPI bool,
) *client.Page

GetWithContext executes an HTTP GET operation, returning a Page object (that may link to further pages if there are more results to come). It may be cancelled via the context.

func (*PickledCachedClient) Patch

func (c *PickledCachedClient) Patch(
	url string,
	useStableAPI bool,
	data map[string]string,
) (int, error)

Patch executes an HTTP PATCH operation, returning a status code.

func (*PickledCachedClient) PatchWithContext

func (c *PickledCachedClient) PatchWithContext(
	ctx context.Context,
	url string,
	useStableAPI bool,
	data map[string]string,
) (int, error)

PatchWithContext executes an HTTP PATCH operation, returning a status code. It may be cancelled via the context.

func (*PickledCachedClient) Post

func (c *PickledCachedClient) Post(
	url string,
	useStableAPI bool,
	data map[string]string,
) (int, error)

Post executes an HTTP POST operation, returning a status code and error.

func (*PickledCachedClient) PostWithContext

func (c *PickledCachedClient) PostWithContext(
	ctx context.Context,
	url string,
	useStableAPI bool,
	data map[string]string,
) (int, error)

PostWithContext executes an HTTP POST operation, returning a status code. It may be cancelled via a context

Jump to

Keyboard shortcuts

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