NAME
Net::Async::Spotify::Util - Helper class for some common functions.
DESCRIPTION
Helper class that will have some functions that are general and can be used across library.
METHODS
response_object_map
Due to the unstructured response details in Spotify documentation page in regards they type of response for every request. This method will act as a reliable mapping for Spotify API responses to their desired Objects type. Takes:
- available_types
-
which consists of the availabe Object types that are loaded by Caller.
- response_hash
-
which consists of possible `response_objs` types and `uri` that was called for this response.
It uses smart matching mechanism; meaning that first it will check if that Spotify uri has a specific retun type set in %uri_responses
hash, if nothing is set for the uri. It will check @$possible_types
passed by trying to find for the exact Object name, if not found it will get the first object that includes the passed name as part of it's own name. It will return the Object class name if found, and `undef` when it can't find a suitable object.