Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've create a PR for #112.
In this PR the Media class now returns
customMetaproperties
asMap<String, List<String>
where the key is the property name withoutproperty_
prefix and the value is always a list of strings, even if the API returned a single String as value for that specific attribute. I did this for simlicity reasons.The following API response as Media object
will be presented in the Java Object as below
Unfortunately the choice of Retrofit doesn't perfectly fit (pun not intended) to the choice of having "property_" prefixed attributes on the same level as all other Media attributes.
With Retrofit you're only capable of setting custom Adapters on the API delivered attributes like "isPublic" for example. If the delivered attribute is some kind of wildcard like "property_*" a custom adapter is not possible at all.
That's why i implemented a custom MediaTypeAdapter for the whole class as the only possible solution i could think of.
Please give some feedback on the implementation and let me know if this works fine to you.
Testcases are included.