Jonxslays / wom.py

An asynchronous wrapper for the Wise Old Man API.
https://jonxslays.github.io/wom.py/
MIT License
10 stars 7 forks source link

Add `to_dict()` method to `Result` #57

Closed Jonxslays closed 9 months ago

Jonxslays commented 9 months ago

This will allow users of the library to easily convert a result to a dictionary and returning it directly from web frameworks like FastAPI rather than needing to check whether it is Ok or Err.

Recommended shape:

{
    "value": ...,
    "error": ...
}

This may take some consideration depending on the type the Result is generic over. Typically this is a model, but could also be a list of models.