Add a config to get inventaire.io URL

This commit is contained in:
2026-02-09 00:17:11 +01:00
parent f73defdad3
commit 60c610de42
11 changed files with 52 additions and 50 deletions

View File

@@ -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
}