Add a config to get inventaire.io URL
This commit is contained in:
@@ -26,9 +26,9 @@ type inventaireReverseClaimsResult struct {
|
||||
Uris []string `json:"uris"`
|
||||
}
|
||||
|
||||
func CallInventaireEditionFromWork(workId string, lang string, limit int, offset int) (InventaireEditionResult, error) {
|
||||
func CallInventaireEditionFromWork(inventaireUrl string, workId string, lang string, limit int, offset int) (InventaireEditionResult, error) {
|
||||
var queryResult InventaireEditionResult
|
||||
uris, err := callInventaireUris(workId)
|
||||
uris, err := callInventaireUris(inventaireUrl, workId)
|
||||
if err != nil {
|
||||
return queryResult, err
|
||||
}
|
||||
@@ -41,7 +41,7 @@ func CallInventaireEditionFromWork(workId string, lang string, limit int, offset
|
||||
endIndex := int(math.Min(float64(limit+offset), float64(l)))
|
||||
limitedUris = uris.Uris[startIndex:endIndex]
|
||||
}
|
||||
editionEntities, err := callInventaireEditionEntities(limitedUris)
|
||||
editionEntities, err := callInventaireEditionEntities(inventaireUrl, limitedUris)
|
||||
|
||||
if err != nil {
|
||||
return queryResult, err
|
||||
@@ -55,7 +55,7 @@ func CallInventaireEditionFromWork(workId string, lang string, limit int, offset
|
||||
for _, entity := range sortedEntities {
|
||||
publisher := ""
|
||||
if entity.EditionId != "" {
|
||||
publisher, err = callInventairePublisherGetName(entity.EditionId, lang)
|
||||
publisher, err = callInventairePublisherGetName(inventaireUrl, entity.EditionId, lang)
|
||||
if err != nil {
|
||||
return queryResult, err
|
||||
}
|
||||
@@ -73,9 +73,9 @@ func CallInventaireEditionFromWork(workId string, lang string, limit int, offset
|
||||
return queryResult, err
|
||||
}
|
||||
|
||||
func callInventaireUris(workId string) (inventaireReverseClaimsResult, error) {
|
||||
func callInventaireUris(inventaireUrl string, workId string) (inventaireReverseClaimsResult, error) {
|
||||
var queryResult inventaireReverseClaimsResult
|
||||
u, err := computeInventaireApiUrl("entities")
|
||||
u, err := computeInventaireApiUrl(inventaireUrl, "entities")
|
||||
if err != nil {
|
||||
return queryResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user