library

package
v0.0.0-...-239b6c0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NextUserSharedLibraryUpdate = 2 * time.Minute
	NextGroupObjectsUpdate      = 2 * time.Minute
)

Variables

This section is empty.

Functions

func WithCookieJar

func WithCookieJar(jar http.CookieJar) client.ClientOption

func WithCredentials

func WithCredentials(cred mmf.Credentials) client.ClientOption

func WithDataDir

func WithDataDir(datadir string) client.ClientOption

func WithDataStore

func WithDataStore(ds types.Store) client.ClientOption

func WithTransport

func WithTransport(transport http.RoundTripper) client.ClientOption

Types

type Client

type Client struct {
	client.Client
	WorkQueue
	// contains filtered or unexported fields
}

func New

func New(cred mmf.Credentials) *Client

func NewWithClient

func NewWithClient(cred mmf.Credentials, hc *http.Client) *Client

func NewWithOptions

func NewWithOptions(options ...client.ClientOption) (*Client, error)

func NewWithTransport

func NewWithTransport(cred mmf.Credentials, transport http.RoundTripper) *Client

func (*Client) Commit

func (c *Client) Commit() error

Stores library data persistently

func (*Client) GetPage

func (c *Client) GetPage(ctx context.Context, opt client.RequestOptions, page int) (*resty.Response, error)

func (*Client) GetPledgesLibrary

func (c *Client) GetPledgesLibrary(ctx context.Context) (*json.Objects, error)

get all JSON data of Pledges library

func (*Client) GetPledgesLibraryPage

func (c *Client) GetPledgesLibraryPage(ctx context.Context, page int) (*json.Objects, error)

get requested page of JSON data of Pledges library

func (*Client) GetPurchasesLibrary

func (c *Client) GetPurchasesLibrary(ctx context.Context) (*json.Objects, error)

get all JSON data of Purchases library

func (*Client) GetPurchasesLibraryPage

func (c *Client) GetPurchasesLibraryPage(ctx context.Context, page int) (*json.Objects, error)

get requested page of JSON data of Purchases library

func (*Client) GetSharedLibrary

func (c *Client) GetSharedLibrary(ctx context.Context) (*json.Users, error)

get all JSON data of Shared library

func (*Client) GetSharedLibraryPage

func (c *Client) GetSharedLibraryPage(ctx context.Context, page int) (*json.Users, error)

get requested page of JSON data of Shared library

func (*Client) GetTribesLibrary

func (c *Client) GetTribesLibrary(ctx context.Context) (*json.Tribes, error)

get all JSON data of Tribes library

func (*Client) GetTribesLibraryPage

func (c *Client) GetTribesLibraryPage(ctx context.Context, page int) (*json.Tribes, error)

get requested page of JSON data of Tribes library

func (*Client) GetWithContext

func (c *Client) GetWithContext(ctx context.Context, path string) (*resty.Response, error)

func (*Client) Init

func (c *Client) Init(cred mmf.Credentials, rc *resty.Client) *Client

func (*Client) RefreshLibraries

func (c *Client) RefreshLibraries(ctx context.Context) error

pulls all data from the server

func (*Client) RefreshPledgesLibrary

func (c *Client) RefreshPledgesLibrary(ctx context.Context) error

pull first page of Pledges library

func (*Client) RefreshPurchasesLibrary

func (c *Client) RefreshPurchasesLibrary(ctx context.Context) error

pull first page of Purchases library

func (*Client) RefreshSharedLibrary

func (c *Client) RefreshSharedLibrary(ctx context.Context) error

pull first page of Shared library

func (*Client) RefreshTribesLibrary

func (c *Client) RefreshTribesLibrary(ctx context.Context) error

pull first page of Tribes library

func (*Client) Reload

func (c *Client) Reload() error

Reload persistent Library data

func (*Client) SchedulePageRequest

func (c *Client) SchedulePageRequest(opt client.RequestOptions, page int, fn ResponseHandler)

type DownloadJob

type DownloadJob struct {
	client.RequestOptions
	// contains filtered or unexported fields
}

func (*DownloadJob) Do

func (j *DownloadJob) Do(c *Client, ctx context.Context) error

type Library

type Library = types.Library

type LibraryClientOption

type LibraryClientOption interface {
	client.ClientOption

	ApplyLibrary(*Client) error
}

type LibraryClientOptionFunc

type LibraryClientOptionFunc func(*Client) error

func (LibraryClientOptionFunc) Apply

func (LibraryClientOptionFunc) ApplyLibrary

func (f LibraryClientOptionFunc) ApplyLibrary(c *Client) error

type Queue

type Queue struct {
	queue.Queue

	Count int32
	Max   int32
	// contains filtered or unexported fields
}

func (*Queue) Add

func (p *Queue) Add() bool

func (*Queue) Done

func (p *Queue) Done()

type ResponseHandler

type ResponseHandler func(c *Client, ctx context.Context, resp *resty.Response) error

type WorkJob

type WorkJob func(c *Client, ctx context.Context) error

type WorkQueue

type WorkQueue struct {
	// contains filtered or unexported fields
}

func (*WorkQueue) Add

func (wq *WorkQueue) Add(f WorkJob)

func (*WorkQueue) Cancel

func (wq *WorkQueue) Cancel()

func (*WorkQueue) Context

func (wq *WorkQueue) Context() context.Context

func (*WorkQueue) Done

func (wq *WorkQueue) Done() <-chan error

func (*WorkQueue) Download

func (wq *WorkQueue) Download(opt client.RequestOptions, fn ResponseHandler)

func (*WorkQueue) Init

func (wq *WorkQueue) Init(c *Client)

func (*WorkQueue) Poke

func (wq *WorkQueue) Poke()

func (*WorkQueue) Request

func (wq *WorkQueue) Request(req *DownloadJob)

func (*WorkQueue) Spawn

func (wq *WorkQueue) Spawn(f WorkJob)

func (*WorkQueue) Start

func (wq *WorkQueue) Start(n int32)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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