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

Keep an Instance reference in MastodonClient #114

Open
bocops opened this issue Jan 20, 2023 · 0 comments
Open

Keep an Instance reference in MastodonClient #114

bocops opened this issue Jan 20, 2023 · 0 comments

Comments

@bocops
Copy link
Collaborator

bocops commented Jan 20, 2023

Summarizing relevant parts from #94:

Currently, instance information for the currently configured instance can be retrieved via a respective MastodonClient instance like: client.instances.getInstances() (Kotlin) or client.instances().getInstances() (Java). This is currently the only Mastodon API call available via InstanceMethods.

Most of this information is constant for the lifetime of the MastodonClient object and sometimes necessary for our client to function, for example the version, configuration or streaming API URL. Other information can at least be expected to not change too regularly, for example server policies.

As such, it might be sensible to build our client with a fixed Instance reference that is retrieved while building it, and make that member available directly, like client.instance / client.getInstance().

Potential issues that were previously brought up:

  • bootstrapping: accessing "api/vX/instance" endpoint without yet knowing server version that is contained in the return value for that endpoint
  • getting back either a V1 or V2 instance depending on server version
  • library users might still want to access the endpoint repeatedly to get updated information that does change, like usage statistics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant