Closed enekochan closed 9 months ago
That's actually a nice idea that I didn't thought about :D I'll implement the toArray
-method.
and for example the TwitchUser::getEmail() method will fail if you don't have the user:read:email scope because the property won't exist
This should be fixed with the latest commit from yesterday, I stumbled upon this error on accident, too a few days ago.
When getting the data of a
TwitchResponse
you get an array of objects defined in the Dto folder. Then to get the individual values you have to call the methods in the specific Dto (and for example theTwitchUser::getEmail()
method will fail if you don't have the user:read:email scope because the property won't exist).Would be a good idea to add the possibility to get the data as an array, for example to symplify creating JSON values.
To use the same code for all the Dto a trait could be used:
And then use it in all the Dto classes, for example in
TwitchUser.php
:Finally use it after calling the API:
And would have this as result: