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
//! # klbfw - KarpelesLab REST Framework for Rust
//!
//! A comprehensive Rust client for interacting with RESTful API services.
//! This library simplifies making HTTP requests to REST endpoints, handling
//! authentication, token renewal, and response parsing.
//!
//! ## Features
//!
//! - Simple API for RESTful requests with JSON encoding/decoding
//! - Multiple authentication methods:
//! - OAuth2 token management with automatic renewal
//! - API key authentication with secure Ed25519 request signing
//! - Robust error handling with detailed error types
//! - Custom Time type for API timestamp handling
//! - Response parsing with path-based value access
//!
//! ## Basic Usage
//!
//! ```no_run
//! use klbfw::{Client, Response};
//! use serde::Deserialize;
//!
//! #[derive(Deserialize)]
//! struct User {
//! id: String,
//! name: String,
//! }
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a client
//! let ctx = Client::new();
//!
//! // Make a simple GET request
//! let user: User = ctx.apply("Users/Get", "GET", serde_json::json!({
//! "userId": "123"
//! }))?;
//!
//! println!("User: {} ({})", user.name, user.id);
//! Ok(())
//! }
//! ```
//!
//! ## Authentication
//!
//! ### Token Authentication
//!
//! ```no_run
//! use klbfw::{Client, Token};
//!
//! let token = Token::new(
//! "access_token".to_string(),
//! "refresh_token".to_string(),
//! "client_id".to_string(),
//! 3600,
//! );
//!
//! let ctx = Client::new().with_token(token);
//! ```
//!
//! ### API Key Authentication
//!
//! ```no_run
//! use klbfw::{Client, ApiKey};
//!
//! let api_key = ApiKey::new(
//! "key-12345".to_string(),
//! "base64_encoded_secret",
//! )?;
//!
//! let ctx = Client::new().with_api_key(api_key);
//! # Ok::<(), klbfw::RestError>(())
//! ```
// Re-export main types for convenience
pub use ApiKey;
pub use Config;
pub use ;
pub use ;
pub use RestContext;
pub use ;
pub use Time;
pub use Token;
pub use ;
// Re-export serde_json for convenience
pub use json;