Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Leaderboards and statistic rotations #3

Merged
merged 2 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,22 @@
"Statistic-related data."
type Statistics {
"Returns the raw value stored for this statistic."
value(

Check notice on line 243 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'Statistics.value' is deprecated

Field 'Statistics.value' is deprecated

Check notice on line 243 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

Field 'Statistics.value' has deprecation reason 'This value is not backed by a rotation and will be removed. Use `rotationValue` instead.'

Field 'Statistics.value' has deprecation reason 'This value is not backed by a rotation and will be removed. Use `rotationValue` instead.'
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.

The returned number will be `null` if the statistic does not track in the provided rotation, or if the statistic doesn't exist.
"""
rotationValue(

Check notice on line 254 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 +266,41 @@

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

"""
The rotations for which this statistic is tracked.

These are the rotations that can be used to generate leaderboards or fetch rotation values.
Note that the `YEARLY` rotation never generates leaderboards, even if it is returned in this list.
"""
rotations: [Rotation!]!

Check notice on line 276 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`.
"""
leaderboard(

Check notice on line 283 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 290 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.
However, for Crown Level or Trophy count leaderboards, the player will not be `null`.
"""
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 +312,28 @@
value: Int!
}

"""
A rotation period.

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

Check notice on line 320 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 +352,26 @@

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

"Returns a statistic by it's name."
statistic(

Check notice on line 357 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

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

Field 'statistic' was added to object type 'Query'
key: String!
@spectaql(options: [{ key: "example", value: "games_played" }])
): 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 367 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.
"""
previousRotation(rotation: Rotation!): DateTime!

Check notice on line 374 in schema.graphqls

View workflow job for this annotation

GitHub Actions / GraphQL Inspector

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

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

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