lfsapi

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const MediaType = "application/vnd.git-lfs+json; charset=utf-8"
View Source
const UrlUnknown = "<unknown>"

Variables

View Source
var UserAgent = "git-lfs"

Functions

func DecodeJSON

func DecodeJSON(res *http.Response, obj interface{}) error

func IsDecodeTypeError

func IsDecodeTypeError(err error) bool

func IsHTTP

func IsHTTP(err error) (*http.Response, bool)

func MarshalToRequest

func MarshalToRequest(req *http.Request, obj interface{}) error

func NewStatusCodeError

func NewStatusCodeError(res *http.Response) error

Types

type Access

type Access string
const (
	NoneAccess      Access = "none"
	BasicAccess     Access = "basic"
	PrivateAccess   Access = "private"
	NegotiateAccess Access = "negotiate"
	NTLMAccess      Access = "ntlm"
)

type Client

type Client struct {
	Endpoints   EndpointFinder
	Credentials CredentialHelper
	Netrc       NetrcFinder

	DialTimeout         int
	KeepaliveTimeout    int
	TLSTimeout          int
	ConcurrentTransfers int
	HTTPSProxy          string
	HTTPProxy           string
	NoProxy             string
	SkipSSLVerify       bool

	Verbose          bool
	DebuggingVerbose bool
	LoggingStats     bool
	VerboseOut       io.Writer
	// contains filtered or unexported fields
}

func NewClient

func NewClient(osEnv Env, gitEnv Env) (*Client, error)

func (*Client) CurrentUser

func (c *Client) CurrentUser() (string, string)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) DoWithAuth

func (c *Client) DoWithAuth(remote string, req *http.Request) (*http.Response, error)

func (*Client) GitEnv

func (c *Client) GitEnv() Env

func (*Client) LogResponse

func (c *Client) LogResponse(key string, res *http.Response)

func (*Client) LogStats

func (c *Client) LogStats(out io.Writer)

LogStats is intended to be called after all HTTP operations for the commmand have finished. It dumps k/v logs, one line per httpTransfer into a log file with the current timestamp.

func (*Client) NewRequest

func (c *Client) NewRequest(method string, e Endpoint, suffix string, body interface{}) (*http.Request, error)

func (*Client) OSEnv

func (c *Client) OSEnv() Env

type ClientError

type ClientError struct {
	Message          string `json:"message"`
	DocumentationUrl string `json:"documentation_url,omitempty"`
	RequestId        string `json:"request_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ClientError) Error

func (e *ClientError) Error() string

func (*ClientError) HTTPResponse

func (e *ClientError) HTTPResponse() *http.Response

type CredentialHelper

type CredentialHelper interface {
	Fill(Creds) (Creds, error)
	Reject(Creds) error
	Approve(Creds) error
}

type Creds

type Creds map[string]string

type Endpoint

type Endpoint struct {
	Url            string
	SshUserAndHost string
	SshPath        string
	SshPort        string
	Operation      string
}

An Endpoint describes how to access a Git LFS server.

type EndpointFinder

type EndpointFinder interface {
	NewEndpointFromCloneURL(rawurl string) Endpoint
	NewEndpoint(rawurl string) Endpoint
	Endpoint(operation, remote string) Endpoint
	RemoteEndpoint(operation, remote string) Endpoint
	GitRemoteURL(remote string, forpush bool) string
	AccessFor(rawurl string) Access
	SetAccess(rawurl string, access Access)
	GitProtocol() string
}

func NewEndpointFinder

func NewEndpointFinder(git Env) EndpointFinder

type Env

type Env interface {
	Get(string) (string, bool)
	Int(string, int) int
	Bool(string, bool) bool
	All() map[string]string
}

Env is an interface for the config.Environment methods that this package relies on.

type NetrcFinder

type NetrcFinder interface {
	FindMachine(string) *netrc.Machine
}

func ParseNetrc

func ParseNetrc(osEnv Env) (NetrcFinder, error)

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Seeker
	io.ReadCloser
}

func NewByteBody

func NewByteBody(by []byte) ReadSeekCloser

type TestEnv

type TestEnv map[string]string

TestEnv is a basic config.Environment implementation. Only used in tests, or as a zero value to NewClient().

func (TestEnv) All

func (e TestEnv) All() map[string]string

func (TestEnv) Bool

func (e TestEnv) Bool(key string, def bool) (val bool)

func (TestEnv) Get

func (e TestEnv) Get(key string) (string, bool)

func (TestEnv) Int

func (e TestEnv) Int(key string, def int) (val int)

Jump to

Keyboard shortcuts

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