Skip to content

Commit

Permalink
feature: Leaderboards and statistic rotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kezz committed May 7, 2024
1 parent c73802e commit ea44974
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ type Statistics {
statisticKey: String!
@spectaql(options: [{ key: "example", value: "games_played" }])
): StatisticValueResult
@deprecated(reason: "This value is not backed by a rotation and will be removed. Use `rotationValue` instead.")

"Returns the value stored for the given statistic in a rotation."
rotationValue(

Check notice on line 250 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'rotationValue' was added to object type 'Statistics'

Field 'rotationValue' was added to object type 'Statistics'
statisticKey: String!
@spectaql(options: [{ key: "example", value: "games_played" }]),
rotation: Rotation! = LIFETIME,
): Int
}

"A statistic."
Expand All @@ -254,6 +262,36 @@ type Statistic {

"If this statistic generates leaderboards."
forLeaderboard: Boolean!

"The rotations for which this statistic is tracked."
rotations: [Rotation!]!

Check notice on line 267 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'rotations' was added to object type 'Statistic'

Field 'rotations' was added to object type 'Statistic'

"""
Returns the leaderboard for this statistic in a given rotation.
If this statistic does not generate leaderboards, or the statistic is not tracked for the provided rotation, this will return `null`.
Additionally, the amount is capped at 20.
"""
leaderboard(

Check notice on line 275 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'leaderboard' was added to object type 'Statistic'

Field 'leaderboard' was added to object type 'Statistic'
rotation: Rotation! = LIFETIME,
amount: Int! = 10,
): [LeaderboardEntry!]
}

"An entry in a leaderboard."
type LeaderboardEntry {

Check notice on line 282 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Type 'LeaderboardEntry' was added

Type 'LeaderboardEntry' was added
"""
The player who has this entry.
This will be `null` if the player does not have the statistics enabled for the API.
"""
player: Player

"The rank for this entry."
rank: Int!

"The value for this entry."
value: Int!
}

"The result of fetching a value of a statistic."
Expand All @@ -265,6 +303,28 @@ type StatisticValueResult {
value: Int!
}

"""
A rotation period.
Each period resets at 10AM UTC.
"""
enum Rotation {

Check notice on line 311 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Type 'Rotation' was added

Type 'Rotation' was added
"A daily rotation that resets."
DAILY

"A weekly rotation that resets on Tuesdays."
WEEKLY

"A monthly rotation that resets on the first day of every month."
MONTHLY

"A yearly rotation that resets on the first day of every year."
YEARLY

"A lifetime rotation; a rotation period used to indicate something never rotates."
LIFETIME
}

"Available queries."
type Query {
"Given a UUID, returns a Player if they have logged in to MCC Island."
Expand All @@ -283,6 +343,20 @@ type Query {

"Returns a list of all known statistics."
statistics: [Statistic!]!

"""
Returns when this rotation will next rotate.
If the rotation is due the exact time this method is called, this method will return the next time that it will rotate.
"""
nextRotation(rotation: Rotation!): DateTime!

Check notice on line 352 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'nextRotation' was added to object type 'Query'

Field 'nextRotation' was added to object type 'Query'

"""
Returns when this rotation last rotated.
If the rotation is due the exact time this method is called, this method will return the current time.
"""
lastRotation(rotation: Rotation!): DateTime!

Check notice on line 359 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'lastRotation' was added to object type 'Query'

Field 'lastRotation' was added to object type 'Query'
}

"Internal directive used to generate some documentation elements."
Expand Down

0 comments on commit ea44974

Please sign in to comment.