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
//! # MyID SDK — Rust Client
//!
//! O'zbekiston Respublikasi MyID identifikatsiya tizimi uchun
//! rasmiy bo'lmagan Rust SDK kutubxonasi.
//!
//! ## Imkoniyatlar
//!
//! - **OAuth 2.0** — MyID API bilan autentifikatsiya
//! - **Type-safe config** — compile-time'da URL va parametrlar validatsiyasi
//! - **Async/await** — `tokio` runtime bilan to'liq asinxron ishlash
//! - **Xavfsizlik** — `client_secret` `Debug` outputda yashiriladi
//! - **Thread-safe** — `Send + Sync` compile-time kafolati
//!
//! ```toml
//! [dependencies]
//! myid = "0.1.8"
//! tokio = { version = "1", features = ["full"] }
//! ```
//! ## Tez boshlash
//!
//! ```rust
//! use myid::config::Config;
//! use myid::error::MyIdResult;
//!
//! fn main() -> MyIdResult<()> {
//! // Minimal config — faqat majburiy parametrlar
//! let config = Config::new(
//! "https://myid.uz",
//! "your_client_id",
//! "your_client_secret",
//! )?;
//!
//! println!("Base URL: {}", config.base_url());
//! Ok(())
//! }
//! ```
//!
//! ## Konfiguratsiya
//!
//! [`Config`] — SDK ning asosiy konfiguratsiya strukturasi.
//! Barcha parametrlar `new()` + `with_*()` chaining pattern orqali sozlanadi:
//!
//! ```rust
//! use std::time::Duration;
//! use myid::config::Config;
//! # use myid::error::MyIdResult;
//!
//! # fn main() -> MyIdResult<()> {
//! let config = Config::new("https://myid.uz", "client_id", "client_secret")?
//! .with_timeout(Duration::from_secs(30))
//! .with_connect_timeout(Duration::from_secs(5))
//! .with_user_agent("my-backend/1.0")
//! .with_proxy("http://proxy.local:8080")?;
//! # Ok(())
//! # }
//! ```
//!
//! Batafsil ma'lumot uchun [`config`] moduli dokumentatsiyasini ko'ring.
//!
//! ## Xatolarni boshqarish
//!
//! SDK barcha xatolarni [`MyIdError`] enum orqali qaytaradi.
//! Qulay ishlatish uchun [`MyIdResult<T>`](error::MyIdResult) type aliasi mavjud:
//!
//! ```rust
//! use myid::config::Config;
//! use myid::error::{MyIdError, MyIdResult};
//!
//! fn create_config() -> MyIdResult<()> {
//! let config = Config::new("https://myid.uz", "id", "secret")?;
//! Ok(())
//! }
//!
//! // Xatoni ushlash
//! match Config::new("noto'g'ri-url", "id", "secret") {
//! Ok(cfg) => println!("Muvaffaqiyatli: {}", cfg.base_url()),
//! Err(MyIdError::Config { message }) => {
//! eprintln!("Konfiguratsiya xatosi: {message}");
//! },
//! _ => unreachable!(),
//! }
//! ```
//! ## Features
//!
//! | Feature | Default | Tavsif |
//! |---------|---------|--------|
//! | `dotenvy` | ✅ Ha | `.env` fayldan konfiguratsiya yuklash ([`Config::from_env()`](config::Config::from_env)) |
//!
//! ### `dotenvy` ni o'chirish
//!
//! Agar `.env` fayl qo'llab-quvvatlash kerak bo'lmasa:
//!
//! ```toml
//! [dependencies]
//! myid = { version = "0.1.8", default-features = false }
//! ```
//!
//! ## Modullar
//!
//! | Modul | Tavsif |
//! |-------|--------|
//! | [`config`] | SDK konfiguratsiyasi — URL, timeout, proxy, user-agent |
//! | [`error`] | Xato tipi (`MyIdError`) va `Result` aliasi |
//! | [`client`] | MyID API ga so'rovlar yuborish |
//! | [`prelude`] | Tez-tez ishlatiladigan turlar yig'indisi |
//! | [`types`] | Type-safe qiymat turlari (PINFL, passport, va boshqalar) |
//! | [`dto`] | API so'rov va javob DTO strukturalari |
//!
//! ## Xavfsizlik eslatmalari
//!
//! - `client_secret` — **faqat backend muhitida** saqlang
//! - `Debug` output'da secret avtomatik `<redacted>` sifatida ko'rsatiladi
//! - Frontend yoki client-side kodda **ishlatmang**
//!
//! ## Minimal Rust versiyasi (MSRV)
//!
//! Rust **1.93.0** yoki undan yuqori talab qilinadi.
pub use MyIdClient;
pub use Config;
pub use ;