Add a config to get inventaire.io URL
This commit is contained in:
@@ -18,18 +18,14 @@ type InventaireSearchBook struct {
|
||||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
func GetBaseInventaireUrl() string {
|
||||
return "https://inventaire.io"
|
||||
}
|
||||
|
||||
func computeInventaireApiUrl(paths ...string) (*url.URL, error) {
|
||||
baseUrl := GetBaseInventaireUrl() + "/api"
|
||||
func computeInventaireApiUrl(inventaireUrl string, paths ...string) (*url.URL, error) {
|
||||
baseUrl := inventaireUrl + "/api"
|
||||
return callapiutils.ComputeUrl(baseUrl, paths...)
|
||||
}
|
||||
|
||||
func CallInventaireSearch(searchterm string, lang string, limit int, offset int) (InventaireSearchResult, error) {
|
||||
func CallInventaireSearch(inventaireUrl string, searchterm string, lang string, limit int, offset int) (InventaireSearchResult, error) {
|
||||
var queryResult InventaireSearchResult
|
||||
u, err := computeInventaireApiUrl("search")
|
||||
u, err := computeInventaireApiUrl(inventaireUrl, "search")
|
||||
if err != nil {
|
||||
return queryResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user