2019-02-09 12:30:49 +00:00
|
|
|
package urlbuilders
|
|
|
|
|
2021-03-13 00:49:20 +00:00
|
|
|
import (
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
|
|
"strconv"
|
|
|
|
)
|
2019-02-09 12:30:49 +00:00
|
|
|
|
2019-02-14 22:53:32 +00:00
|
|
|
type PerformerURLBuilder struct {
|
|
|
|
BaseURL string
|
2019-02-09 12:30:49 +00:00
|
|
|
PerformerID string
|
2021-03-13 00:49:20 +00:00
|
|
|
UpdatedAt string
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|
|
|
|
|
2021-03-13 00:49:20 +00:00
|
|
|
func NewPerformerURLBuilder(baseURL string, performer *models.Performer) PerformerURLBuilder {
|
2019-02-14 22:53:32 +00:00
|
|
|
return PerformerURLBuilder{
|
|
|
|
BaseURL: baseURL,
|
2021-03-13 00:49:20 +00:00
|
|
|
PerformerID: strconv.Itoa(performer.ID),
|
|
|
|
UpdatedAt: strconv.FormatInt(performer.UpdatedAt.Timestamp.Unix(), 10),
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-14 22:53:32 +00:00
|
|
|
func (b PerformerURLBuilder) GetPerformerImageURL() string {
|
2021-03-13 00:49:20 +00:00
|
|
|
return b.BaseURL + "/performer/" + b.PerformerID + "/image?" + b.UpdatedAt
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|