github.com/seeker-insurance/kit@v0.0.13/opentable/opentable.go (about) 1 package opentable 2 3 import ( 4 "os" 5 6 "github.com/parnurzeal/gorequest" 7 ) 8 9 var _ = gorequest.GET 10 11 const tokenKey = "OPENTABLE_ACCESS_TOKEN" 12 const endpoint = "https://opentable.herokuapp.com/api" 13 14 //BadRequestError represents invalid request parameter(s). 15 type BadRequestError string 16 17 func (err BadRequestError) Error() string { return string(err) } 18 19 const ( 20 errBadPage BadRequestError = "page must be >= 0" 21 errBadPrice BadRequestError = "price must be blank or in the closed interval [0, 4]" 22 errBadPerPage BadRequestError = "entries per page must be in one of the following: {5, 10, 15, 25, 50, 100}" 23 errEmptyRequest BadRequestError = "request must specify at least one parameter" 24 ) 25 26 func accessToken() (string, bool) { 27 return os.LookupEnv(tokenKey) 28 } 29 30 type Query struct { 31 Offset int `json:"offset,omitempty" bson:"offset,omitempty"` 32 Limit int `json:"limit,omitempty" bson:"limit,omitempty"` 33 Country string `json:"country,omitempty" bson:"country,omitempty"` 34 }