create embed post for epic games

because they no longer create them for urls
This commit is contained in:
Seraphim Strub 2024-05-29 21:35:12 +00:00
parent b6d8863195
commit 1d5c7056be
4 changed files with 28 additions and 8 deletions

View file

@ -42,8 +42,12 @@ type epicApiBody struct {
Description string `json:"description"`
OfferType string `json:"offerType"`
IsCodeRedemptionOnly bool `json:"isCodeRedemptionOnly"`
ProductSlug string `json:"productSlug"`
OfferMappings []struct {
KeyImages []struct {
Type string `json:"type"`
Url string `json:"url"`
} `json:"keyImages"`
ProductSlug string `json:"productSlug"`
OfferMappings []struct {
PageSlug string `json:"pageSlug"`
PageType string `json:"pageType"`
} `json:"offerMappings"`
@ -119,6 +123,13 @@ func (e EpicStruct) Load() error {
continue
}
image := ""
for _, keyImage := range element.KeyImages {
if keyImage.Type == "DieselStoreFrontWide" {
image = keyImage.Url
}
}
id := fmt.Sprintf("%v%v", e.idPrefix, element.Id)
title := element.Title
url := fmt.Sprintf("%v%v", e.baseUrl, productSlug)
@ -127,6 +138,7 @@ func (e EpicStruct) Load() error {
Id: id,
Title: title,
Url: url,
Image: image,
}
}