Closed Bnyro closed 1 year ago
No, due to federation between instances we don't need to. We can just pass communitname@exampleinstance.com
as community_name
and it will work if they are federated (lemmy.ml is the official instance and federated to almost all other public lemmy instances).
We could also change base url, but that would require us to recreate a retrofit instance each time the user changes the instance of the community.
Now, we rely on the official instance to always be up though - not sure what's better. We should probably directly connect to the instance the community lives on - in a separate PR.
Using the official instance seems good enough.
Anyway you don't have to recreate the retrofit instance every time you change the instance. Instead you can do something like this
@GET("https://{instance}/api/v3/post/list")
suspend fun getLemmyData(
@Path("instance") instance: String,
@Query("community_name") community: String,
@Query("sort") sort: String
): LemmyResponse
Which is more efficient than recreating retrofit IMO
Yeah, true.
We can also use @Url url: String
btw :)
Btw just wondering, don't we have to change base url to access posts from another instance?