dotfileclient

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client   *http.Client
	Remote   string
	Username string
	Token    string
}

Client contains a http client and the information needed for interacting with the dotfilehub api.

func New

func New(remote, username, token string) *Client

New returns a client that is ready to communicate with a dotfilehub server.

func (*Client) Content

func (c *Client) Content(alias string) ([]byte, error)

Content fetches the current content of alias.

func (*Client) List

func (c *Client) List(path bool) ([]string, error)

List lists the files that the remote user has saved.

func (*Client) Revisions

func (c *Client) Revisions(alias string, hashes []string) ([]*Revision, error)

Revisions fetches all of the revisions for alias in the hashes argument. Returns an error if any fetches fail or are non 200.

func (*Client) TrackingData

func (c *Client) TrackingData(alias string) (*dotfile.TrackingData, error)

TrackingData returns the file tracking data for alias on remote.

func (*Client) TrackingDataBytes

func (c *Client) TrackingDataBytes(alias string) ([]byte, error)

TrackingDataBytes returns the tracking data for alias in bytes.

func (*Client) UploadRevisions

func (c *Client) UploadRevisions(alias string, data *dotfile.TrackingData, revisions []*Revision) error

UploadRevisions uploads revisions to remote using a multipart POST request. The first part is the fileData JSON the rest are form files with the revision bytes.

type Revision

type Revision struct {
	Hash  string
	Bytes []byte
}

Revision is the bytes of a revision and its hash. Note that the bytes would not hash to Hash - its from the original uncompressed content.

Jump to

Keyboard shortcuts

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