Crates.io | diagramer |
lib.rs | diagramer |
version | 0.1.0 |
source | src |
created_at | 2023-02-18 01:48:42.820184 |
updated_at | 2023-02-18 01:48:42.820184 |
description | A sequence diagram generator service |
homepage | https://github.com/aboehm/diagramer-rs |
repository | https://github.com/aboehm/diagramer-rs.git |
max_upload_size | |
id | 787938 |
size | 118,582 |
A sequence diagram generator webservice in Rust🦀 based on rocket🚀.
Start diagramer
directly
cargo run
or build a release version via
cargo build --release
The client library is implemented in the module diagramer::client
.
use diagramer::client::Client;
let client = Client::new();
let session = client.new_session("http://localhost:8000").await;
println!("New session url {}", session.session_url());
session.add_link("a", "b", Some("Request")).await;
session.add_link("b", "c", Some("Forward")).await;
session.add_link("c", "a", Some("Response")).await;
The network based stress test also uses the client implementation.
Create a new session
curl -XPOST 'http://127.0.0.1:8000/api/new-session'
With a session ID and a URI to the session
{
"id": "2888964795923373081",
"uri": "/api/session/2888964795923373081"
}
Add a link from a
to b
with label with a label
curl -XPOST -H 'Content-Type: application/json' 'http://127.0.0.1:8000/api/session/2888964795923373081/links' -d '{"from":"a", "to":"b", "label":"with a label"}'
Get a JSON representation of the session
curl 'http://127.0.0.1:8000/api/session/2888964795923373081'
{
"id": 2888964795923373000,
"links": [
{
"timestamp": 1676679312120,
"from": "a",
"to": "b",
"label": "with a label",
"id": 2
}
],
"last_link": 2,
"mermaid_url": "/api/session/2888964795923373081/mermaid",
"svg_url": "/api/session/2888964795923373081/svg"
}