Some of our account-related methods, namely verifyCredentials() and updateCredentials(), return a CredentialAccount instead of an Account 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 an Account from the returned CredentialAccount. Potential ways to do this include:
- add a nullable
source to Account and get rid of the separate CredentialAccount
- add a separate function (e.g.
getOwnAccount()) that internally still calls verifyCredentials() but returns data as an Account (or possibly Account? if credentials can not be verified)
- add a utility function that accepts a
CredentialAccount and returns an Account
Some of our account-related methods, namely
verifyCredentials()andupdateCredentials(), return aCredentialAccountinstead of anAccountsince 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 anAccountfrom the returnedCredentialAccount. Potential ways to do this include:sourcetoAccountand get rid of the separateCredentialAccountgetOwnAccount()) that internally still callsverifyCredentials()but returns data as anAccount(or possiblyAccount?if credentials can not be verified)CredentialAccountand returns anAccount