Skip to content

Commit c6b3494

Browse files
committed
Update mcc_api.island schema to support cosmetics, fishing, MCC+, and A.N.G.L.R. Tokens
1 parent ed0466e commit c6b3494

File tree

6 files changed

+401
-27
lines changed

6 files changed

+401
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![🐍 PyPI](https://img.shields.io/pypi/v/mcc-api?label=🐍%20PyPI)](https://pypi.org/project/mcc-api/)
44
[![👑 Targeting Event API v1.6.0](https://img.shields.io/badge/👑_Targeting_Event_API-v1.6.0-red)](https://github.com/Noxcrew/mcchampionship-api/releases/tag/v1.6.0)
5-
[![🏝️ Targeting Island API v24.12.04](https://img.shields.io/badge/🏝️_Targeting_Island_API-v24.12.04-aqua)](https://github.com/Noxcrew/mccisland-api/releases/tag/v24.12.04)
5+
[![🏝️ Targeting Island API v24.12.17](https://img.shields.io/badge/🏝️_Targeting_Island_API-v24.12.17-aqua)](https://github.com/Noxcrew/mccisland-api/releases/tag/v24.12.17)
66

77
A helper library for the [MC Championship](https://mcchampionship.com) APIs
88
([Event](https://github.com/Noxcrew/mcchampionship-api), inspired by [derNiklaas's](https://github.com/derNiklaas)

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ python_mcc_api
77
.. image:: https://img.shields.io/badge/👑_Targeting_Event_API-v1.6.0-red
88
:alt: 👑 Targeting Event API v1.6.0
99
:target: https://github.com/Noxcrew/mcchampionship-api/releases/tag/v1.6.0
10-
.. image:: https://img.shields.io/badge/🏝️_Targeting_Island_API-v24.12.04-aqua
11-
:alt: 🏝️ Targeting Island API v24.12.04
12-
:target: https://github.com/Noxcrew/mccisland-api/releases/tag/v24.12.04
10+
.. image:: https://img.shields.io/badge/🏝️_Targeting_Island_API-v24.12.17-aqua
11+
:alt: 🏝️ Targeting Island API v24.12.17
12+
:target: https://github.com/Noxcrew/mccisland-api/releases/tag/v24.12.17
1313

1414
A helper library for the `MC Championship <https://mcchampionship.com>`_ APIs
1515
(`Event <https://github.com/Noxcrew/mcchampionship-api>`_, inspired by `derNiklaas's <https://github.com/derNiklaas>`_

mcc_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"__version__"
55
]
66

7-
__version__ = "1.1.8"
7+
__version__ = "1.2.0"
88
__user_agent: t.Final[str] = f"python_mcc_api/{__version__} (https://github.com/JamesMCo/python_mcc_api)"
99

1010
# update version of package

mcc_api/island/enums.py

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,102 @@
22

33

44
__all__ = [
5-
"game_enum", "rank_enum", "rotation_enum", "server_category_enum", "trophy_category_enum"
5+
"cosmetic_category_enum",
6+
"fish_catch_time_enum",
7+
"fish_weight_enum",
8+
"game_enum",
9+
"rank_enum",
10+
"rarity_enum",
11+
"rotation_enum",
12+
"server_category_enum",
13+
"trophy_category_enum"
614
]
715

16+
cosmetic_category_enum = GraphQLEnumType(
17+
name="CosmeticCategory",
18+
description="Different categories of cosmetics.",
19+
values={
20+
"ACCESSORY": GraphQLEnumValue(
21+
value="ACCESSORY",
22+
description="Accessories."
23+
),
24+
"AURA": GraphQLEnumValue(
25+
value="AURA",
26+
description="Auras."
27+
),
28+
"CLOAK": GraphQLEnumValue(
29+
value="CLOAK",
30+
description="Cloaks."
31+
),
32+
"HAIR": GraphQLEnumValue(
33+
value="HAIR",
34+
description="Hair."
35+
),
36+
"HAT": GraphQLEnumValue(
37+
value="HAT",
38+
description="Hats."
39+
),
40+
"ROD": GraphQLEnumValue(
41+
value="ROD",
42+
description="Fishing rods."
43+
),
44+
"TRAIL": GraphQLEnumValue(
45+
value="TRAIL",
46+
description="Trails."
47+
)
48+
}
49+
)
50+
51+
fish_catch_time_enum = GraphQLEnumType(
52+
name="FishCatchTime",
53+
description="The time a fish can be caught in.",
54+
values={
55+
"ALWAYS": GraphQLEnumValue(
56+
value="ALWAYS",
57+
description="The fish can always be caught."
58+
),
59+
"DAY": GraphQLEnumValue(
60+
value="DAY",
61+
description="The fish can only be caught during daytime."
62+
),
63+
"NIGHT": GraphQLEnumValue(
64+
value="NIGHT",
65+
description="The fish can only be caught during nighttime."
66+
)
67+
}
68+
)
69+
70+
fish_weight_enum = GraphQLEnumType(
71+
name="FishWeight",
72+
description="The weight of a fish.\n\n"
73+
"Note that some weights are not used for crabs, or are only used for crabs.",
74+
values={
75+
"AVERAGE": GraphQLEnumValue(
76+
value="AVERAGE",
77+
description="Average."
78+
),
79+
"COLOSSAL": GraphQLEnumValue(
80+
value="COLOSSAL",
81+
description="Colossal.\n\n"
82+
"This weight is only used for crabs."
83+
),
84+
"GARGANTUAN": GraphQLEnumValue(
85+
value="GARGANTUAN",
86+
description="Gargantuan.\n\n"
87+
"This weight is not used for crabs."
88+
),
89+
"LARGE": GraphQLEnumValue(
90+
value="LARGE",
91+
description="Large."
92+
),
93+
"MASSIVE": GraphQLEnumValue(
94+
value="MASSIVE",
95+
description="Massive.\n\n"
96+
"This weight is not used for crabs."
97+
)
98+
}
99+
)
100+
8101
game_enum = GraphQLEnumType(
9102
name="Game",
10103
description="A game.",
@@ -75,6 +168,37 @@
75168
}
76169
)
77170

171+
rarity_enum = GraphQLEnumType(
172+
name="Rarity",
173+
description="Different tiers of rarity.",
174+
values={
175+
"COMMON": GraphQLEnumValue(
176+
value="COMMON",
177+
description="Common."
178+
),
179+
"EPIC": GraphQLEnumValue(
180+
value="EPIC",
181+
description="Epic."
182+
),
183+
"LEGENDARY": GraphQLEnumValue(
184+
value="LEGENDARY",
185+
description="Legendary."
186+
),
187+
"MYTHIC": GraphQLEnumValue(
188+
value="MYTHIC",
189+
description="Mythic."
190+
),
191+
"RARE": GraphQLEnumValue(
192+
value="RARE",
193+
description="Rare."
194+
),
195+
"UNCOMMON": GraphQLEnumValue(
196+
value="UNCOMMON",
197+
description="Uncommon."
198+
)
199+
}
200+
)
201+
78202
rotation_enum = GraphQLEnumType(
79203
name="Rotation",
80204
description="A rotation period.\n\n"

mcc_api/island/scalars.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
1-
from datetime import datetime
1+
from datetime import date, datetime
22
from graphql import GraphQLScalarType, ValueNode
33
from graphql.utilities import value_from_ast_untyped
44
from uuid import UUID
55
import typing as t
66

77

88
__all__ = [
9-
"datetime_scalar", "uuid_scalar"
9+
"date_scalar", "datetime_scalar", "uuid_scalar"
1010
]
1111

1212

13+
# Date scalar based on datetime example in gql library documentation
14+
# https://gql.readthedocs.io/en/latest/usage/custom_scalars_and_enums.html
15+
16+
def date_serialize(value: date) -> str:
17+
return value.isoformat()
18+
19+
20+
def date_parse_value(value: str) -> date:
21+
return date.fromisoformat(value)
22+
23+
24+
def date_parse_literal(value_node: ValueNode, variables: t.Optional[dict[str, t.Any]] = None) -> date:
25+
ast_value = value_from_ast_untyped(value_node, variables)
26+
return date_parse_value(ast_value)
27+
28+
29+
date_scalar = GraphQLScalarType(
30+
name="Date",
31+
description="An RFC-3339 compliant Full Date Scalar",
32+
specified_by_url="https://tools.ietf.org/html/rfc3339",
33+
serialize=date_serialize,
34+
parse_value=date_parse_value,
35+
parse_literal=date_parse_literal
36+
)
37+
38+
1339
# Datetime scalar from example in gql library documentation
1440
# https://gql.readthedocs.io/en/latest/usage/custom_scalars_and_enums.html
1541

0 commit comments

Comments
 (0)