Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( PollInterval = time.Second PollRetries = 10 )
var ErrNotFound = errors.New("receipt not found")
Functions ¶
func NewHandler ¶
NewHandler creates a new http.Handler that serves receipt containers. It expects the URL path to end with the task CID, e.g. /receipt/<task-cid>
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Fetch ¶
Fetch a receipt from the receipt API. Returns ErrNotFound if the API responds with http.StatusNotFound.
type PollOption ¶
type PollOption func(opt *pollConfig)
func WithInterval ¶
func WithInterval(interval time.Duration) PollOption
WithInterval configures the time to wait between poll requests. The default is PollInterval.
func WithRetries ¶
func WithRetries(n int) PollOption
WithRetries configures the maximum number of times that Poll will attempt to fetch a receipt. The default is PollRetries requests. Set it to -1 to poll until a non-404 response is encountered.