Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More encapsulation in the SDK #7

Closed
JohannHilbold opened this issue Jun 21, 2021 · 2 comments
Closed

More encapsulation in the SDK #7

JohannHilbold opened this issue Jun 21, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@JohannHilbold
Copy link

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.

@christyjacob4
Copy link
Member

@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 :)

@TorstenDittmann TorstenDittmann added the enhancement New feature or request label Jun 25, 2021
@TorstenDittmann TorstenDittmann added this to To do in 0.9.x via automation Jun 25, 2021
@eldadfux eldadfux removed this from To do in 0.9.x Jan 15, 2022
@lohanidamodar
Copy link
Member

Closing this as the response models were released. If the issue still exist feel free to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants