|
1 | 1 | from .enums import * |
| 2 | +from .interfaces import * |
2 | 3 | from .scalars import * |
3 | 4 | from graphql import ( |
4 | 5 | GraphQLArgument, GraphQLBoolean, GraphQLField, GraphQLInputField, GraphQLInputObjectType, |
|
7 | 8 |
|
8 | 9 |
|
9 | 10 | __all__ = [ |
| 11 | + "auction_listing_type", |
10 | 12 | "collections_type", |
11 | 13 | "cosmetic_type", |
12 | 14 | "cosmetic_ownership_state_type", |
| 15 | + "cosmetic_token_type", |
13 | 16 | "crown_level_type", |
14 | 17 | "currency_type", |
15 | 18 | "fish_type", |
16 | 19 | "fish_caught_weight_type", |
17 | 20 | "fish_record_type", |
| 21 | + "island_exchange_listing_type", |
18 | 22 | "leaderboard_entry_type", |
19 | 23 | "level_data_type", |
20 | 24 | "mcc_plus_status_type", |
|
24 | 28 | "query_type", |
25 | 29 | "royal_reputation_type", |
26 | 30 | "server_type", |
| 31 | + "simple_asset_type", |
27 | 32 | "social_type", |
28 | 33 | "statistic_type", |
29 | 34 | "statistic_value_result_type", |
|
33 | 38 | "trophy_data_type" |
34 | 39 | ] |
35 | 40 |
|
| 41 | +auction_listing_type = GraphQLObjectType( |
| 42 | + name="AuctionListing", |
| 43 | + description="An auction listing.", |
| 44 | + fields={ |
| 45 | + "asset": GraphQLField( |
| 46 | + GraphQLNonNull(asset_interface), |
| 47 | + description="The asset that is being auctioned." |
| 48 | + ), |
| 49 | + "cost": GraphQLField( |
| 50 | + GraphQLNonNull(GraphQLInt), |
| 51 | + description="The current cost of the auction." |
| 52 | + ), |
| 53 | + "endTime": GraphQLField( |
| 54 | + GraphQLNonNull(datetime_scalar), |
| 55 | + description="The time this auction will end." |
| 56 | + ), |
| 57 | + "identifier": GraphQLField( |
| 58 | + GraphQLNonNull(uuid_scalar), |
| 59 | + description="A unique identifier for this listing.\n\n" |
| 60 | + "This can be used to deduplicate listings if storing externally." |
| 61 | + ), |
| 62 | + "lastUpdateTime": GraphQLField( |
| 63 | + GraphQLNonNull(datetime_scalar), |
| 64 | + description="The time this auction received a bid or the start time if no bids have been made yet." |
| 65 | + ) |
| 66 | + } |
| 67 | +) |
| 68 | + |
36 | 69 | collections_type = GraphQLObjectType( |
37 | 70 | name="Collections", |
38 | 71 | description="Collections data.", |
|
74 | 107 |
|
75 | 108 | cosmetic_type = GraphQLObjectType( |
76 | 109 | name="Cosmetic", |
| 110 | + interfaces=[asset_interface], |
77 | 111 | description="A cosmetic.", |
78 | 112 | fields=lambda: { |
79 | 113 | "name": GraphQLField( |
|
136 | 170 | "type": GraphQLField( |
137 | 171 | GraphQLNonNull(cosmetic_type_enum), |
138 | 172 | description="The type of this cosmetic." |
| 173 | + ), |
| 174 | + "uniqueIdentifier": GraphQLField( |
| 175 | + GraphQLNonNull(uuid_scalar), |
| 176 | + description="A unique identifier for this specific type of asset.\n\n" |
| 177 | + "This is based on the internal identifier for this asset and can be used " |
| 178 | + "to track it over time.\n" |
| 179 | + "For example, if the name of this asset changed, the identifier would remain the same." |
139 | 180 | ) |
140 | 181 | } |
141 | 182 | ) |
|
164 | 205 | } |
165 | 206 | ) |
166 | 207 |
|
| 208 | +cosmetic_token_type = GraphQLObjectType( |
| 209 | + name="CosmeticToken", |
| 210 | + interfaces=[asset_interface], |
| 211 | + description="A cosmetic token.", |
| 212 | + fields={ |
| 213 | + "cosmetic": GraphQLField( |
| 214 | + GraphQLNonNull(cosmetic_type), |
| 215 | + description="The cosmetic this token holds." |
| 216 | + ), |
| 217 | + "name": GraphQLField( |
| 218 | + GraphQLNonNull(GraphQLString), |
| 219 | + description="The name of this cosmetic token." |
| 220 | + ), |
| 221 | + "rarity": GraphQLField( |
| 222 | + GraphQLNonNull(rarity_enum), |
| 223 | + description="The rarity of this asset." |
| 224 | + ), |
| 225 | + "uniqueIdentifier": GraphQLField( |
| 226 | + GraphQLNonNull(uuid_scalar), |
| 227 | + description="A unique identifier for this specific type of asset.\n\n" |
| 228 | + "This is based on the internal identifier for this asset and can be used " |
| 229 | + "to track it over time.\n" |
| 230 | + "For example, if the name of this asset changed, the identifier would remain the same." |
| 231 | + ) |
| 232 | + } |
| 233 | +) |
| 234 | + |
167 | 235 | crown_level_type = GraphQLObjectType( |
168 | 236 | name="CrownLevel", |
169 | 237 | description="A Crown Level and associated trophy data.", |
|
214 | 282 |
|
215 | 283 | fish_type = GraphQLObjectType( |
216 | 284 | name="Fish", |
| 285 | + interfaces=[asset_interface], |
217 | 286 | description="A fish.\n\n" |
218 | 287 | "Queries on this type that accept a weight as an argument will return `null` if this fish does not " |
219 | 288 | "support the provided weight.", |
|
250 | 319 | GraphQLNonNull(GraphQLString), |
251 | 320 | description="The name of the fish." |
252 | 321 | ), |
253 | | - "rarity": GraphQLField( |
254 | | - GraphQLNonNull(rarity_enum), |
255 | | - description="The rarity of the fish." |
256 | | - ), |
257 | | - "trophies": GraphQLField( |
| 322 | + "sellingPrice": GraphQLField( |
258 | 323 | GraphQLInt, |
259 | | - description="The number of trophies awarded for catching this fish in a given weight.", |
| 324 | + description="The number of A.N.G.L.R. Tokens given for selling this fish in a given weight.", |
260 | 325 | args={ |
261 | 326 | "weight": GraphQLArgument( |
262 | 327 | GraphQLNonNull(fish_weight_enum) |
263 | 328 | ) |
264 | 329 | } |
265 | 330 | ), |
266 | | - "sellingPrice": GraphQLField( |
| 331 | + "rarity": GraphQLField( |
| 332 | + GraphQLNonNull(rarity_enum), |
| 333 | + description="The rarity of the fish." |
| 334 | + ), |
| 335 | + "trophies": GraphQLField( |
267 | 336 | GraphQLInt, |
268 | | - description="The number of A.N.G.L.R. Tokens given for selling this fish in a given weight.", |
| 337 | + description="The number of trophies awarded for catching this fish in a given weight.", |
269 | 338 | args={ |
270 | 339 | "weight": GraphQLArgument( |
271 | 340 | GraphQLNonNull(fish_weight_enum) |
272 | 341 | ) |
273 | 342 | } |
| 343 | + ), |
| 344 | + "uniqueIdentifier": GraphQLField( |
| 345 | + GraphQLNonNull(uuid_scalar), |
| 346 | + description="A unique identifier for this specific type of asset.\n\n" |
| 347 | + "This is based on the internal identifier for this asset and can be used " |
| 348 | + "to track it over time.\n" |
| 349 | + "For example, if the name of this asset changed, the identifier would remain the same." |
274 | 350 | ) |
275 | 351 | } |
276 | 352 | ) |
|
305 | 381 | } |
306 | 382 | ) |
307 | 383 |
|
| 384 | +island_exchange_listing_type = GraphQLObjectType( |
| 385 | + name="IslandExchangeListing", |
| 386 | + description="A listing in the Island Exchange.", |
| 387 | + fields={ |
| 388 | + "amount": GraphQLField( |
| 389 | + GraphQLNonNull(GraphQLInt), |
| 390 | + description="The amount of the asset that is being sold." |
| 391 | + ), |
| 392 | + "asset": GraphQLField( |
| 393 | + GraphQLNonNull(asset_interface), |
| 394 | + description="The asset that is being sold." |
| 395 | + ), |
| 396 | + "cost": GraphQLField( |
| 397 | + GraphQLNonNull(GraphQLInt), |
| 398 | + description="The cost of purchasing this listing." |
| 399 | + ), |
| 400 | + "creationTime": GraphQLField( |
| 401 | + GraphQLNonNull(datetime_scalar), |
| 402 | + description="The time this listing was created." |
| 403 | + ), |
| 404 | + "endTime": GraphQLField( |
| 405 | + GraphQLNonNull(datetime_scalar), |
| 406 | + description="The time this listing will expire (if the listing is active) or the time it sold." |
| 407 | + ), |
| 408 | + "identifier": GraphQLField( |
| 409 | + GraphQLNonNull(uuid_scalar), |
| 410 | + description="A unique identifier for this entry.\n\n" |
| 411 | + "This can be used to deduplicate listings if storing externally." |
| 412 | + ) |
| 413 | + } |
| 414 | +) |
| 415 | + |
308 | 416 | leaderboard_entry_type = GraphQLObjectType( |
309 | 417 | name="LeaderboardEntry", |
310 | 418 | description="An entry in a leaderboard.", |
|
513 | 621 | GraphQLNonNull(rotation_enum) |
514 | 622 | ) |
515 | 623 | } |
| 624 | + ), |
| 625 | + "activeIslandExchangeListings": GraphQLField( |
| 626 | + GraphQLNonNull(GraphQLList(GraphQLNonNull(island_exchange_listing_type))), |
| 627 | + description="Returns a list of all active Island Exchange listings.\n\n" |
| 628 | + "This endpoint will not return listings until they have been " |
| 629 | + "active for a certain length of time.\n" |
| 630 | + "This is to help prevent sniping/botting and to ensure server " |
| 631 | + "players have priority of website/bot users." |
| 632 | + ), |
| 633 | + "soldIslandExchangeListings": GraphQLField( |
| 634 | + GraphQLNonNull(GraphQLList(GraphQLNonNull(island_exchange_listing_type))), |
| 635 | + description="Returns a list of all Island Exchange sales made in the last 24 hours.\n\n" |
| 636 | + "This only includes listings that sold successfully.\n" |
| 637 | + "Listings that did not sell or are still active are not included in this." |
| 638 | + ), |
| 639 | + "activeAuctionListings": GraphQLField( |
| 640 | + GraphQLNonNull(GraphQLList(GraphQLNonNull(auction_listing_type))), |
| 641 | + description="Returns a list of all active auctions.\n\n" |
| 642 | + "This includes items being sold in the Grand Auction as well as other auctions " |
| 643 | + "(such as event auctions)." |
516 | 644 | ) |
517 | 645 | } |
518 | 646 | ) |
|
551 | 679 | } |
552 | 680 | ) |
553 | 681 |
|
| 682 | +simple_asset_type = GraphQLObjectType( |
| 683 | + name="SimpleAsset", |
| 684 | + interfaces=[asset_interface], |
| 685 | + description="A simple implementation of an asset.\n\n" |
| 686 | + "This type is used for when there is no other concrete implementation " |
| 687 | + "of asset that is better suited to be returned.", |
| 688 | + fields={ |
| 689 | + "name": GraphQLField( |
| 690 | + GraphQLNonNull(GraphQLString), |
| 691 | + description="The name of this asset." |
| 692 | + ), |
| 693 | + "rarity": GraphQLField( |
| 694 | + GraphQLNonNull(rarity_enum), |
| 695 | + description="The rarity of this asset." |
| 696 | + ), |
| 697 | + "uniqueIdentifier": GraphQLField( |
| 698 | + GraphQLNonNull(uuid_scalar), |
| 699 | + description="A unique identifier for this specific type of asset.\n\n" |
| 700 | + "This is based on the internal identifier for this asset and can be used " |
| 701 | + "to track it over time.\n" |
| 702 | + "For example, if the name of this asset changed, the identifier would remain the same." |
| 703 | + ) |
| 704 | + } |
| 705 | +) |
| 706 | + |
554 | 707 | social_type = GraphQLObjectType( |
555 | 708 | name="Social", |
556 | 709 | description="Social data.", |
|
0 commit comments