50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package mutations
|
|
|
|
import (
|
|
"git.lehouerou.net/laurent/sorare/graphql"
|
|
"git.lehouerou.net/laurent/sorare/types"
|
|
)
|
|
|
|
type ExchangeRate struct {
|
|
Id graphql.Id `graphql:"id"`
|
|
}
|
|
|
|
type Mutations struct {
|
|
c *graphql.Client
|
|
|
|
ExchangeRate *graphql.Query[ExchangeRate, graphql.EmptyParams]
|
|
|
|
defaultSettlementCurrencies []types.SupportedCurrency
|
|
}
|
|
|
|
func NewMutations(c *graphql.Client) *Mutations {
|
|
return &Mutations{
|
|
c: c,
|
|
ExchangeRate: graphql.NewQuery[ExchangeRate, graphql.EmptyParams](
|
|
c,
|
|
"exchangeRate",
|
|
[]string{"config"},
|
|
),
|
|
}
|
|
}
|
|
|
|
func (m *Mutations) SetDefaultSettlementCurrencies(currencies []types.SupportedCurrency) {
|
|
m.defaultSettlementCurrencies = currencies
|
|
}
|
|
|
|
type MutationError struct {
|
|
Code int
|
|
Message string
|
|
Path []string
|
|
}
|
|
|
|
type BaseMutationPayload struct {
|
|
Errors []MutationError `graphql:"errors"`
|
|
}
|
|
|
|
type AuthorizationPayload struct {
|
|
BaseMutationPayload
|
|
Authorizations []AuthorizationRequest `graphql:"authorizations"`
|
|
ClientMutationId string `graphql:"clientMutationId"`
|
|
}
|