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

Mixed types arrays in ankiconnect #412

@uieoa

Description

@uieoa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions