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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! # WEBSERVICES Client
//!
//! `wwsvc_rs` is a web client which is used to consume SoftENGINE's WEBSERVICES, a proprietary API for their software WEBWARE.
//!
//! ## Usage
//!
//! Here is an example using the `derive` feature, which is the preferred way
//! of using this crate.
//!
//! ```rust,no_run
//! use wwsvc_rs::{WebwareClient, Unregistered, WWSVCGetData, collection};
//!
//! #[derive(WWSVCGetData, Debug, Clone, serde::Deserialize)]
//! #[wwsvc(function = "ARTIKEL")]
//! pub struct ArticleData {
//! #[serde(rename = "ART_1_25")]
//! pub article_number: String
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let client = WebwareClient::builder()
//! .webware_url("https://meine-webware.de")
//! .vendor_hash("my-vendor-hash")
//! .app_hash("my-app-hash")
//! .secret("1")
//! .revision(1)
//! .build();
//! let mut registered_client = client.register().await.expect("failed to register");
//! let articles = ArticleData::get(&mut registered_client, collection! {
//! "ARTNR" => "Artikel19Prozent",
//! }).await;
//! println!("{:#?}", articles);
//!
//! registered_client.deregister().await.unwrap();
//! }
//! ```
//!
//! You can, however, also define your own data structures
//! to use and reuse. For these purposes, you can directly use the client:
//!
//! ```rust,no_run
//! use reqwest::Method;
//! use wwsvc_rs::{collection, WebwareClient, WWSVCGetData, generate_get_response};
//!
//! #[derive(Debug, serde::Deserialize, Clone)]
//! pub struct ArticleData {
//! #[serde(rename = "ART_1_25")]
//! pub article_number: String,
//! }
//!
//! // You don't have to use this macro, it does however make generating responses a lot easier.
//! generate_get_response!(ArticleResponse, "ARTIKELLISTE", ArticleContainer, "ARTIKEL");
//!
//! #[tokio::main]
//! async fn main() {
//! let client = WebwareClient::builder()
//! .webware_url("https://meine-webware.de")
//! .vendor_hash("my-vendor-hash")
//! .app_hash("my-app-hash")
//! .secret("1")
//! .revision(1)
//! .build();
//! let mut registered_client = client.register().await.expect("failed to register");
//!
//! let articles = registered_client.request_generic::<ArticleResponse<ArticleData>>(Method::PUT, "ARTIKEL.GET", 1, collection! {
//! "ARTNR" => "Artikel19Prozent",
//! }, None)
//! .await
//! .unwrap();
//!
//! println!("{:#?}", articles.container.list.unwrap());
//!
//! registered_client.deregister().await.unwrap();
//! }
//!
//! ```
extern crate encoding_rs;
extern crate httpdate;
extern crate md5;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate self as wwsvc_rs;
/// Module containing the app hash, which is needed for each request.
/// Module containing the pagination cursor.
/// Module containing the error type.
/// Module containing the macros.
/// Module containing trais.
/// Module containing common response types.
pub use AppHash;
pub use Cursor;
pub use futures;
pub use Method;
pub use Value;
pub use async_trait;
pub use WWSVCGetData;
pub use WWSVCGetData;
/// Module containing the client.
pub use *;
pub use WebwareClient;
pub use Credentials;
pub use WWSVCError;
pub use Response;
/// Result type for the wwsvc-rs crate.
pub type WWClientResult<T> = Result;