1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#![feature(custom_attribute)]
#![feature(plugin)]

//! Crate for working with [https://www.websequencediagrams.com/](https://www.websequencediagrams.com/)
//! public [RESTful API](https://www.websequencediagrams.com/embedding.html)
//! This service allows to create sequence diagrams from simple text.
//! Note: this library is a simple wrapper around the API.
//! Some features of this service require premium subscription (like export to pdf format)
//! Features supported by this library
//! * statically typed library. Different options are represented as enums
//! * multiple output formats: png, pdf (premium), svg (premium)
//! * detection of actual output format. E.g. trying to get pdf with wrong API key leads to png output
//! * allows specification of scale, paper size, paper orientation, style
//! * parse returned errors
//!
//! This crate contains command line tool for accessing websequencediagram API
//!
//! `$ wsdclient my_diag.wsd -o my.png`
//!
//! Example:
//! ```
//! use wsdclient::{get_diagram};
//!
//!use std::fs::File;
//!use std::io::Write;
//!
//!fn main(){
//!    let spec = "A->B: text1";
//!    let rez = get_diagram(spec, &Default::default()).unwrap();
//!    File::create("simple.png").unwrap()
//!        .write_all(&rez.diagram).unwrap();
//!}
//! ```


extern crate clap;
extern crate serde;
extern crate serde_json;
extern crate reqwest;

/// Contains types representing plot parameters(like format, page size, ...)
pub mod types;

/// Contains actual client
pub mod client;

/// Contains command line parsing
pub mod config;

pub use types::{Format, Style, PaperSize, PaperOrientation, PlotParameters, WSDEnum, DiagramError};
pub use client::{get_diagram, WSDResult};