apiclient

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTJSON     = "application/json"
	CTPackfile = "application/x-wrgl-packfile"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(origin string, opts ...RequestOption) (*Client, error)

func (*Client) Authenticate added in v0.4.0

func (c *Client) Authenticate(email, password string, opts ...RequestOption) (token string, err error)

func (*Client) Commit added in v0.3.11

func (c *Client) Commit(branch, message, authorEmail, authorName string, file io.Reader, primaryKey []string, opts ...RequestOption) (cr *payload.CommitResponse, err error)

func (*Client) Diff added in v0.3.11

func (c *Client) Diff(sum1, sum2 []byte, opts ...RequestOption) (dr *payload.DiffResponse, err error)

func (*Client) ErrHTTP

func (c *Client) ErrHTTP(resp *http.Response) error

func (*Client) GetBlocks added in v0.3.11

func (c *Client) GetBlocks(sum []byte, start, end int, format payload.BlockFormat, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetCommit added in v0.3.11

func (c *Client) GetCommit(sum []byte, opts ...RequestOption) (cr *payload.Commit, err error)

func (*Client) GetCommits added in v0.4.0

func (c *Client) GetCommits(ref string, minDepth, maxDepth int, opts ...RequestOption) (gcr *payload.GetCommitsResponse, err error)

func (*Client) GetHead added in v0.4.0

func (c *Client) GetHead(branch string, opts ...RequestOption) (com *payload.Commit, err error)

func (*Client) GetRefs

func (c *Client) GetRefs(opts ...RequestOption) (m map[string][]byte, err error)

func (*Client) GetRows added in v0.3.11

func (c *Client) GetRows(sum []byte, offsets []int, opts ...RequestOption) (resp *http.Response, err error)

func (*Client) GetTable added in v0.3.11

func (c *Client) GetTable(sum []byte, opts ...RequestOption) (tr *payload.GetTableResponse, err error)

func (*Client) PostMultipartForm added in v0.3.11

func (c *Client) PostMultipartForm(path string, value map[string][]string, files map[string]io.Reader, opts ...RequestOption) (*http.Response, error)

func (*Client) PostUpdatesToReceivePack

func (c *Client) PostUpdatesToReceivePack(updates map[string]*payload.Update, opts ...RequestOption) (*http.Response, error)

func (*Client) PostUploadPack

func (c *Client) PostUploadPack(wants, haves [][]byte, done bool, opts ...RequestOption) (acks [][]byte, pr *encoding.PackfileReader, err error)

func (*Client) Request

func (c *Client) Request(method, path string, body io.Reader, headers map[string]string, opts ...RequestOption) (resp *http.Response, err error)

type HTTPError added in v0.4.0

type HTTPError struct {
	Code    int
	Message string
}

func NewHTTPError added in v0.4.0

func NewHTTPError(code int, message string) *HTTPError

func (*HTTPError) Error added in v0.4.0

func (err *HTTPError) Error() string

type ReceivePackSession

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

func NewReceivePackSession

func NewReceivePackSession(db objects.Store, rs ref.Store, c *Client, updates map[string]*payload.Update, remoteRefs map[string][]byte, maxPackfileSize uint64, opts ...RequestOption) (*ReceivePackSession, error)

func (*ReceivePackSession) Start

func (s *ReceivePackSession) Start() (updates map[string]*payload.Update, err error)

type RequestOption added in v0.3.12

type RequestOption func(r *http.Request)

func WithAuthorization added in v0.4.0

func WithAuthorization(token string) RequestOption

func WithHeader added in v0.3.12

func WithHeader(header http.Header) RequestOption

type UploadPackSession

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

func NewUploadPackSession

func NewUploadPackSession(db objects.Store, rs ref.Store, c *Client, advertised [][]byte, havesPerRoundTrip int, opts ...RequestOption) (*UploadPackSession, error)

func (*UploadPackSession) Start

func (n *UploadPackSession) Start() ([][]byte, error)

Jump to

Keyboard shortcuts

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