kamikat / moshi-jsonapi

JSON API v1.0 Specification in Moshi.
MIT License
156 stars 35 forks source link

How to retrieve attributes from casting ResourceIdentifier to Resource of included? #77

Closed dreamsbond closed 6 years ago

dreamsbond commented 6 years ago

No idea how to get there out. Could you help?

dreamsbond commented 6 years ago

seems like i got the trick now.

model.getRelationship(model.getDocument())

but this is based on included scenario. would like to know more about resolving promise.

if i does not specify "include=relationship-a,relationship-b" how does mosh-jsonapi work on resolving promise?

thanks

kamikat commented 6 years ago

What's a "promise"?

dreamsbond commented 6 years ago

The Promise object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.

kamikat commented 6 years ago

The library only handles object mappings in serialization/deserialization of JSON API objects for simplicity. So it does nothing with interacting with the server.

A general advice to this is to create a request to server retrieving all related resource objects and resolve the linkage with the context from that request.

dreamsbond commented 6 years ago

thanks. yeah. i think having parsing "included" did the job.