You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that all calls should return a better type than "OkHttp.Response"
For example, wouldn't it be nice to type:
val session = Account(Client.client).createSession("user", "pass")
and then the session would be (for example) of the AppwriteSession type. That object could have members like "isSuccess", "sessionID" or stuff like that.
With the current version, you have to type
var response = accountService.createSession(email.toString(), password.toString())
var json = response.body?.string() ?: ""
json = JSONObject(json).toString(8)
_response.postValue(Event(json))
Encapsulating the "Response" would also allow for a SDK side json parsing and also error handling. The AppwriteSession object I described above could contain an AppwriteException if the call failed, for example. But more importantly, it would remove the need to parse the json on the non sdk side.
The text was updated successfully, but these errors were encountered:
@JohannHilbold Thanks a lot for the feedback :)
We are actually working on a RFC for Response Models as you mentioned appwrite/rfc#19
We are waiting for some final comments before we can implement it across all our SDKs.
I'd encourage you to give it a read and maybe drop your thoughts over there as well :)
I think that all calls should return a better type than "OkHttp.Response"
For example, wouldn't it be nice to type:
val session = Account(Client.client).createSession("user", "pass")
and then the session would be (for example) of the AppwriteSession type. That object could have members like "isSuccess", "sessionID" or stuff like that.
With the current version, you have to type
var response = accountService.createSession(email.toString(), password.toString())
var json = response.body?.string() ?: ""
json = JSONObject(json).toString(8)
_response.postValue(Event(json))
Encapsulating the "Response" would also allow for a SDK side json parsing and also error handling. The AppwriteSession object I described above could contain an AppwriteException if the call failed, for example. But more importantly, it would remove the need to parse the json on the non sdk side.
The text was updated successfully, but these errors were encountered: