Inventaire API: display search image

This commit is contained in:
2026-01-17 16:15:34 +01:00
parent a04aff6056
commit 8d3569e5d6
4 changed files with 25 additions and 10 deletions

View File

@@ -15,16 +15,21 @@ type InventaireSearchBook struct {
ID string `json:"id"`
Label string `json:"label"`
Description string `json:"description"`
Image string `json:"image"`
}
func computeInventaireUrl(paths ...string) (*url.URL, error) {
baseUrl := "https://inventaire.io/api"
func GetBaseInventaireUrl() string {
return "https://inventaire.io"
}
func computeInventaireApiUrl(paths ...string) (*url.URL, error) {
baseUrl := GetBaseInventaireUrl() + "/api"
return callapiutils.ComputeUrl(baseUrl, paths...)
}
func CallInventaireSearch(searchterm string, limit int, offset int) (InventaireSearchResult, error) {
var queryResult InventaireSearchResult
u, err := computeInventaireUrl("search")
u, err := computeInventaireApiUrl("search")
if err != nil {
return queryResult, err
}

View File

@@ -88,7 +88,7 @@ func findLangageField(multipleMessageFields map[string]json.RawMessage, lang str
func CallInventaireBook(inventaireId string, lang string) (InventaireBookResult, error) {
queryResult := InventaireBookResult{ID: inventaireId, Lang: lang}
u, err := computeInventaireUrl("entities")
u, err := computeInventaireApiUrl("entities")
if err != nil {
return queryResult, err
}