Closed Tunous closed 1 year ago
The challenge is that we use the instance endpoint to retrieve information about the server (e.g. determine the flavour) which will fail for servers that haven't implemented the v2 endpoint which currently works only on flavour == mastodon && version >= 4.0.
I suggest a quick fix for now: Make everything on the Instance struct optional, except for the version
field.
At a later point, we can refactor the connect
method to use a new getInstanceVersion
method that only gets the version to set the flavour + version of the current TootClient
instance and so in the implementation of getInstanceInfo
we can choose to use V1 or V2, returning an Instance
in both cases.
I'm using TootClient initializer that detects flavour by fetching instance info. Unfortunately this causes a problem with pixelfed instance I tried to connect to: https://pxlmo.com.
I'm receiving parsing issue due to missing "email" field. Looking at the implementation in TootSDK the used endpoint is /api/v1/instance which is deprecated. In code "email" is marked as required. The v2 api has completely different structure for returned object.
I don't know what the proper solution is. Move to v2 api or find which fields are optional in v1 and fix them?