stash/internal/api/urlbuilders/studio.go
Flashy78 a665a56ef0
Studio Tagger (#3510)
* Studio image and parent studio support in scene tagger
* Refactor studio backend and add studio tagger
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
2023-07-31 09:50:24 +10:00

29 lines
607 B
Go

package urlbuilders
import (
"strconv"
"github.com/stashapp/stash/pkg/models"
)
type StudioURLBuilder struct {
BaseURL string
StudioID string
UpdatedAt string
}
func NewStudioURLBuilder(baseURL string, studio *models.Studio) StudioURLBuilder {
return StudioURLBuilder{
BaseURL: baseURL,
StudioID: strconv.Itoa(studio.ID),
UpdatedAt: strconv.FormatInt(studio.UpdatedAt.Unix(), 10),
}
}
func (b StudioURLBuilder) GetStudioImageURL(hasImage bool) string {
url := b.BaseURL + "/studio/" + b.StudioID + "/image?t=" + b.UpdatedAt
if !hasImage {
url += "&default=true"
}
return url
}