GetRemoteCapabilitiesOperation.kt takes care of parsing the capabilities retrieved from the server in JSON format and transform them into RemoteCapability object.
Similarly to what we detailed in #2704, we could use Moshi to make the parsing of capabilities.
IN ADDITION
Since RemoteCapability object and OCCapability (domain model) objects are going to represent basically the same (when modularization is finished), we could get rid of RemoteCapability and parse the JSON directly to OCCapability from the data layer.
Parsing JSON and transforming it to domain models in data layer is the most common scenario when connecting with external APIs but ownCloud for Android is a special case, we have an intermediate layer between the oC server and our app, which is the ownCloud Android Library. This library is meant to make the life easier to those interested in communicate an Android app with ownCloud servers.
If we remove RemoteCapability from the ownCloud Android Library, the apps using it will receive just JSON and would need to parse it, so maybe is not the best idea if the aim of the library is "integrating your Android application with ownCloud seamlessly." 🤔
Tasks:
PR
GetRemoteCapabilitiesOperation.kttakes care of parsing the capabilities retrieved from the server in JSON format and transform them into RemoteCapability object.Similarly to what we detailed in #2704, we could use Moshi to make the parsing of capabilities.
IN ADDITION
Since RemoteCapability object and OCCapability (domain model) objects are going to represent basically the same (when modularization is finished), we could get rid of
RemoteCapabilityand parse the JSON directly toOCCapabilityfrom the data layer.Parsing JSON and transforming it to domain models in data layer is the most common scenario when connecting with external APIs but ownCloud for Android is a special case, we have an intermediate layer between the oC server and our app, which is the ownCloud Android Library. This library is meant to make the life easier to those interested in communicate an Android app with ownCloud servers.
If we remove
RemoteCapabilityfrom the ownCloud Android Library, the apps using it will receive just JSON and would need to parse it, so maybe is not the best idea if the aim of the library is "integrating your Android application with ownCloud seamlessly." 🤔Tasks:
PR