|
10 | 10 | "collections_type",
|
11 | 11 | "crown_level_type",
|
12 | 12 | "currency_type",
|
| 13 | + "leaderboard_entry_type", |
13 | 14 | "party_type",
|
14 | 15 | "player_type",
|
15 | 16 | "progression_data_type",
|
|
92 | 93 | }
|
93 | 94 | )
|
94 | 95 |
|
| 96 | +leaderboard_entry_type = GraphQLObjectType( |
| 97 | + name="LeaderboardEntry", |
| 98 | + description="An entry in a leaderboard.", |
| 99 | + fields=lambda: { |
| 100 | + "player": GraphQLField( |
| 101 | + player_type, |
| 102 | + description="The player who has this entry.\n\n" |
| 103 | + "This will be `null` if the player does not have the statistics enabled for the API.\n" |
| 104 | + "However, for Crown Level or Trophy count leaderboards, the player will not be `null`." |
| 105 | + ), |
| 106 | + "rank": GraphQLField( |
| 107 | + GraphQLNonNull(GraphQLInt), |
| 108 | + description="The rank for this entry." |
| 109 | + ), |
| 110 | + "value": GraphQLField( |
| 111 | + GraphQLNonNull(GraphQLInt), |
| 112 | + description="The value for this entry." |
| 113 | + ) |
| 114 | + } |
| 115 | +) |
| 116 | + |
95 | 117 | party_type = GraphQLObjectType(
|
96 | 118 | name="Party",
|
97 | 119 | description="A player's status within a party.",
|
|
202 | 224 | "statistics": GraphQLField(
|
203 | 225 | GraphQLNonNull(GraphQLList(GraphQLNonNull(statistic_type))),
|
204 | 226 | description="Returns a list of all known statistics."
|
| 227 | + ), |
| 228 | + "statistic": GraphQLField( |
| 229 | + statistic_type, |
| 230 | + description="Returns a statistic by it's name.", |
| 231 | + args={ |
| 232 | + "key": GraphQLArgument( |
| 233 | + GraphQLNonNull(GraphQLString) |
| 234 | + ) |
| 235 | + } |
| 236 | + ), |
| 237 | + "nextRotation": GraphQLField( |
| 238 | + GraphQLNonNull(datetime_scalar), |
| 239 | + description="Returns when this rotation will next rotate.\n\n" |
| 240 | + "If the rotation is due the exact time this method is called, " |
| 241 | + "this method will return the next time that it will rotate.", |
| 242 | + args={ |
| 243 | + "rotation": GraphQLArgument( |
| 244 | + GraphQLNonNull(rotation_enum) |
| 245 | + ) |
| 246 | + } |
| 247 | + ), |
| 248 | + "previousRotation": GraphQLField( |
| 249 | + GraphQLNonNull(datetime_scalar), |
| 250 | + description="Returns when this rotation last rotated.\n\n" |
| 251 | + "If the rotation is due the exact time this method is called, " |
| 252 | + "this method will return the current time.", |
| 253 | + args={ |
| 254 | + "rotation": GraphQLArgument( |
| 255 | + GraphQLNonNull(rotation_enum) |
| 256 | + ) |
| 257 | + } |
205 | 258 | )
|
206 | 259 | }
|
207 | 260 | )
|
|
251 | 304 | "key": GraphQLField(
|
252 | 305 | GraphQLNonNull(GraphQLString),
|
253 | 306 | description="The key of the statistic."
|
| 307 | + ), |
| 308 | + "leaderboard": GraphQLField( |
| 309 | + GraphQLList(GraphQLNonNull(leaderboard_entry_type)), |
| 310 | + description="Returns the leaderboard for this statistic in a given rotation.\n\n" |
| 311 | + "If this statistic does not generate leaderboards, " |
| 312 | + "or the statistic is not tracked for the provided rotation, this will return `null`.", |
| 313 | + args={ |
| 314 | + "amount": GraphQLArgument( |
| 315 | + GraphQLNonNull(GraphQLInt), |
| 316 | + default_value=10 |
| 317 | + ), |
| 318 | + "rotation": GraphQLArgument( |
| 319 | + GraphQLNonNull(rotation_enum), |
| 320 | + default_value=rotation_enum.values["LIFETIME"].value |
| 321 | + ) |
| 322 | + } |
| 323 | + ), |
| 324 | + "rotations": GraphQLField( |
| 325 | + GraphQLNonNull(GraphQLList(GraphQLNonNull(rotation_enum))), |
| 326 | + description="The rotations for which this statistic is tracked.\n\n" |
| 327 | + "These are the rotations that can be used to generate leaderboards or fetch rotation values.\n" |
| 328 | + "Note that the `YEARLY` rotation never generates leaderboards, " |
| 329 | + "even if it is returned in this list." |
254 | 330 | )
|
255 | 331 | }
|
256 | 332 | )
|
|
281 | 357 | "statisticKey": GraphQLArgument(
|
282 | 358 | GraphQLNonNull(GraphQLString)
|
283 | 359 | )
|
| 360 | + }, |
| 361 | + deprecation_reason="This value is not backed by a rotation and will be removed. " |
| 362 | + "Use `rotationValue` instead." |
| 363 | + ), |
| 364 | + "rotationValue": GraphQLField( |
| 365 | + GraphQLInt, |
| 366 | + description="Returns the value stored for the given statistic in a rotation.\n\n" |
| 367 | + "The returned number will be `null` if the statistic does not track in the provided rotation, " |
| 368 | + "or if the statistic doesn't exist.", |
| 369 | + args={ |
| 370 | + "rotation": GraphQLArgument( |
| 371 | + GraphQLNonNull(rotation_enum), |
| 372 | + default_value=rotation_enum.values["LIFETIME"].value |
| 373 | + ), |
| 374 | + "statisticKey": GraphQLArgument( |
| 375 | + GraphQLNonNull(GraphQLString) |
| 376 | + ) |
284 | 377 | }
|
285 | 378 | )
|
286 | 379 | }
|
|
0 commit comments