func WithAuth(c *Client, username, password string) *Client { if username != "" && password != "" { authFunc := func(req *http.Request) *http.Request { req.SetBasicAuth(username, password) return req } c.api = httpctx.WithAuthFunc(authFunc) c.Download = downloadFunc(authFunc) } return c }
func FromPassword(domain, email, password string) *Client { e := email p := password authFunc := func(req *http.Request) *http.Request { req.SetBasicAuth(e, p) return req } return &Client{ domain: domain, http: httpctx.WithAuthFunc(authFunc), } }
func FromToken(domain, email, token string) *Client { username := fmt.Sprintf("%s/token", email) password := token authFunc := func(req *http.Request) *http.Request { req.SetBasicAuth(username, password) return req } return &Client{ domain: domain, http: httpctx.WithAuthFunc(authFunc), } }