Documentation ¶
Overview ¶
Package client implements some interfaces and convenience methods to interact with Vercel APIs and Remote Cache
Index ¶
- Variables
- type APIClient
- func (c *APIClient) ArtifactExists(hash string) (*http.Response, error)
- func (c *APIClient) FetchArtifact(hash string) (*http.Response, error)
- func (c *APIClient) GetTeamID() string
- func (c *APIClient) IsLinked() bool
- func (c *APIClient) JSONPatch(ctx context.Context, endpoint string, body []byte) ([]byte, error)
- func (c *APIClient) JSONPost(ctx context.Context, endpoint string, body []byte) ([]byte, error)
- func (c *APIClient) PutArtifact(hash string, artifactBody []byte, duration int, tag string) error
- func (c *APIClient) RecordAnalyticsEvents(ctx context.Context, events []map[string]interface{}) error
- func (c *APIClient) SetToken(token string)
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyFailures = errors.New("skipping HTTP Request, too many failures have occurred")
ErrTooManyFailures is returned from remote cache API methods after `maxRemoteFailCount` errors have occurred
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { HTTPClient *retryablehttp.Client // contains filtered or unexported fields }
APIClient is the main interface for making network requests to Vercel
func NewClient ¶
func NewClient(config turbostate.APIClientConfig, logger hclog.Logger, turboVersion string) *APIClient
NewClient creates a new APIClient
func (*APIClient) ArtifactExists ¶
ArtifactExists attempts to determine if the build artifact with the given hash exists in the Remote Caching server
func (*APIClient) FetchArtifact ¶
FetchArtifact attempts to retrieve the build artifact with the given hash from the remote cache
func (*APIClient) JSONPatch ¶
JSONPatch sends a byte array (json.marshalled payload) to a given endpoint with PATCH
func (*APIClient) JSONPost ¶
JSONPost sends a byte array (json.marshalled payload) to a given endpoint with POST
func (*APIClient) PutArtifact ¶
PutArtifact uploads an artifact associated with a given hash string to the remote cache