This repository has been archived on 2022-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
shared/tw/urlbuilder/build_url.go
Kichiyaki e70c73a3fa refactor, add two new packages tw/urlbuilder and tw/twutil
tw/dataloader:
- Move endpoints to the new file
- use errors.New instead of fmt.Errorf
- new error messages
2021-05-02 09:44:49 +02:00

26 lines
753 B
Go

package urlbuilder
import "fmt"
const (
EndpointTribeProfile = "/game.php?screen=info_ally&id=%d"
EndpointPlayerProfile = "/game.php?screen=info_player&id=%d"
EndpointVillageProfile = "/game.php?screen=info_village&id=%d"
)
func BuildServerURL(server, host string) string {
return fmt.Sprintf("https://%s.%s", server, host)
}
func BuildPlayerURL(server, host string, id int) string {
return BuildServerURL(server, host) + fmt.Sprintf(EndpointPlayerProfile, id)
}
func BuildVillageURL(server, host string, id int) string {
return BuildServerURL(server, host) + fmt.Sprintf(EndpointVillageProfile, id)
}
func BuildTribeURL(server, host string, id int) string {
return BuildServerURL(server, host) + fmt.Sprintf(EndpointTribeProfile, id)
}