mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 19:31:33 +00:00
docs(api): Add api-common info on generating TypeScript bindings (#3330)
This commit is contained in:
parent
bef76630c5
commit
0f91759e4d
1 changed files with 7 additions and 0 deletions
|
@ -24,3 +24,10 @@ As you can see, each API endpoint needs a parameter type ( GetPosts), path (/pos
|
||||||
For a real example of a Lemmy API client, look at [lemmyBB](https://github.com/LemmyNet/lemmyBB/tree/main/src/api).
|
For a real example of a Lemmy API client, look at [lemmyBB](https://github.com/LemmyNet/lemmyBB/tree/main/src/api).
|
||||||
|
|
||||||
Lemmy also provides a websocket API. You can find the full websocket code in [this file](https://github.com/LemmyNet/lemmy/blob/main/src/api_routes_websocket.rs).
|
Lemmy also provides a websocket API. You can find the full websocket code in [this file](https://github.com/LemmyNet/lemmy/blob/main/src/api_routes_websocket.rs).
|
||||||
|
|
||||||
|
## Generate TypeScript bindings
|
||||||
|
|
||||||
|
TypeScript bindings (API types) can be generated by running `cargo test --features full`.
|
||||||
|
The ts files be generated into a `bindings` folder.
|
||||||
|
|
||||||
|
This crate uses [`ts_rs`](https://docs.rs/ts-rs/6.2.1/ts_rs/#traits) macros `derive(TS)` and `ts(export)` to attribute types for binding generating.
|
||||||
|
|
Loading…
Reference in a new issue