leonhard-s / auraxium

A high-level Python wrapper for the PlanetSide 2 API.
https://auraxium.readthedocs.io/
MIT License
28 stars 8 forks source link

Draft of rewriting event models #42

Closed LordFlashmeow closed 3 years ago

LordFlashmeow commented 3 years ago

I went all-out on implementing pydantic models for the websocket responses. I thought it was a cool idea to let pydantic parse the messages, starting with the raw payload text all the way to the models.

Let me know your thoughts and if there's anything you'd like to keep.

LordFlashmeow commented 3 years ago

Maybe we can hold the users' hand a little and give them warnings by making the Event models subclasses of WorldEvent and CharacterEvent, and then a function to verify the subscription before sending it.

leonhard-s commented 3 years ago

Something like that, yeah - I've started a draft of merging our two implementations locally, but I got a bit side-tracked trying to resolve all the partially-imported-modules needing to talk to each other (models require bases, bases require models to validate triggers, triggers now take these models as arguments...).

Not too happy with my work-in-progress, but I'll make a PR tomorrow once I found a solution for the import shenanigans.

LordFlashmeow commented 3 years ago

I chose to make a util file that didn't import from anything and move what I could into there. After that I ended up consolidating a bunch of files to cut down on imports. Definitely headache-inducing!

leonhard-s commented 3 years ago

Closing this PR as it has been integrated into the larger #43 refactor.

Thank you again for this request; the commits got buried a bit behind an larger restructuring, but the event portion of that draft is now very similar to your original work here.