Refactor API calls #13

Open
opened 2026-04-06 15:57:01 +00:00 by phil · 3 comments
Owner

Currently API calls are made only from the web app. The goal is to have a simulator as a desktop application, and a no_std target for embedded devices.

Find a way to simplify management of API calls. Maybe a trait?

Currently API calls are made only from the web app. The goal is to have a simulator as a desktop application, and a no_std target for embedded devices. Find a way to simplify management of API calls. Maybe a trait?
Author
Owner

Crates used to make API calls on different platforms:

They are all async.

Crates used to make API calls on different platforms: - wasm: [gloo-net](https://docs.rs/gloo-net/latest/gloo_net/http/struct.Request.html#method.send) - desktop: [reqwest](https://docs.rs/reqwest/latest/reqwest/struct.RequestBuilder.html#method.send) - no_std: [reqwless](https://docs.rs/reqwless) They are all `async`.
Author
Owner

For every request, what is required:

  • TLS client
  • URL
  • HTTP verb
  • headers
  • JSON parsing

Send the request and get the response asynchronously.

For every request, what is required: - TLS client - URL - HTTP verb - headers - JSON parsing Send the request and get the response asynchronously.
Author
Owner

How to do JSON parsing:

wasm and desktop

serde + serde_json

no_std

It seems https://docs.rs/serde-json-core/ is a good option.

serde_json seems to support no_std github.com/serde-rs/json@a42fa980f8/Cargo.toml (L55) but some io is required, and core does not provide it yet. https://github.com/serde-rs/json/issues/1316

How to do JSON parsing: ## wasm and desktop serde + serde_json ## no_std It seems https://docs.rs/serde-json-core/ is a good option. `serde_json` seems to support no_std https://github.com/serde-rs/json/blob/a42fa980f8556cda36d896fa3713544b2e5eaa2c/Cargo.toml#L55 but some `io` is required, and `core` does not provide it yet. https://github.com/serde-rs/json/issues/1316
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
phil/spometrat#13
No description provided.