Migrating to V1
When upgrading from a pre v1 version to v1.*.* there are some breaking
changes to take into account.
If you use any of the below methods you will want to change your usage to match the After example.
Enums
All skills, bosses, activities, and computed metrics were added to the
Metric enum for ease of access from a single source.
The following enums were converted into frozen sets containing the various
Metrics they encompass so that you can still easily check
if a metric is a skill, or boss, etc.
This is probably the most wide-spread change of the release and may
affect you in many places like if statements etc. The fix is very easy though,
just convert most if not all of the places you used the old enums to
Metric.
The from_str and from_str_maybe methods were removed from the Metric enum.
Before
print(wom.Skills.Attack)
print(wom.Bosses.Zulrah)
print(wom.Activities.LastManStanding)
print(wom.ComputedMetrics.Ehp)
slayer = wom.Skills.Slayer
assert slayer in wom.Skills
After
print(wom.Metric.Attack)
print(wom.Metric.Zulrah)
print(wom.Metric.LastManStanding)
print(wom.Metric.Ehp)
slayer = wom.Metric.Slayer
assert slayer in wom.Skills
Players
PlayerDetail
The PlayerDetail model now inherits from
Player and so the player property was removed.
Methods affected
Before
result = await client.players.get_details("jonxslays")
player = result.unwrap()
print(player.player.username)
After
result = await client.players.get_details("jonxslays")
player = result.unwrap()
print(player.username)
PlayerAchievementProgress
PlayerAchievementProgress now inherits from
AchievementProgress and so the achievement property was removed.
Methods affected
Before
result = await client.players.get_achievement_progress("Jonxslays")
achievements = result.unwrap()
for achievement in achievements:
    print(achievement.achievement.metric)
After
result = await client.players.get_achievement_progress("Jonxslays")
achievements = result.unwrap()
for achievement in achievements:
    print(achievement.metric)
PlayerCompetitionStanding
PlayerCompetitionStanding now inherits from
PlayerParticipation and so the participation property was removed.
Methods affected
Before
result = await client.players.get_competition_standings(
    "Jonxslays", wom.CompetitionStatus.Ongoing
)
standings = result.unwrap()
for standing in standings:
    print(standing.participation.competition.title)
After
result = await client.players.get_competition_standings(
    "Jonxslays", wom.CompetitionStatus.Ongoing
)
standings = result.unwrap()
for standing in standings:
    print(standing.competition.title)
PlayerArchive
PlayerArchive now inherits from
Archive and so the archive property was removed.
Methods affected
Before
result = await client.players.get_archives("Jonxslays")
archives = result.unwrap()
for archive in archives:
    print(archive.archive.previous_username)
After
result = await client.players.get_archives("Jonxslays")
archives = result.unwrap()
for archive in archives:
    print(archive.previous_username)
PlayerMembership
PlayerMembership now inherits from Membership
and so the membership property was removed.
Methods affected
Before
result = await client.players.get_group_memberships("Jonxslays")
memberships = result.unwrap()
for membership in memberships:
    print(membership.membership.role)
After
result = await client.players.get_group_memberships("Jonxslays")
memberships = result.unwrap()
for membership in memberships:
    print(membership.role)
Groups
GroupMembership
GroupMembership now inherits from Membership and so the membership
property was removed.
Methods affected
GroupService.change_member_roleGroupService.get_detailsGroupService.edit_groupGroupService.create_group
Before
result = await client.groups.change_member_role(
    123, "111-111-111", "Jonxslays", wom.GroupRole.Admiral
)
memberships = result.unwrap()
for membership in memberships:
    print(membership.membership.role)
After
result = await client.groups.change_member_role(
    123, "111-111-111", "Jonxslays", wom.GroupRole.Admiral
)
memberships = result.unwrap()
for membership in memberships:
    print(membership.role)
GroupDetail
GroupDetail now inherits from Group
and so the group property was removed.
Methods affected
Before
After
Efficiency
get_global_leaderboard
The get_global_leaderboard method was renamed to
get_global_leaderboards
to be in more line with the other leaderboard method names.
Methods affected
Before
After
Records
get_global_record_leaderboards
The get_global_record_leaderboards method was renamed to
get_global_leaderboards to
be more in line with the other leaderboard method names.
Methods affected
Before
await client.records.get_global_record_leaderboards(
    wom.Metric.Attack,
    wom.Period.Day,
    country=wom.Country.Us,
)
After
await client.records.get_global_leaderboards(
    wom.Metric.Attack,
    wom.Period.Day,
    country=wom.Country.Us,
)
RecordLeaderboardEntry
RecordLeaderboardEntry now inherits from
Record and so the record property was removed.
Methods affected
Before
result = await client.records.get_global_leaderboards(
    wom.Metric.Attack,
    wom.Period.Day,
    country=wom.Country.Us,
)
leaderboard = result.unwrap()
for record in leaderboard:
    print(record.record.value)
After
result = await client.records.get_global_leaderboards(
    wom.Metric.Attack,
    wom.Period.Day,
    country=wom.Country.Us,
)
leaderboard = result.unwrap()
for record in leaderboard:
    print(record.value)
Competitions
CompetitionParticipationDetail
CompetitionParticipationDetail now inherits
from CompetitionParticipation and so the
participation property was removed.
Methods affected
Before
result = await client.competitions.get_details(123)
detail = result.unwrap()
for participation in detail.participations:
    print(participation.participation.team_name)
After
result = await client.competitions.get_details(123)
detail = result.unwrap()
for participation in detail.participations:
    print(participation.team_name)
CompetitionDetail
CompetitionDetail now inherits from
Competition and so the competition property was removed.
Methods affected
Before
result = await client.competitions.get_details(123)
competition = result.unwrap()
print(competition.competition.metric)
After
result = await client.competitions.get_details(123)
competition = result.unwrap()
print(competition.metric)
CompetitionWithParticipations
CompetitionWithParticipations was renamed to
CreatedCompetitionDetail because the
participations property was removed and added to Competition
and the name was no longer an accurate representation of the object.
This means the verification_code on
CreatedCompetitionDetail no longer has
to be optional.
Methods affected
Before
result = await client.competitions.create_competition(
    "Slayer week",
    wom.Metric.Slayer,
    starts_at=datetime.now() + timedelta(days=7),
    ends_at=datetime.now() + timedelta(days=14),
    teams=[
        wom.Team("The good team", ["jonxslays", "rro"]),
        wom.Team("The suspicious team", ["psikoi", "aluminoti"]),
    ],
)
detail = result.unwrap()
# We cant make this assertion with the previous model.
# assert isinstance(detail.verification_code, str)
for participation in detail.participations:
    print(participation)
After
result = await client.competitions.create_competition(
    "Slayer week",
    wom.Metric.Slayer,
    starts_at=datetime.now() + timedelta(days=7),
    ends_at=datetime.now() + timedelta(days=14),
    teams=[
        wom.Team("The good team", ["jonxslays", "rro"]),
        wom.Team("The suspicious team", ["psikoi", "aluminoti"]),
    ],
)
detail = result.unwrap()
assert isinstance(detail.verification_code, str)
for participation in detail.competition.participations:
    print(participation)
edit_competition
The edit_competition method
now returns a Competition instead of a
CompetitionWithParticipations (which was removed).
Methods affected
Before
result = await client.competitions.edit_competition(
    123, "111-111-111", title="Skill of the month - Ranged"
)
competition = result.unwrap()
print(competition.competition.title)
After