1package lfs
2
3import (
4 "context"
5 "io"
6)
7
8const (
9 // SchemeHTTP represents the HTTP protocol scheme
10 SchemeHTTP = "http"
11 // SchemeHTTPS represents the HTTPS protocol scheme
12 SchemeHTTPS = "https"
13)
14
15// DownloadCallback gets called for every requested LFS object to process its content
16type DownloadCallback func(p Pointer, content io.ReadCloser, objectError error) error
17
18// UploadCallback gets called for every requested LFS object to provide its content
19type UploadCallback func(p Pointer, objectError error) (io.ReadCloser, error)
20
21// Client is a Git LFS client to communicate with a LFS source API.
22type Client interface {
23 Download(ctx context.Context, objects []Pointer, callback DownloadCallback) error
24 Upload(ctx context.Context, objects []Pointer, callback UploadCallback) error
25}
26
27// NewClient returns a new Git LFS client.
28func NewClient(e Endpoint) Client {
29 if e.Scheme == SchemeHTTP || e.Scheme == SchemeHTTPS {
30 return newHTTPClient(e)
31 }
32 // TODO: support ssh client
33 return nil
34}