Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Mixed types arrays in ankiconnect #412

Open
uieoa opened this issue Oct 22, 2023 · 0 comments
Open

Mixed types arrays in ankiconnect #412

uieoa opened this issue Oct 22, 2023 · 0 comments

Comments

@uieoa
Copy link

uieoa commented Oct 22, 2023

First of all, thank you for a great work with this plugin

Some methods like getNumCardsReviewedByDay do return an array with various data types, like this:

{"result": [["2023-10-21", 10], ["2023-10-18", 45]], "error": null}

where "2023-10-21" is a string and 10 is int.
I think it makes no problem for python or js but for swift and other strong-typed languages this behavior causes a lot of troubles.
Hacks are really dirty: https://stackoverflow.com/questions/48996643/parse-json-array-that-contains-string-and-int-in-swift-4

I would like to suggest two solutions:

  1. New methods like getNumCardsReviewedByDay_strong which will always return an array of array of strings like:
    {"result": [["2023-10-21", "10"], ["2023-10-18", " 45"]], "error": null}
  2. New methods like getNumCardsReviewedByDay_strong which will always return an array of some data like:
    {"result": [{"date": "2000-01-01T01:01:01", count: 10}, {"date": "2020-02-02T01:01:01", count: 45}], "error": null}

I think I can make a PR to any of this but which way do you like the best?

Kind regards

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant