Closed Ombrelin closed 2 years ago
Would you accept a PR if I wrote overloads of the existing methods but in a non-blocking fashion ?
What about using the clients' async methods instead of the models' constructors? They are async and non-blocking, seems to be the solution to your problems.
E.g. PlexAccountClient.GetPlexAccountAsync(username, password)
instead of PlexAccount(..., username, password)
Still I don't have a clue why there are specific models that have an api call in its constructor. Unless I have missed something, I consider this an anti pattern.
Thank you for your suggestion ! I did not notice that these methods were on the clients. I works well in my use case. Thank you for provide this workaround.
Is your feature request related to a problem? Please describe. I'm developing a client app (using .NET MAUI) using the library, and the blocking calls in the constructor are a pain.
Describe the solution you'd like I would recommend fecthing the data before constructing the models and then passing the data to map to the constructor
Describe alternatives you've considered For now I wrap the calls with
Task.Run(...)
but the overhead and blocking makes the calls very slow.