Skip to content

Commit 50bf75f

Browse files
committed
Update mcc_api.island schema to support Island Exchange and Grand Auction
1 parent cc282d5 commit 50bf75f

3 files changed

Lines changed: 209 additions & 8 deletions

File tree

mcc_api/island/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from .auth import APIKey
33
from .directives import *
44
from .enums import *
5+
from .interfaces import *
56
from .types import *
67
from gql import Client
78
from gql.transport.requests import RequestsHTTPTransport
@@ -17,15 +18,27 @@
1718
query=query_type,
1819
directives=[*specified_directives, one_of_directive, spectaql_directive],
1920
types=[
21+
auction_listing_type,
2022
collections_type,
23+
cosmetic_type,
24+
cosmetic_ownership_state_type,
25+
cosmetic_token_type,
2126
crown_level_type,
2227
currency_type,
28+
fish_type,
29+
fish_caught_weight_type,
30+
fish_record_type,
31+
island_exchange_listing_type,
2332
leaderboard_entry_type,
33+
level_data_type,
34+
mcc_plus_status_type,
2435
party_type,
2536
player_type,
2637
progression_data_type,
2738
query_type,
39+
royal_reputation_type,
2840
server_type,
41+
simple_asset_type,
2942
social_type,
3043
statistic_type,
3144
statistic_value_result_type,
@@ -39,6 +52,8 @@
3952
rotation_enum,
4053
server_category_enum,
4154
trophy_category_enum,
55+
56+
asset_interface,
4257
]
4358
)
4459

mcc_api/island/interfaces.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from .enums import *
2+
from .scalars import uuid_scalar
3+
from graphql import GraphQLField, GraphQLInterfaceType, GraphQLNonNull, GraphQLString
4+
5+
6+
__all__ = [
7+
"asset_interface"
8+
]
9+
10+
asset_interface = GraphQLInterfaceType(
11+
name="Asset",
12+
description="An asset.\n\n"
13+
"Effectively, an asset encompasses all forms of items on the Island.\n"
14+
"This includes Cosmetics, openables, materials, fish, etc.\n"
15+
"Basically anything that can fit in your Infinibag!",
16+
fields={
17+
"name": GraphQLField(
18+
GraphQLNonNull(GraphQLString),
19+
description="The name of this asset."
20+
),
21+
"rarity": GraphQLField(
22+
GraphQLNonNull(rarity_enum),
23+
description="The rarity of this asset."
24+
),
25+
"uniqueIdentifier": GraphQLField(
26+
GraphQLNonNull(uuid_scalar),
27+
description="A unique identifier for this specific type of asset.\n\n"
28+
"This is based on the internal identifier for this asset and can be used "
29+
"to track it over time.\n"
30+
"For example, if the name of this asset changed, the identifier would remain the same."
31+
)
32+
}
33+
)

mcc_api/island/types.py

Lines changed: 161 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .enums import *
2+
from .interfaces import *
23
from .scalars import *
34
from graphql import (
45
GraphQLArgument, GraphQLBoolean, GraphQLField, GraphQLInputField, GraphQLInputObjectType,
@@ -7,14 +8,17 @@
78

89

910
__all__ = [
11+
"auction_listing_type",
1012
"collections_type",
1113
"cosmetic_type",
1214
"cosmetic_ownership_state_type",
15+
"cosmetic_token_type",
1316
"crown_level_type",
1417
"currency_type",
1518
"fish_type",
1619
"fish_caught_weight_type",
1720
"fish_record_type",
21+
"island_exchange_listing_type",
1822
"leaderboard_entry_type",
1923
"level_data_type",
2024
"mcc_plus_status_type",
@@ -24,6 +28,7 @@
2428
"query_type",
2529
"royal_reputation_type",
2630
"server_type",
31+
"simple_asset_type",
2732
"social_type",
2833
"statistic_type",
2934
"statistic_value_result_type",
@@ -33,6 +38,34 @@
3338
"trophy_data_type"
3439
]
3540

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+
3669
collections_type = GraphQLObjectType(
3770
name="Collections",
3871
description="Collections data.",
@@ -74,6 +107,7 @@
74107

75108
cosmetic_type = GraphQLObjectType(
76109
name="Cosmetic",
110+
interfaces=[asset_interface],
77111
description="A cosmetic.",
78112
fields=lambda: {
79113
"name": GraphQLField(
@@ -136,6 +170,13 @@
136170
"type": GraphQLField(
137171
GraphQLNonNull(cosmetic_type_enum),
138172
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."
139180
)
140181
}
141182
)
@@ -164,6 +205,33 @@
164205
}
165206
)
166207

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+
167235
crown_level_type = GraphQLObjectType(
168236
name="CrownLevel",
169237
description="A Crown Level and associated trophy data.",
@@ -214,6 +282,7 @@
214282

215283
fish_type = GraphQLObjectType(
216284
name="Fish",
285+
interfaces=[asset_interface],
217286
description="A fish.\n\n"
218287
"Queries on this type that accept a weight as an argument will return `null` if this fish does not "
219288
"support the provided weight.",
@@ -250,27 +319,34 @@
250319
GraphQLNonNull(GraphQLString),
251320
description="The name of the fish."
252321
),
253-
"rarity": GraphQLField(
254-
GraphQLNonNull(rarity_enum),
255-
description="The rarity of the fish."
256-
),
257-
"trophies": GraphQLField(
322+
"sellingPrice": GraphQLField(
258323
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.",
260325
args={
261326
"weight": GraphQLArgument(
262327
GraphQLNonNull(fish_weight_enum)
263328
)
264329
}
265330
),
266-
"sellingPrice": GraphQLField(
331+
"rarity": GraphQLField(
332+
GraphQLNonNull(rarity_enum),
333+
description="The rarity of the fish."
334+
),
335+
"trophies": GraphQLField(
267336
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.",
269338
args={
270339
"weight": GraphQLArgument(
271340
GraphQLNonNull(fish_weight_enum)
272341
)
273342
}
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."
274350
)
275351
}
276352
)
@@ -305,6 +381,38 @@
305381
}
306382
)
307383

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+
308416
leaderboard_entry_type = GraphQLObjectType(
309417
name="LeaderboardEntry",
310418
description="An entry in a leaderboard.",
@@ -513,6 +621,26 @@
513621
GraphQLNonNull(rotation_enum)
514622
)
515623
}
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)."
516644
)
517645
}
518646
)
@@ -551,6 +679,31 @@
551679
}
552680
)
553681

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+
554707
social_type = GraphQLObjectType(
555708
name="Social",
556709
description="Social data.",

0 commit comments

Comments
 (0)