Skip to content

Enhance structure to increase visibility of Account entity variants #456

@bocops

Description

@bocops

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs discussionIt is not yet entirely clear on how to address this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions