{"modulePath":"github.com/2lambda123/git-lfs","version":"v2.5.2+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package lfsapi\n\n## Constants\n\n```go\nconst MediaType = \"application/vnd.git-lfs+json; charset=utf-8\"\n```\n\n```go\nconst UrlUnknown = \"\u003cunknown\u003e\"\n```\n\n## Variables\n\n```go\nvar (\n\tUserAgent = \"git-lfs\"\n)\n```\n\n## Functions\n\n```go\nfunc DecodeJSON(res *http.Response, obj interface{}) error\n```\n\n```go\nfunc IsDecodeTypeError(err error) bool\n```\n\n```go\nfunc IsHTTP(err error) (*http.Response, bool)\n```\n\n```go\nfunc MarshalToRequest(req *http.Request, obj interface{}) error\n```\n\n```go\nfunc NewStatusCodeError(res *http.Response) error\n```\n\n```go\nfunc Retries(req *http.Request) (int, bool)\n```\nRetries returns the number of retries requested for a given http.Request.\n\n```go\nfunc TestNtlmClientSession(t *testing.T)\n```\n\n```go\nfunc TestNtlmClientSessionBadCreds(t *testing.T)\n```\n\n```go\nfunc WithRetries(req *http.Request, n int) *http.Request\n```\nWithRetries stores the desired number of retries \"n\" on the given http.Request, and causes it to be retried \"n\" times in the case of a non-nil network related error.\n\n## Types\n\n```go\ntype Access string\n```\n\n```go\nconst (\n\tNoneAccess      Access = \"none\"\n\tBasicAccess     Access = \"basic\"\n\tPrivateAccess   Access = \"private\"\n\tNegotiateAccess Access = \"negotiate\"\n\tNTLMAccess      Access = \"ntlm\"\n)\n```\n\n```go\ntype AskPassCredentialHelper struct {\n\t// Program is the executable program's absolute or relative name.\n\tProgram string\n}\n```\nAskPassCredentialHelper implements the CredentialHelper type for GIT\\_ASKPASS and 'core.askpass' configuration values.\n\n```go\nfunc (a *AskPassCredentialHelper) Approve(_ Creds) error\n```\nApprove implements CredentialHelper.Approve, and returns nil. The ASKPASS credential helper does not implement credential approval.\n\n```go\nfunc (a *AskPassCredentialHelper) Fill(what Creds) (Creds, error)\n```\nFill implements fill by running the ASKPASS program and returning its output as a password encoded in the Creds type given the key \"password\".\n\nIt accepts the password as coming from the program's stdout, as when invoked with the given arguments (see (\\*AskPassCredentialHelper).args() below)./\n\nIf there was an error running the command, it is returned instead of a set of filled credentials.\n\nThe ASKPASS program is only queried if a credential was not already provided, i.e. through the git URL\n\n```go\nfunc (a *AskPassCredentialHelper) Reject(_ Creds) error\n```\nReject implements CredentialHelper.Reject, and returns nil. The ASKPASS credential helper does not implement credential rejection.\n\n```go\ntype Client struct {\n\tEndpoints   EndpointFinder\n\tCredentials CredentialHelper\n\tSSH         SSHResolver\n\tNetrc       NetrcFinder\n\n\tDialTimeout         int\n\tKeepaliveTimeout    int\n\tTLSTimeout          int\n\tConcurrentTransfers int\n\tSkipSSLVerify       bool\n\n\tVerbose          bool\n\tDebuggingVerbose bool\n\tVerboseOut       io.Writer\n\n\tLoggingStats bool // DEPRECATED\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewClient(ctx Context) (*Client, error)\n```\n\n```go\nfunc (c *Client) Close() error\n```\nClose closes any resources that this client opened.\n\n```go\nfunc (c *Client) CurrentUser() (string, string)\n```\n\n```go\nfunc (c *Client) Do(req *http.Request) (*http.Response, error)\n```\nDo sends an HTTP request to get an HTTP response. It wraps net/http, adding extra headers, redirection handling, and error reporting.\n\n```go\nfunc (c *Client) DoWithAuth(remote string, req *http.Request) (*http.Response, error)\n```\nDoWithAuth sends an HTTP request to get an HTTP response. It attempts to add authentication from netrc or git's credential helpers if necessary, supporting basic and ntlm authentication.\n\n```go\nfunc (c *Client) GitEnv() config.Environment\n```\n\n```go\nfunc (c *Client) LogHTTPStats(w io.WriteCloser)\n```\n\n```go\nfunc (c *Client) LogRequest(r *http.Request, reqKey string) *http.Request\n```\nLogRequest tells the client to log the request's stats to the http log after the response body has been read.\n\n```go\nfunc (c *Client) LogResponse(key string, res *http.Response)\n```\nLogResponse sends the current response stats to the http log.\n\nDEPRECATED: Use LogRequest() instead.\n\n```go\nfunc (c *Client) LogStats(out io.Writer)\n```\nLogStats 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.\n\nDEPRECATED: Call LogHTTPStats() before the first HTTP request.\n\n```go\nfunc (c *Client) NewRequest(method string, e Endpoint, suffix string, body interface{}) (*http.Request, error)\n```\n\n```go\nfunc (c *Client) OSEnv() config.Environment\n```\n\n```go\ntype ClientError struct {\n\tMessage          string `json:\"message\"`\n\tDocumentationUrl string `json:\"documentation_url,omitempty\"`\n\tRequestId        string `json:\"request_id,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e *ClientError) Error() string\n```\n\n```go\nfunc (e *ClientError) HTTPResponse() *http.Response\n```\n\n```go\ntype Context interface {\n\tGitConfig() *git.Configuration\n\tOSEnv() config.Environment\n\tGitEnv() config.Environment\n}\n```\n\n```go\nfunc NewContext(gitConf *git.Configuration, osEnv, gitEnv map[string]string) Context\n```\n\n```go\ntype CredentialHelper interface {\n\tFill(Creds) (Creds, error)\n\tReject(Creds) error\n\tApprove(Creds) error\n}\n```\nCredentialHelper is an interface used by the lfsapi Client to interact with the 'git credential' command: [https://git-scm.com/docs/gitcredentials](https://git-scm.com/docs/gitcredentials) Other implementations include ASKPASS support, and an in-memory cache.\n\n```go\nfunc NewCredentialHelpers(helpers []CredentialHelper) CredentialHelper\n```\nNewCredentialHelpers initializes a new CredentialHelpers from the given slice of CredentialHelper instances.\n\n```go\ntype CredentialHelpers struct {\n\t// contains filtered or unexported fields\n}\n```\nCredentialHelpers iterates through a slice of CredentialHelper objects CredentialHelpers is a \\[]CredentialHelper that iterates through each credential helper to fill, reject, or approve credentials. Typically, the first success returns immediately. Errors are reported to tracerx, unless all credential helpers return errors. Any erroring credential helpers are skipped for future calls.\n\nA CredentialHelper can return a credHelperNoOp error, signaling that the CredentialHelpers should try the next one.\n\n```go\nfunc (s *CredentialHelpers) Approve(what Creds) error\n```\nApprove implements CredentialHelper.Approve and approves the given Creds \"what\" with the first successful CredentialHelper. If an error occurrs, it calls Reject() with the same Creds and returns the error immediately. This ensures a caching credential helper removes the cache, since the Erroring CredentialHelper never successfully saved it.\n\n```go\nfunc (s *CredentialHelpers) Fill(what Creds) (Creds, error)\n```\nFill implements CredentialHelper.Fill by asking each CredentialHelper in order to fill the credentials.\n\nIf a fill was successful, it is returned immediately, and no other \\`CredentialHelper\\`s are consulted. If any CredentialHelper returns an error, it is reported to tracerx, and the next one is attempted. If they all error, then a collection of all the error messages is returned. Erroring credential helpers are added to the skip list, and never attempted again for the lifetime of the current Git LFS command.\n\n```go\nfunc (s *CredentialHelpers) Reject(what Creds) error\n```\nReject implements CredentialHelper.Reject and rejects the given Creds \"what\" with the first successful attempt.\n\n```go\ntype Creds map[string]string\n```\nCreds represents a set of key/value pairs that are passed to 'git credential' as input.\n\n```go\ntype Endpoint struct {\n\tUrl            string\n\tSshUserAndHost string\n\tSshPath        string\n\tSshPort        string\n\tOperation      string\n}\n```\nAn Endpoint describes how to access a Git LFS server.\n\n```go\ntype EndpointFinder interface {\n\tNewEndpointFromCloneURL(rawurl string) Endpoint\n\tNewEndpoint(rawurl string) Endpoint\n\tEndpoint(operation, remote string) Endpoint\n\tRemoteEndpoint(operation, remote string) Endpoint\n\tGitRemoteURL(remote string, forpush bool) string\n\tAccessFor(rawurl string) Access\n\tSetAccess(rawurl string, access Access)\n\tGitProtocol() string\n}\n```\n\n```go\nfunc NewEndpointFinder(ctx Context) EndpointFinder\n```\n\n```go\ntype NetrcFinder interface {\n\tFindMachine(string) *netrc.Machine\n}\n```\n\n```go\nfunc ParseNetrc(osEnv config.Environment) (NetrcFinder, string, error)\n```\n\n```go\ntype ReadSeekCloser interface {\n\tio.Seeker\n\tio.ReadCloser\n}\n```\n\n```go\nfunc NewByteBody(by []byte) ReadSeekCloser\n```\n\n```go\ntype SSHResolver interface {\n\tResolve(Endpoint, string) (sshAuthResponse, error)\n}\n```\n\n","path":"github.com/2lambda123/git-lfs/lfsapi","name":"lfsapi","synopsis":"","isRedistributable":true}
