Open ghost opened 3 years ago
What is the use case? Is this to connect to some app with an API that already exists, or something you are creating?
I came across Mochi when looking for Anki alternatives. Right now it offers a basic API interface and was the main reason behind the comment, but I do plan on building my own app sometime soon. A feature like that would allow for integration with any app that has a suitable API, even non-SRS related.
My initial impression is that it would be easiest overall to create a custom "API bridge" server, where the server would accept API calls in the format that AnkiConnect uses, and then that application would transform and forward those calls to whatever secondary service (Mochi). It already looks like Mochi requires an authentication call for the session, which is something that Yomichan doesn't do, and arguably shouldn't do. However, if you're writing your own service, you could configure such authentication calls to happen.
The AnkiConnect API has documentation, and while there isn't explicit documentation about how Yomichan uses it, all of Yomichan's AnkiConnect API calls are made from anki.js.
Yes, the API bridge may be the easiest to implement and probably will do for now, thanks for the suggestion. However, having the option to send custom requests would make Yomichan more diverse, more useful and "future-proof", should Anki ever be discontinued or lose its predominance (also considering non-SRS functions).
I get it and agree with you about authentication. I don't mind the users having to provide authentication tokens themselves if needed as it really is not Yomichan's job.
I see no downsides to having this feature on the add-on, but it is not urgent either.
Currently, Yomichan only supports Anki integration as far as I know. You can specify a different interface server but not the actual request structure as it is heavily dependent on AnkiConnect.
I believe it would be nice if Yomichan supported custom API interactions, allowing the user to specify a certain endpoint and a request to be sent, where they could add placeholders (such as the current Yomichan markers) to be replaced with the actual data.
This probably wouldn't be very user-friendly, so it could be hidden away as a secondary option to the default Anki. I guess not many people use it with anything other than Anki anyway, but I'd truly appreciate if I had the option to.