Operations¶
Ready-to-use operation documents, one per file under operations/. Each is validated against the
schema on every change. Fill in the variables shown in the Integration guide.
UpsertTournament¶
# Tournament name and dates. Idempotent upsert keyed by your providerId.
mutation UpsertTournament($input: TournamentInput!) {
upsertTournament(input: $input) {
accepted
message
id
}
}
UpsertCourse¶
# A course of a tournament, with its holes and par. A complete description: re-send the whole course
# to change it.
mutation UpsertCourse($input: CourseInput!) {
upsertCourse(input: $input) {
accepted
message
id
}
}
UpsertRound¶
# A round of a tournament, played on one of its courses. Every group and stroke is keyed by it.
mutation UpsertRound($input: RoundInput!) {
upsertRound(input: $input) {
accepted
message
id
}
}
UpsertGroup¶
# A group (pairing) of a round with its players. The players listed are exactly the group's players:
# anyone left out is removed from it. Players belong to the tournament, so the same providerId in another
# round is the same player.
mutation UpsertGroup($input: GroupInput!) {
upsertGroup(input: $input) {
accepted
message
id
}
}
SetupRound¶
# The whole setup of a round in one request: aliased mutations run in order, each with its own result.
# Nothing is threaded between them: every reference is your own providerId.
mutation SetupRound(
$tournament: TournamentInput!
$course: CourseInput!
$round: RoundInput!
$group: GroupInput!
) {
tournament: upsertTournament(input: $tournament) { accepted message id }
course: upsertCourse(input: $course) { accepted message id }
round: upsertRound(input: $round) { accepted message id }
group: upsertGroup(input: $group) { accepted message id }
}
UpsertStroke¶
# A stroke report: a player's stroke at one moment (READY, OVER_THE_BALL or HIT, at `at`). Send one per
# stroke at HIT, or one per status change; a report only changes the fields it carries, and resending the
# same report is a no-op.
mutation UpsertStroke($input: StrokeInput!) {
upsertStroke(input: $input) {
accepted
message
id
}
}
RetractStroke¶
# Withdraw a stroke reported in error. Its ball position is published again with retracted: true.
mutation RetractStroke($input: RetractStrokeInput!) {
retractStroke(input: $input) {
accepted
message
id
}
}
GetRound¶
# A round with its tournament, course, holes and groups, by your provider ids.
query GetRound($tournament: String!, $round: String!) {
rounds(where: {providerId: {_eq: $round}, tournament: {providerId: {_eq: $tournament}}}) {
providerId
num
tournament {
providerId
name
startDate
endDate
}
course {
providerId
name
holes(order_by: {number: asc}) {
number
par
}
}
groups(order_by: {startHoleOrder: asc}) {
providerId
startHole
startHoleOrder
segment
players(order_by: {order: asc}) {
order
player {
providerId
firstName
lastName
}
}
}
}
}
SubscribeToBallPositionEvents¶
# Every ball position revision of a round, in revision order, resuming after $afterRevision (0 replays
# the round). Queue semantics: resumable and at-least-once. Persist the highest revision you processed.
subscription SubscribeToBallPositionEvents(
$tournament: String!
$round: String!
$afterRevision: bigint!
$batchSize: Int!
) {
ballPositionEvents(
batch_size: $batchSize
cursor: {initial_value: {revision: $afterRevision}, ordering: ASC}
where: {round: {providerId: {_eq: $round}, tournament: {providerId: {_eq: $tournament}}}}
) {
revision
strokeId
strokeProviderId
strokeNum
strokeKind
hole
holeOrder
player {
providerId
}
group {
providerId
}
lat
lon
elevation
surface
subSurface
state
inTheHole
retracted
hatArgb
shirtArgb
pantsArgb
observedAt
recordedAt
}
}
SubscribeToBallPositions¶
# The current best position of every stroke of a round. State semantics: the current set on connect,
# then the whole set again on every change. Add `hole: {_eq: 7}` to the where to follow one hole.
subscription SubscribeToBallPositions($tournament: String!, $round: String!) {
ballPositions(
where: {round: {providerId: {_eq: $round}, tournament: {providerId: {_eq: $tournament}}}}
order_by: {strokeId: asc}
) {
revision
strokeId
strokeProviderId
strokeNum
strokeKind
hole
holeOrder
player {
providerId
}
lat
lon
elevation
surface
subSurface
state
inTheHole
retracted
observedAt
}
}
SubscribeToHoleReferences¶
# Pin and tee positions of a round. Pins move daily: subscribe rather than cache.
subscription SubscribeToHoleReferences($tournament: String!, $round: String!) {
holeReferences(
where: {round: {providerId: {_eq: $round}, tournament: {providerId: {_eq: $tournament}}}}
order_by: [{hole: asc}, {type: asc}]
) {
hole
type
lat
lon
elevation
updatedAt
}
}