-
Notifications
You must be signed in to change notification settings - Fork 15
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
Currently impossible to get a user's own account #456
Comments
@bocops How do you feel about having |
Extending data classes is not possible in Kotlin, so we couldn't for example declare |
Ah, wow, I had totally forgotten about that again. 😕 How do you feel about this approach? Not great, but could be an option? |
If we do that, and considering that we (currently) use both abstract class AccountData {
// ....
}
data class Account () : AccountData()
data class CredentialAccount(
// additional data
) : AccountData() And if we do that, it would still not be trivial to get an For what it's worth, my own use case is this: /**
* Get account data for a currently signed in user.
*/
fun getUserData() : Account? {
var account: Account? = null
client?.let {
try {
account = it.accounts.verifyCredentials().execute() // no longer compiles
} catch (b: BigBoneRequestException) {
Log.d("Client", "Exception verifying credentials: ${b.message}; ${b.httpStatusCode}")
}
}
return account
} I want to use the user's account data just like I would use the account data of any other user the client might see, and |
Some of our account-related methods, namely
verifyCredentials()
andupdateCredentials()
, return aCredentialAccount
instead of anAccount
since the last snapshot release.In our code, these entities are completely separate out of necessity (inheritance and data classes don't mix well), although Mastodon does not make this distinction. While some parts of the documentation specifically mention a "CredentialAccount" entity, others refer to the returned data as "an Account entity, with the source parameter included" (example: https://docs.joinmastodon.org/client/authorized/).
There doesn't seem to be any other way to retrieve the user's own account other than using
verifyCredentials()
, so I'd argue that this function is really meant to be used that way, and we either shouldn't return a completely different entity, or at least offer some way of getting anAccount
from the returnedCredentialAccount
. Potential ways to do this include:source
toAccount
and get rid of the separateCredentialAccount
getOwnAccount()
) that internally still callsverifyCredentials()
but returns data as anAccount
(or possiblyAccount?
if credentials can not be verified)CredentialAccount
and returns anAccount
The text was updated successfully, but these errors were encountered: