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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! # bora - api Documentation
//!
//! Hello, and welcome to the bora API documentation!
//!
//! This API documentation is highly technical and is purely a reference.
//!
//! Depend on `bora` in `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! vamo-macros = { path = "../vamo-macros" }
//! ```
//!
//! <small>Note that development versions, tagged with `-dev`, are not published
//! and need to be specified as [git dependencies].</small>
//!
//! ```rust,ignore
//! use deboa::{errors::DeboaError, Result};
//! use vamo::Vamo;
//! use vamo_macros::bora;
//!
//! use serde::Deserialize;
//!
//! #[derive(Deserialize, Debug)]
//! pub struct Post {
//! pub id: u32,
//! pub title: String,
//! }
//!
//! #[bora(
//! api(
//! get(name="get_all", path="/posts", res_body=Vec<Post>, format="json"),
//! get(name="get_by_id", path="/posts/<id:i32>", res_body=Post, format="json"),
//! get(name="query_by_id", path="/posts?<id:i32>", res_body=Vec<Post>, format="json"),
//! get(name="query_by_title", path="/posts?<id:i32>&<title:&str>", res_body=Vec<Post>, format="json")
//! )
//! )]
//! pub struct PostService;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let client = Vamo::new("https://jsonplaceholder.typicode.com")?;
//!
//! let mut post_service = PostService::new(client);
//!
//! let post = post_service.get_by_id(1).await?;
//!
//! println!("id...: {}", post.id);
//! println!("title: {}", post.title);
//!
//! assert_eq!(post.id, 1);
//! Ok(())
//! }
//! ```
//!
//! Disabled features can be selectively enabled in `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! vamo = { version = "0.0.1" }
//! deboa-extras = { version = "0.0.1" }
//! ```
//!
pub
pub
pub
pub use bora;