sorare/football/competition.go

46 lines
1.4 KiB
Go

package football
import (
"git.lehouerou.net/laurent/sorare/graphql"
)
type Competition struct {
Id graphql.Id `graphql:"id"`
DisplayName string `graphql:"displayName"`
Slug string `graphql:"slug"`
Country struct {
Slug string `graphql:"slug"`
} `graphql:"country"`
Format string `graphql:"format"`
Type string `graphql:"type"`
PictureUrl string `graphql:"pictureUrl"`
LogoUrl string `graphql:"logoUrl"`
BackgroundColor string `graphql:"backgroundColor"`
BackgroundPictureUrl string `graphql:"backgroundPictureUrl"`
OpenForGameStats bool `graphql:"openForGameStats"`
Released bool `graphql:"released"`
Seasons []struct {
StartYear int `graphql:"startYear"`
}
}
func (f *Football) NewCompetitionClubs(
competitionSlug string,
) *graphql.PaginatedQuery[Club, graphql.EmptyParams] {
return graphql.NewPaginatedQuery[Club, graphql.EmptyParams](
f.c,
"clubs",
[]string{"football", "competition(slug:$slug)"},
).WithQueryParam("slug", competitionSlug)
}
func (f *Football) NewCompetitionPlayersByLastFiveAverage(
competitionSlug string,
) *graphql.PaginatedQuery[Player, graphql.EmptyParams] {
return graphql.NewPaginatedQuery[Player, graphql.EmptyParams](
f.c,
"playersByLastFiveAverage",
[]string{"football", "competition(slug:$slug)"},
).WithQueryParam("slug", competitionSlug)
}