Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce higher-level interface to API #15

Open
acurtis166 opened this issue Dec 1, 2023 · 3 comments
Open

Introduce higher-level interface to API #15

acurtis166 opened this issue Dec 1, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@acurtis166
Copy link
Owner

I'm picturing a class wrapping a HaloInfiniteClient instance, maybe HaloInfiniteResource, that is initialized similarly to the client but integrates calls to services and provides more opinionated responses. For example, it would be nice to request matches and have the names of playlists, maps, modes, and players returned (and less deeply nested) instead of asset IDs and version IDs that the user needs to understand how to process further.

@acurtis166 acurtis166 added the enhancement New feature or request label Dec 1, 2023
@acurtis166 acurtis166 self-assigned this Dec 1, 2023
@aapokaapo
Copy link
Collaborator

+1 for this. Should this be done with Pydantic model or what do you think?

@acurtis166
Copy link
Owner Author

@aapokaapo I'm actually playing with returning the Pydantic models directly from the HaloInfiniteClient service methods.

A new MatchAPI class would wrap a client instance and have 2 methods, get_match and iter_match_history, which return/yield new models wrapping the current Pydantic models. The new models would provide convenience properties for more direct access to the match/stat/skill attributes.

Models might look like:

Match
match_id
start_time
map_name
...
teams
players

Team
team_id
name
kills
...
mmr

Player
player_id
gamertag
kills
...
csr_before
csr_after

What do you think?

I'd welcome a 2nd opinion if you are interested in reviewing a PR.

@aapokaapo
Copy link
Collaborator

It is a bit tedious to have to first query for match_history, acquire a match_id and then get match_stats with that match_id and lastly acquire a map_asset_id and with that query the map_asset to get the map_name. Your suggestion sounds good to me.
I'll gladly review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants