uapi_sdk_rust/services/
mod.rs

1use crate::client::Client;
2use crate::errors::Error;
3use crate::Result;
4use reqwest::header::{HeaderMap, HeaderValue};
5use reqwest::Method;
6use serde_json::Value;
7use tracing::instrument;
8use urlencoding::encode;
9#[derive(Debug, Clone)]
10pub struct ClipzyZaiXianJianTieBanService<'a> {
11    pub(crate) client: &'a Client,
12}
13
14impl<'a> ClipzyZaiXianJianTieBanService<'a> {
15    /// 步骤2 (方法一): 获取加密数据
16    #[instrument(skip(self, params))]
17    pub async fn get_clipzy_get(&self, params: GetClipzyGetParams) -> Result<Value> {
18        let mut path = "/api/get".to_string();
19
20        let mut query: Vec<(String, String)> = Vec::new();
21        query.push(("id".to_string(), params.id_query.clone()));
22        let query = if query.is_empty() { None } else { Some(query) };
23
24        let mut extra_headers = HeaderMap::new();
25        let headers = if extra_headers.is_empty() {
26            None
27        } else {
28            Some(extra_headers)
29        };
30        let body = None;
31
32        self.client
33            .request_json(Method::GET, &path, headers, query, body)
34            .await
35    }
36    /// 步骤2 (方法二): 获取原始文本
37    #[instrument(skip(self, params))]
38    pub async fn get_clipzy_raw(&self, params: GetClipzyRawParams) -> Result<Value> {
39        let mut path = "/api/raw/{id}".to_string();
40        {
41            let encoded = encode(&params.id_path).into_owned();
42            path = path.replace("{id}", &encoded);
43        }
44
45        let mut query: Vec<(String, String)> = Vec::new();
46        query.push(("key".to_string(), params.key_query.clone()));
47        let query = if query.is_empty() { None } else { Some(query) };
48
49        let mut extra_headers = HeaderMap::new();
50        let headers = if extra_headers.is_empty() {
51            None
52        } else {
53            Some(extra_headers)
54        };
55        let body = None;
56
57        self.client
58            .request_json(Method::GET, &path, headers, query, body)
59            .await
60    }
61    /// 步骤1:上传加密数据
62    #[instrument(skip(self, params))]
63    pub async fn post_clipzy_store(&self, params: PostClipzyStoreParams) -> Result<Value> {
64        let mut path = "/api/store".to_string();
65
66        let mut query: Vec<(String, String)> = Vec::new();
67        let query = if query.is_empty() { None } else { Some(query) };
68
69        let mut extra_headers = HeaderMap::new();
70        let headers = if extra_headers.is_empty() {
71            None
72        } else {
73            Some(extra_headers)
74        };
75        let body = params.body.clone();
76
77        self.client
78            .request_json(Method::POST, &path, headers, query, body)
79            .await
80    }
81}
82
83#[derive(Debug, Clone)]
84pub struct GetClipzyGetParams {
85    pub id_query: String,
86}
87
88impl GetClipzyGetParams {
89    pub fn new(id_query: impl Into<String>) -> Self {
90        Self {
91            id_query: id_query.into(),
92        }
93    }
94}
95
96#[derive(Debug, Clone)]
97pub struct GetClipzyRawParams {
98    pub id_path: String,
99    pub key_query: String,
100}
101
102impl GetClipzyRawParams {
103    pub fn new(id_path: impl Into<String>, key_query: impl Into<String>) -> Self {
104        Self {
105            id_path: id_path.into(),
106            key_query: key_query.into(),
107        }
108    }
109}
110
111#[derive(Debug, Clone)]
112pub struct PostClipzyStoreParams {
113    pub body: Option<Value>,
114}
115
116impl PostClipzyStoreParams {
117    pub fn new() -> Self {
118        Self { body: None }
119    }
120    pub fn body(mut self, value: Value) -> Self {
121        self.body = Some(value);
122        self
123    }
124}
125#[derive(Debug, Clone)]
126pub struct ConvertService<'a> {
127    pub(crate) client: &'a Client,
128}
129
130impl<'a> ConvertService<'a> {
131    /// Unix时间戳与日期字符串双向转换
132    #[instrument(skip(self, params))]
133    pub async fn get_convert_unixtime(&self, params: GetConvertUnixtimeParams) -> Result<Value> {
134        let mut path = "/convert/unixtime".to_string();
135
136        let mut query: Vec<(String, String)> = Vec::new();
137        query.push(("time".to_string(), params.time_query.clone()));
138        let query = if query.is_empty() { None } else { Some(query) };
139
140        let mut extra_headers = HeaderMap::new();
141        let headers = if extra_headers.is_empty() {
142            None
143        } else {
144            Some(extra_headers)
145        };
146        let body = None;
147
148        self.client
149            .request_json(Method::GET, &path, headers, query, body)
150            .await
151    }
152    /// 美化并格式化JSON字符串
153    #[instrument(skip(self, params))]
154    pub async fn post_convert_json(&self, params: PostConvertJsonParams) -> Result<Value> {
155        let mut path = "/convert/json".to_string();
156
157        let mut query: Vec<(String, String)> = Vec::new();
158        let query = if query.is_empty() { None } else { Some(query) };
159
160        let mut extra_headers = HeaderMap::new();
161        let headers = if extra_headers.is_empty() {
162            None
163        } else {
164            Some(extra_headers)
165        };
166        let body = params.body.clone();
167
168        self.client
169            .request_json(Method::POST, &path, headers, query, body)
170            .await
171    }
172}
173
174#[derive(Debug, Clone)]
175pub struct GetConvertUnixtimeParams {
176    pub time_query: String,
177}
178
179impl GetConvertUnixtimeParams {
180    pub fn new(time_query: impl Into<String>) -> Self {
181        Self {
182            time_query: time_query.into(),
183        }
184    }
185}
186
187#[derive(Debug, Clone)]
188pub struct PostConvertJsonParams {
189    pub body: Option<Value>,
190}
191
192impl PostConvertJsonParams {
193    pub fn new() -> Self {
194        Self { body: None }
195    }
196    pub fn body(mut self, value: Value) -> Self {
197        self.body = Some(value);
198        self
199    }
200}
201#[derive(Debug, Clone)]
202pub struct DailyService<'a> {
203    pub(crate) client: &'a Client,
204}
205
206impl<'a> DailyService<'a> {
207    /// 生成每日新闻摘要图片
208    #[instrument(skip(self))]
209    pub async fn get_daily_news_image(&self) -> Result<Value> {
210        let mut path = "/daily/news-image".to_string();
211
212        let mut query: Vec<(String, String)> = Vec::new();
213        let query = if query.is_empty() { None } else { Some(query) };
214
215        let mut extra_headers = HeaderMap::new();
216        let headers = if extra_headers.is_empty() {
217            None
218        } else {
219            Some(extra_headers)
220        };
221        let body = None;
222
223        self.client
224            .request_json(Method::GET, &path, headers, query, body)
225            .await
226    }
227}
228
229#[derive(Debug, Clone)]
230pub struct GameService<'a> {
231    pub(crate) client: &'a Client,
232}
233
234impl<'a> GameService<'a> {
235    /// 获取Epic Games免费游戏
236    #[instrument(skip(self))]
237    pub async fn get_game_epic_free(&self) -> Result<Value> {
238        let mut path = "/game/epic-free".to_string();
239
240        let mut query: Vec<(String, String)> = Vec::new();
241        let query = if query.is_empty() { None } else { Some(query) };
242
243        let mut extra_headers = HeaderMap::new();
244        let headers = if extra_headers.is_empty() {
245            None
246        } else {
247            Some(extra_headers)
248        };
249        let body = None;
250
251        self.client
252            .request_json(Method::GET, &path, headers, query, body)
253            .await
254    }
255    /// 查询Minecraft玩家历史用户名
256    #[instrument(skip(self, params))]
257    pub async fn get_game_minecraft_historyid(
258        &self,
259        params: GetGameMinecraftHistoryidParams,
260    ) -> Result<Value> {
261        let mut path = "/game/minecraft/historyid".to_string();
262
263        let mut query: Vec<(String, String)> = Vec::new();
264        query.push(("uuid".to_string(), params.uuid_query.clone()));
265        let query = if query.is_empty() { None } else { Some(query) };
266
267        let mut extra_headers = HeaderMap::new();
268        let headers = if extra_headers.is_empty() {
269            None
270        } else {
271            Some(extra_headers)
272        };
273        let body = None;
274
275        self.client
276            .request_json(Method::GET, &path, headers, query, body)
277            .await
278    }
279    /// 查询Minecraft服务器状态
280    #[instrument(skip(self, params))]
281    pub async fn get_game_minecraft_serverstatus(
282        &self,
283        params: GetGameMinecraftServerstatusParams,
284    ) -> Result<Value> {
285        let mut path = "/game/minecraft/serverstatus".to_string();
286
287        let mut query: Vec<(String, String)> = Vec::new();
288        query.push(("server".to_string(), params.server_query.clone()));
289        let query = if query.is_empty() { None } else { Some(query) };
290
291        let mut extra_headers = HeaderMap::new();
292        let headers = if extra_headers.is_empty() {
293            None
294        } else {
295            Some(extra_headers)
296        };
297        let body = None;
298
299        self.client
300            .request_json(Method::GET, &path, headers, query, body)
301            .await
302    }
303    /// 查询Minecraft玩家信息
304    #[instrument(skip(self, params))]
305    pub async fn get_game_minecraft_userinfo(
306        &self,
307        params: GetGameMinecraftUserinfoParams,
308    ) -> Result<Value> {
309        let mut path = "/game/minecraft/userinfo".to_string();
310
311        let mut query: Vec<(String, String)> = Vec::new();
312        query.push(("username".to_string(), params.username_query.clone()));
313        let query = if query.is_empty() { None } else { Some(query) };
314
315        let mut extra_headers = HeaderMap::new();
316        let headers = if extra_headers.is_empty() {
317            None
318        } else {
319            Some(extra_headers)
320        };
321        let body = None;
322
323        self.client
324            .request_json(Method::GET, &path, headers, query, body)
325            .await
326    }
327    /// 获取Steam用户公开摘要
328    #[instrument(skip(self, params))]
329    pub async fn get_game_steam_summary(&self, params: GetGameSteamSummaryParams) -> Result<Value> {
330        let mut path = "/game/steam/summary".to_string();
331
332        let mut query: Vec<(String, String)> = Vec::new();
333        if let Some(value) = &params.steamid_query {
334            query.push(("steamid".to_string(), value.clone()));
335        }
336        if let Some(value) = &params.id_query {
337            query.push(("id".to_string(), value.clone()));
338        }
339        if let Some(value) = &params.id_3_query {
340            query.push(("id3".to_string(), value.clone()));
341        }
342        if let Some(value) = &params.key_query {
343            query.push(("key".to_string(), value.clone()));
344        }
345        let query = if query.is_empty() { None } else { Some(query) };
346
347        let mut extra_headers = HeaderMap::new();
348        let headers = if extra_headers.is_empty() {
349            None
350        } else {
351            Some(extra_headers)
352        };
353        let body = None;
354
355        self.client
356            .request_json(Method::GET, &path, headers, query, body)
357            .await
358    }
359}
360
361#[derive(Debug, Clone)]
362pub struct GetGameMinecraftHistoryidParams {
363    pub uuid_query: String,
364}
365
366impl GetGameMinecraftHistoryidParams {
367    pub fn new(uuid_query: impl Into<String>) -> Self {
368        Self {
369            uuid_query: uuid_query.into(),
370        }
371    }
372}
373
374#[derive(Debug, Clone)]
375pub struct GetGameMinecraftServerstatusParams {
376    pub server_query: String,
377}
378
379impl GetGameMinecraftServerstatusParams {
380    pub fn new(server_query: impl Into<String>) -> Self {
381        Self {
382            server_query: server_query.into(),
383        }
384    }
385}
386
387#[derive(Debug, Clone)]
388pub struct GetGameMinecraftUserinfoParams {
389    pub username_query: String,
390}
391
392impl GetGameMinecraftUserinfoParams {
393    pub fn new(username_query: impl Into<String>) -> Self {
394        Self {
395            username_query: username_query.into(),
396        }
397    }
398}
399
400#[derive(Debug, Clone)]
401pub struct GetGameSteamSummaryParams {
402    pub steamid_query: Option<String>,
403    pub id_query: Option<String>,
404    pub id_3_query: Option<String>,
405    pub key_query: Option<String>,
406}
407
408impl GetGameSteamSummaryParams {
409    pub fn new() -> Self {
410        Self {
411            steamid_query: None,
412            id_query: None,
413            id_3_query: None,
414            key_query: None,
415        }
416    }
417    pub fn steamid_query(mut self, value: impl Into<String>) -> Self {
418        self.steamid_query = Some(value.into());
419        self
420    }
421    pub fn id_query(mut self, value: impl Into<String>) -> Self {
422        self.id_query = Some(value.into());
423        self
424    }
425    pub fn id_3_query(mut self, value: impl Into<String>) -> Self {
426        self.id_3_query = Some(value.into());
427        self
428    }
429    pub fn key_query(mut self, value: impl Into<String>) -> Self {
430        self.key_query = Some(value.into());
431        self
432    }
433}
434#[derive(Debug, Clone)]
435pub struct ImageService<'a> {
436    pub(crate) client: &'a Client,
437}
438
439impl<'a> ImageService<'a> {
440    /// 获取Gravatar头像
441    #[instrument(skip(self, params))]
442    pub async fn get_avatar_gravatar(&self, params: GetAvatarGravatarParams) -> Result<Value> {
443        let mut path = "/avatar/gravatar".to_string();
444
445        let mut query: Vec<(String, String)> = Vec::new();
446        if let Some(value) = &params.email_query {
447            query.push(("email".to_string(), value.clone()));
448        }
449        if let Some(value) = &params.hash_query {
450            query.push(("hash".to_string(), value.clone()));
451        }
452        if let Some(value) = &params.s_query {
453            query.push(("s".to_string(), value.clone()));
454        }
455        if let Some(value) = &params.d_query {
456            query.push(("d".to_string(), value.clone()));
457        }
458        if let Some(value) = &params.r_query {
459            query.push(("r".to_string(), value.clone()));
460        }
461        let query = if query.is_empty() { None } else { Some(query) };
462
463        let mut extra_headers = HeaderMap::new();
464        let headers = if extra_headers.is_empty() {
465            None
466        } else {
467            Some(extra_headers)
468        };
469        let body = None;
470
471        self.client
472            .request_json(Method::GET, &path, headers, query, body)
473            .await
474    }
475    /// 获取必应每日壁纸
476    #[instrument(skip(self))]
477    pub async fn get_image_bing_daily(&self) -> Result<Value> {
478        let mut path = "/image/bing-daily".to_string();
479
480        let mut query: Vec<(String, String)> = Vec::new();
481        let query = if query.is_empty() { None } else { Some(query) };
482
483        let mut extra_headers = HeaderMap::new();
484        let headers = if extra_headers.is_empty() {
485            None
486        } else {
487            Some(extra_headers)
488        };
489        let body = None;
490
491        self.client
492            .request_json(Method::GET, &path, headers, query, body)
493            .await
494    }
495    /// 生成摸摸头GIF (QQ号方式)
496    #[instrument(skip(self, params))]
497    pub async fn get_image_motou(&self, params: GetImageMotouParams) -> Result<Value> {
498        let mut path = "/image/motou".to_string();
499
500        let mut query: Vec<(String, String)> = Vec::new();
501        query.push(("qq".to_string(), params.qq_query.clone()));
502        if let Some(value) = &params.bg_color_query {
503            query.push(("bg_color".to_string(), value.clone()));
504        }
505        let query = if query.is_empty() { None } else { Some(query) };
506
507        let mut extra_headers = HeaderMap::new();
508        let headers = if extra_headers.is_empty() {
509            None
510        } else {
511            Some(extra_headers)
512        };
513        let body = None;
514
515        self.client
516            .request_json(Method::GET, &path, headers, query, body)
517            .await
518    }
519    /// 动态生成二维码
520    #[instrument(skip(self, params))]
521    pub async fn get_image_qrcode(&self, params: GetImageQrcodeParams) -> Result<Value> {
522        let mut path = "/image/qrcode".to_string();
523
524        let mut query: Vec<(String, String)> = Vec::new();
525        query.push(("text".to_string(), params.text_query.clone()));
526        if let Some(value) = &params.size_query {
527            query.push(("size".to_string(), value.clone()));
528        }
529        if let Some(value) = &params.format_query {
530            query.push(("format".to_string(), value.clone()));
531        }
532        let query = if query.is_empty() { None } else { Some(query) };
533
534        let mut extra_headers = HeaderMap::new();
535        let headers = if extra_headers.is_empty() {
536            None
537        } else {
538            Some(extra_headers)
539        };
540        let body = None;
541
542        self.client
543            .request_json(Method::GET, &path, headers, query, body)
544            .await
545    }
546    /// 将在线图片转换为Base64
547    #[instrument(skip(self, params))]
548    pub async fn get_image_tobase_64(&self, params: GetImageTobase64Params) -> Result<Value> {
549        let mut path = "/image/tobase64".to_string();
550
551        let mut query: Vec<(String, String)> = Vec::new();
552        query.push(("url".to_string(), params.url_query.clone()));
553        let query = if query.is_empty() { None } else { Some(query) };
554
555        let mut extra_headers = HeaderMap::new();
556        let headers = if extra_headers.is_empty() {
557            None
558        } else {
559            Some(extra_headers)
560        };
561        let body = None;
562
563        self.client
564            .request_json(Method::GET, &path, headers, query, body)
565            .await
566    }
567    /// 无损压缩图片
568    #[instrument(skip(self, params))]
569    pub async fn post_image_compress(&self, params: PostImageCompressParams) -> Result<Value> {
570        let mut path = "/image/compress".to_string();
571
572        let mut query: Vec<(String, String)> = Vec::new();
573        if let Some(value) = &params.level_query {
574            query.push(("level".to_string(), value.clone()));
575        }
576        if let Some(value) = &params.format_query {
577            query.push(("format".to_string(), value.clone()));
578        }
579        let query = if query.is_empty() { None } else { Some(query) };
580
581        let mut extra_headers = HeaderMap::new();
582        let headers = if extra_headers.is_empty() {
583            None
584        } else {
585            Some(extra_headers)
586        };
587        let body = params.body.clone();
588
589        self.client
590            .request_json(Method::POST, &path, headers, query, body)
591            .await
592    }
593    /// 通过Base64编码上传图片
594    #[instrument(skip(self, params))]
595    pub async fn post_image_frombase_64(&self, params: PostImageFrombase64Params) -> Result<Value> {
596        let mut path = "/image/frombase64".to_string();
597
598        let mut query: Vec<(String, String)> = Vec::new();
599        let query = if query.is_empty() { None } else { Some(query) };
600
601        let mut extra_headers = HeaderMap::new();
602        let headers = if extra_headers.is_empty() {
603            None
604        } else {
605            Some(extra_headers)
606        };
607        let body = params.body.clone();
608
609        self.client
610            .request_json(Method::POST, &path, headers, query, body)
611            .await
612    }
613    /// 生成摸摸头GIF (图片上传或URL方式)
614    #[instrument(skip(self, params))]
615    pub async fn post_image_motou(&self, params: PostImageMotouParams) -> Result<Value> {
616        let mut path = "/image/motou".to_string();
617
618        let mut query: Vec<(String, String)> = Vec::new();
619        let query = if query.is_empty() { None } else { Some(query) };
620
621        let mut extra_headers = HeaderMap::new();
622        let headers = if extra_headers.is_empty() {
623            None
624        } else {
625            Some(extra_headers)
626        };
627        let body = params.body.clone();
628
629        self.client
630            .request_json(Method::POST, &path, headers, query, body)
631            .await
632    }
633    /// 生成你们怎么不说话了表情包
634    #[instrument(skip(self, params))]
635    pub async fn post_image_speechless(&self, params: PostImageSpeechlessParams) -> Result<Value> {
636        let mut path = "/image/speechless".to_string();
637
638        let mut query: Vec<(String, String)> = Vec::new();
639        let query = if query.is_empty() { None } else { Some(query) };
640
641        let mut extra_headers = HeaderMap::new();
642        let headers = if extra_headers.is_empty() {
643            None
644        } else {
645            Some(extra_headers)
646        };
647        let body = params.body.clone();
648
649        self.client
650            .request_json(Method::POST, &path, headers, query, body)
651            .await
652    }
653    /// SVG转图片
654    #[instrument(skip(self, params))]
655    pub async fn post_image_svg(&self, params: PostImageSvgParams) -> Result<Value> {
656        let mut path = "/image/svg".to_string();
657
658        let mut query: Vec<(String, String)> = Vec::new();
659        if let Some(value) = &params.format_query {
660            query.push(("format".to_string(), value.clone()));
661        }
662        if let Some(value) = &params.width_query {
663            query.push(("width".to_string(), value.clone()));
664        }
665        if let Some(value) = &params.height_query {
666            query.push(("height".to_string(), value.clone()));
667        }
668        if let Some(value) = &params.quality_query {
669            query.push(("quality".to_string(), value.clone()));
670        }
671        let query = if query.is_empty() { None } else { Some(query) };
672
673        let mut extra_headers = HeaderMap::new();
674        let headers = if extra_headers.is_empty() {
675            None
676        } else {
677            Some(extra_headers)
678        };
679        let body = params.body.clone();
680
681        self.client
682            .request_json(Method::POST, &path, headers, query, body)
683            .await
684    }
685}
686
687#[derive(Debug, Clone)]
688pub struct GetAvatarGravatarParams {
689    pub email_query: Option<String>,
690    pub hash_query: Option<String>,
691    pub s_query: Option<String>,
692    pub d_query: Option<String>,
693    pub r_query: Option<String>,
694}
695
696impl GetAvatarGravatarParams {
697    pub fn new() -> Self {
698        Self {
699            email_query: None,
700            hash_query: None,
701            s_query: None,
702            d_query: None,
703            r_query: None,
704        }
705    }
706    pub fn email_query(mut self, value: impl Into<String>) -> Self {
707        self.email_query = Some(value.into());
708        self
709    }
710    pub fn hash_query(mut self, value: impl Into<String>) -> Self {
711        self.hash_query = Some(value.into());
712        self
713    }
714    pub fn s_query(mut self, value: impl Into<String>) -> Self {
715        self.s_query = Some(value.into());
716        self
717    }
718    pub fn d_query(mut self, value: impl Into<String>) -> Self {
719        self.d_query = Some(value.into());
720        self
721    }
722    pub fn r_query(mut self, value: impl Into<String>) -> Self {
723        self.r_query = Some(value.into());
724        self
725    }
726}
727
728#[derive(Debug, Clone)]
729pub struct GetImageMotouParams {
730    pub qq_query: String,
731    pub bg_color_query: Option<String>,
732}
733
734impl GetImageMotouParams {
735    pub fn new(qq_query: impl Into<String>) -> Self {
736        Self {
737            qq_query: qq_query.into(),
738            bg_color_query: None,
739        }
740    }
741    pub fn bg_color_query(mut self, value: impl Into<String>) -> Self {
742        self.bg_color_query = Some(value.into());
743        self
744    }
745}
746
747#[derive(Debug, Clone)]
748pub struct GetImageQrcodeParams {
749    pub text_query: String,
750    pub size_query: Option<String>,
751    pub format_query: Option<String>,
752}
753
754impl GetImageQrcodeParams {
755    pub fn new(text_query: impl Into<String>) -> Self {
756        Self {
757            text_query: text_query.into(),
758            size_query: None,
759            format_query: None,
760        }
761    }
762    pub fn size_query(mut self, value: impl Into<String>) -> Self {
763        self.size_query = Some(value.into());
764        self
765    }
766    pub fn format_query(mut self, value: impl Into<String>) -> Self {
767        self.format_query = Some(value.into());
768        self
769    }
770}
771
772#[derive(Debug, Clone)]
773pub struct GetImageTobase64Params {
774    pub url_query: String,
775}
776
777impl GetImageTobase64Params {
778    pub fn new(url_query: impl Into<String>) -> Self {
779        Self {
780            url_query: url_query.into(),
781        }
782    }
783}
784
785#[derive(Debug, Clone)]
786pub struct PostImageCompressParams {
787    pub level_query: Option<String>,
788    pub format_query: Option<String>,
789    pub body: Option<Value>,
790}
791
792impl PostImageCompressParams {
793    pub fn new() -> Self {
794        Self {
795            level_query: None,
796            format_query: None,
797            body: None,
798        }
799    }
800    pub fn level_query(mut self, value: impl Into<String>) -> Self {
801        self.level_query = Some(value.into());
802        self
803    }
804    pub fn format_query(mut self, value: impl Into<String>) -> Self {
805        self.format_query = Some(value.into());
806        self
807    }
808    pub fn body(mut self, value: Value) -> Self {
809        self.body = Some(value);
810        self
811    }
812}
813
814#[derive(Debug, Clone)]
815pub struct PostImageFrombase64Params {
816    pub body: Option<Value>,
817}
818
819impl PostImageFrombase64Params {
820    pub fn new() -> Self {
821        Self { body: None }
822    }
823    pub fn body(mut self, value: Value) -> Self {
824        self.body = Some(value);
825        self
826    }
827}
828
829#[derive(Debug, Clone)]
830pub struct PostImageMotouParams {
831    pub body: Option<Value>,
832}
833
834impl PostImageMotouParams {
835    pub fn new() -> Self {
836        Self { body: None }
837    }
838    pub fn body(mut self, value: Value) -> Self {
839        self.body = Some(value);
840        self
841    }
842}
843
844#[derive(Debug, Clone)]
845pub struct PostImageSpeechlessParams {
846    pub body: Option<Value>,
847}
848
849impl PostImageSpeechlessParams {
850    pub fn new() -> Self {
851        Self { body: None }
852    }
853    pub fn body(mut self, value: Value) -> Self {
854        self.body = Some(value);
855        self
856    }
857}
858
859#[derive(Debug, Clone)]
860pub struct PostImageSvgParams {
861    pub format_query: Option<String>,
862    pub width_query: Option<String>,
863    pub height_query: Option<String>,
864    pub quality_query: Option<String>,
865    pub body: Option<Value>,
866}
867
868impl PostImageSvgParams {
869    pub fn new() -> Self {
870        Self {
871            format_query: None,
872            width_query: None,
873            height_query: None,
874            quality_query: None,
875            body: None,
876        }
877    }
878    pub fn format_query(mut self, value: impl Into<String>) -> Self {
879        self.format_query = Some(value.into());
880        self
881    }
882    pub fn width_query(mut self, value: impl Into<String>) -> Self {
883        self.width_query = Some(value.into());
884        self
885    }
886    pub fn height_query(mut self, value: impl Into<String>) -> Self {
887        self.height_query = Some(value.into());
888        self
889    }
890    pub fn quality_query(mut self, value: impl Into<String>) -> Self {
891        self.quality_query = Some(value.into());
892        self
893    }
894    pub fn body(mut self, value: Value) -> Self {
895        self.body = Some(value);
896        self
897    }
898}
899#[derive(Debug, Clone)]
900pub struct MiscService<'a> {
901    pub(crate) client: &'a Client,
902}
903
904impl<'a> MiscService<'a> {
905    /// 获取指定日期的程序员历史事件
906    #[instrument(skip(self, params))]
907    pub async fn get_history_programmer(
908        &self,
909        params: GetHistoryProgrammerParams,
910    ) -> Result<Value> {
911        let mut path = "/history/programmer".to_string();
912
913        let mut query: Vec<(String, String)> = Vec::new();
914        query.push(("month".to_string(), params.month_query.clone()));
915        query.push(("day".to_string(), params.day_query.clone()));
916        let query = if query.is_empty() { None } else { Some(query) };
917
918        let mut extra_headers = HeaderMap::new();
919        let headers = if extra_headers.is_empty() {
920            None
921        } else {
922            Some(extra_headers)
923        };
924        let body = None;
925
926        self.client
927            .request_json(Method::GET, &path, headers, query, body)
928            .await
929    }
930    /// 获取今天的程序员历史事件
931    #[instrument(skip(self))]
932    pub async fn get_history_programmer_today(&self) -> Result<Value> {
933        let mut path = "/history/programmer/today".to_string();
934
935        let mut query: Vec<(String, String)> = Vec::new();
936        let query = if query.is_empty() { None } else { Some(query) };
937
938        let mut extra_headers = HeaderMap::new();
939        let headers = if extra_headers.is_empty() {
940            None
941        } else {
942            Some(extra_headers)
943        };
944        let body = None;
945
946        self.client
947            .request_json(Method::GET, &path, headers, query, body)
948            .await
949    }
950    /// 获取多平台实时热榜
951    #[instrument(skip(self, params))]
952    pub async fn get_misc_hotboard(&self, params: GetMiscHotboardParams) -> Result<Value> {
953        let mut path = "/misc/hotboard".to_string();
954
955        let mut query: Vec<(String, String)> = Vec::new();
956        query.push(("type".to_string(), params.type_query.clone()));
957        let query = if query.is_empty() { None } else { Some(query) };
958
959        let mut extra_headers = HeaderMap::new();
960        let headers = if extra_headers.is_empty() {
961            None
962        } else {
963            Some(extra_headers)
964        };
965        let body = None;
966
967        self.client
968            .request_json(Method::GET, &path, headers, query, body)
969            .await
970    }
971    /// 查询手机号码归属地信息
972    #[instrument(skip(self, params))]
973    pub async fn get_misc_phoneinfo(&self, params: GetMiscPhoneinfoParams) -> Result<Value> {
974        let mut path = "/misc/phoneinfo".to_string();
975
976        let mut query: Vec<(String, String)> = Vec::new();
977        query.push(("phone".to_string(), params.phone_query.clone()));
978        let query = if query.is_empty() { None } else { Some(query) };
979
980        let mut extra_headers = HeaderMap::new();
981        let headers = if extra_headers.is_empty() {
982            None
983        } else {
984            Some(extra_headers)
985        };
986        let body = None;
987
988        self.client
989            .request_json(Method::GET, &path, headers, query, body)
990            .await
991    }
992    /// 生成高度可定制的随机数
993    #[instrument(skip(self, params))]
994    pub async fn get_misc_randomnumber(&self, params: GetMiscRandomnumberParams) -> Result<Value> {
995        let mut path = "/misc/randomnumber".to_string();
996
997        let mut query: Vec<(String, String)> = Vec::new();
998        if let Some(value) = &params.min_query {
999            query.push(("min".to_string(), value.clone()));
1000        }
1001        if let Some(value) = &params.max_query {
1002            query.push(("max".to_string(), value.clone()));
1003        }
1004        if let Some(value) = &params.count_query {
1005            query.push(("count".to_string(), value.clone()));
1006        }
1007        if let Some(value) = &params.allow_repeat_query {
1008            query.push(("allow_repeat".to_string(), value.clone()));
1009        }
1010        if let Some(value) = &params.allow_decimal_query {
1011            query.push(("allow_decimal".to_string(), value.clone()));
1012        }
1013        if let Some(value) = &params.decimal_places_query {
1014            query.push(("decimal_places".to_string(), value.clone()));
1015        }
1016        let query = if query.is_empty() { None } else { Some(query) };
1017
1018        let mut extra_headers = HeaderMap::new();
1019        let headers = if extra_headers.is_empty() {
1020            None
1021        } else {
1022            Some(extra_headers)
1023        };
1024        let body = None;
1025
1026        self.client
1027            .request_json(Method::GET, &path, headers, query, body)
1028            .await
1029    }
1030    /// 转换时间戳 (旧版,推荐使用/convert/unixtime)
1031    #[instrument(skip(self, params))]
1032    pub async fn get_misc_timestamp(&self, params: GetMiscTimestampParams) -> Result<Value> {
1033        let mut path = "/misc/timestamp".to_string();
1034
1035        let mut query: Vec<(String, String)> = Vec::new();
1036        query.push(("ts".to_string(), params.ts_query.clone()));
1037        let query = if query.is_empty() { None } else { Some(query) };
1038
1039        let mut extra_headers = HeaderMap::new();
1040        let headers = if extra_headers.is_empty() {
1041            None
1042        } else {
1043            Some(extra_headers)
1044        };
1045        let body = None;
1046
1047        self.client
1048            .request_json(Method::GET, &path, headers, query, body)
1049            .await
1050    }
1051    /// 获取支持的快递公司列表
1052    #[instrument(skip(self))]
1053    pub async fn get_misc_tracking_carriers(&self) -> Result<Value> {
1054        let mut path = "/misc/tracking/carriers".to_string();
1055
1056        let mut query: Vec<(String, String)> = Vec::new();
1057        let query = if query.is_empty() { None } else { Some(query) };
1058
1059        let mut extra_headers = HeaderMap::new();
1060        let headers = if extra_headers.is_empty() {
1061            None
1062        } else {
1063            Some(extra_headers)
1064        };
1065        let body = None;
1066
1067        self.client
1068            .request_json(Method::GET, &path, headers, query, body)
1069            .await
1070    }
1071    /// 识别快递公司
1072    #[instrument(skip(self, params))]
1073    pub async fn get_misc_tracking_detect(
1074        &self,
1075        params: GetMiscTrackingDetectParams,
1076    ) -> Result<Value> {
1077        let mut path = "/misc/tracking/detect".to_string();
1078
1079        let mut query: Vec<(String, String)> = Vec::new();
1080        query.push((
1081            "tracking_number".to_string(),
1082            params.tracking_number_query.clone(),
1083        ));
1084        let query = if query.is_empty() { None } else { Some(query) };
1085
1086        let mut extra_headers = HeaderMap::new();
1087        let headers = if extra_headers.is_empty() {
1088            None
1089        } else {
1090            Some(extra_headers)
1091        };
1092        let body = None;
1093
1094        self.client
1095            .request_json(Method::GET, &path, headers, query, body)
1096            .await
1097    }
1098    /// 查询快递物流信息
1099    #[instrument(skip(self, params))]
1100    pub async fn get_misc_tracking_query(
1101        &self,
1102        params: GetMiscTrackingQueryParams,
1103    ) -> Result<Value> {
1104        let mut path = "/misc/tracking/query".to_string();
1105
1106        let mut query: Vec<(String, String)> = Vec::new();
1107        query.push((
1108            "tracking_number".to_string(),
1109            params.tracking_number_query.clone(),
1110        ));
1111        if let Some(value) = &params.carrier_code_query {
1112            query.push(("carrier_code".to_string(), value.clone()));
1113        }
1114        let query = if query.is_empty() { None } else { Some(query) };
1115
1116        let mut extra_headers = HeaderMap::new();
1117        let headers = if extra_headers.is_empty() {
1118            None
1119        } else {
1120            Some(extra_headers)
1121        };
1122        let body = None;
1123
1124        self.client
1125            .request_json(Method::GET, &path, headers, query, body)
1126            .await
1127    }
1128    /// 查询实时天气信息
1129    #[instrument(skip(self, params))]
1130    pub async fn get_misc_weather(&self, params: GetMiscWeatherParams) -> Result<Value> {
1131        let mut path = "/misc/weather".to_string();
1132
1133        let mut query: Vec<(String, String)> = Vec::new();
1134        if let Some(value) = &params.city_query {
1135            query.push(("city".to_string(), value.clone()));
1136        }
1137        if let Some(value) = &params.adcode_query {
1138            query.push(("adcode".to_string(), value.clone()));
1139        }
1140        let query = if query.is_empty() { None } else { Some(query) };
1141
1142        let mut extra_headers = HeaderMap::new();
1143        let headers = if extra_headers.is_empty() {
1144            None
1145        } else {
1146            Some(extra_headers)
1147        };
1148        let body = None;
1149
1150        self.client
1151            .request_json(Method::GET, &path, headers, query, body)
1152            .await
1153    }
1154    /// 查询全球任意时区的时间
1155    #[instrument(skip(self, params))]
1156    pub async fn get_misc_worldtime(&self, params: GetMiscWorldtimeParams) -> Result<Value> {
1157        let mut path = "/misc/worldtime".to_string();
1158
1159        let mut query: Vec<(String, String)> = Vec::new();
1160        query.push(("city".to_string(), params.city_query.clone()));
1161        let query = if query.is_empty() { None } else { Some(query) };
1162
1163        let mut extra_headers = HeaderMap::new();
1164        let headers = if extra_headers.is_empty() {
1165            None
1166        } else {
1167            Some(extra_headers)
1168        };
1169        let body = None;
1170
1171        self.client
1172            .request_json(Method::GET, &path, headers, query, body)
1173            .await
1174    }
1175}
1176
1177#[derive(Debug, Clone)]
1178pub struct GetHistoryProgrammerParams {
1179    pub month_query: String,
1180    pub day_query: String,
1181}
1182
1183impl GetHistoryProgrammerParams {
1184    pub fn new(month_query: impl Into<String>, day_query: impl Into<String>) -> Self {
1185        Self {
1186            month_query: month_query.into(),
1187            day_query: day_query.into(),
1188        }
1189    }
1190}
1191
1192#[derive(Debug, Clone)]
1193pub struct GetMiscHotboardParams {
1194    pub type_query: String,
1195}
1196
1197impl GetMiscHotboardParams {
1198    pub fn new(type_query: impl Into<String>) -> Self {
1199        Self {
1200            type_query: type_query.into(),
1201        }
1202    }
1203}
1204
1205#[derive(Debug, Clone)]
1206pub struct GetMiscPhoneinfoParams {
1207    pub phone_query: String,
1208}
1209
1210impl GetMiscPhoneinfoParams {
1211    pub fn new(phone_query: impl Into<String>) -> Self {
1212        Self {
1213            phone_query: phone_query.into(),
1214        }
1215    }
1216}
1217
1218#[derive(Debug, Clone)]
1219pub struct GetMiscRandomnumberParams {
1220    pub min_query: Option<String>,
1221    pub max_query: Option<String>,
1222    pub count_query: Option<String>,
1223    pub allow_repeat_query: Option<String>,
1224    pub allow_decimal_query: Option<String>,
1225    pub decimal_places_query: Option<String>,
1226}
1227
1228impl GetMiscRandomnumberParams {
1229    pub fn new() -> Self {
1230        Self {
1231            min_query: None,
1232            max_query: None,
1233            count_query: None,
1234            allow_repeat_query: None,
1235            allow_decimal_query: None,
1236            decimal_places_query: None,
1237        }
1238    }
1239    pub fn min_query(mut self, value: impl Into<String>) -> Self {
1240        self.min_query = Some(value.into());
1241        self
1242    }
1243    pub fn max_query(mut self, value: impl Into<String>) -> Self {
1244        self.max_query = Some(value.into());
1245        self
1246    }
1247    pub fn count_query(mut self, value: impl Into<String>) -> Self {
1248        self.count_query = Some(value.into());
1249        self
1250    }
1251    pub fn allow_repeat_query(mut self, value: impl Into<String>) -> Self {
1252        self.allow_repeat_query = Some(value.into());
1253        self
1254    }
1255    pub fn allow_decimal_query(mut self, value: impl Into<String>) -> Self {
1256        self.allow_decimal_query = Some(value.into());
1257        self
1258    }
1259    pub fn decimal_places_query(mut self, value: impl Into<String>) -> Self {
1260        self.decimal_places_query = Some(value.into());
1261        self
1262    }
1263}
1264
1265#[derive(Debug, Clone)]
1266pub struct GetMiscTimestampParams {
1267    pub ts_query: String,
1268}
1269
1270impl GetMiscTimestampParams {
1271    pub fn new(ts_query: impl Into<String>) -> Self {
1272        Self {
1273            ts_query: ts_query.into(),
1274        }
1275    }
1276}
1277
1278#[derive(Debug, Clone)]
1279pub struct GetMiscTrackingDetectParams {
1280    pub tracking_number_query: String,
1281}
1282
1283impl GetMiscTrackingDetectParams {
1284    pub fn new(tracking_number_query: impl Into<String>) -> Self {
1285        Self {
1286            tracking_number_query: tracking_number_query.into(),
1287        }
1288    }
1289}
1290
1291#[derive(Debug, Clone)]
1292pub struct GetMiscTrackingQueryParams {
1293    pub tracking_number_query: String,
1294    pub carrier_code_query: Option<String>,
1295}
1296
1297impl GetMiscTrackingQueryParams {
1298    pub fn new(tracking_number_query: impl Into<String>) -> Self {
1299        Self {
1300            tracking_number_query: tracking_number_query.into(),
1301            carrier_code_query: None,
1302        }
1303    }
1304    pub fn carrier_code_query(mut self, value: impl Into<String>) -> Self {
1305        self.carrier_code_query = Some(value.into());
1306        self
1307    }
1308}
1309
1310#[derive(Debug, Clone)]
1311pub struct GetMiscWeatherParams {
1312    pub city_query: Option<String>,
1313    pub adcode_query: Option<String>,
1314}
1315
1316impl GetMiscWeatherParams {
1317    pub fn new() -> Self {
1318        Self {
1319            city_query: None,
1320            adcode_query: None,
1321        }
1322    }
1323    pub fn city_query(mut self, value: impl Into<String>) -> Self {
1324        self.city_query = Some(value.into());
1325        self
1326    }
1327    pub fn adcode_query(mut self, value: impl Into<String>) -> Self {
1328        self.adcode_query = Some(value.into());
1329        self
1330    }
1331}
1332
1333#[derive(Debug, Clone)]
1334pub struct GetMiscWorldtimeParams {
1335    pub city_query: String,
1336}
1337
1338impl GetMiscWorldtimeParams {
1339    pub fn new(city_query: impl Into<String>) -> Self {
1340        Self {
1341            city_query: city_query.into(),
1342        }
1343    }
1344}
1345#[derive(Debug, Clone)]
1346pub struct NetworkService<'a> {
1347    pub(crate) client: &'a Client,
1348}
1349
1350impl<'a> NetworkService<'a> {
1351    /// 执行DNS解析查询
1352    #[instrument(skip(self, params))]
1353    pub async fn get_network_dns(&self, params: GetNetworkDnsParams) -> Result<Value> {
1354        let mut path = "/network/dns".to_string();
1355
1356        let mut query: Vec<(String, String)> = Vec::new();
1357        query.push(("domain".to_string(), params.domain_query.clone()));
1358        if let Some(value) = &params.type_query {
1359            query.push(("type".to_string(), value.clone()));
1360        }
1361        let query = if query.is_empty() { None } else { Some(query) };
1362
1363        let mut extra_headers = HeaderMap::new();
1364        let headers = if extra_headers.is_empty() {
1365            None
1366        } else {
1367            Some(extra_headers)
1368        };
1369        let body = None;
1370
1371        self.client
1372            .request_json(Method::GET, &path, headers, query, body)
1373            .await
1374    }
1375    /// 查询域名ICP备案信息
1376    #[instrument(skip(self, params))]
1377    pub async fn get_network_icp(&self, params: GetNetworkIcpParams) -> Result<Value> {
1378        let mut path = "/network/icp".to_string();
1379
1380        let mut query: Vec<(String, String)> = Vec::new();
1381        query.push(("domain".to_string(), params.domain_query.clone()));
1382        let query = if query.is_empty() { None } else { Some(query) };
1383
1384        let mut extra_headers = HeaderMap::new();
1385        let headers = if extra_headers.is_empty() {
1386            None
1387        } else {
1388            Some(extra_headers)
1389        };
1390        let body = None;
1391
1392        self.client
1393            .request_json(Method::GET, &path, headers, query, body)
1394            .await
1395    }
1396    /// 查询指定IP或域名的归属信息
1397    #[instrument(skip(self, params))]
1398    pub async fn get_network_ipinfo(&self, params: GetNetworkIpinfoParams) -> Result<Value> {
1399        let mut path = "/network/ipinfo".to_string();
1400
1401        let mut query: Vec<(String, String)> = Vec::new();
1402        query.push(("ip".to_string(), params.ip_query.clone()));
1403        if let Some(value) = &params.source_query {
1404            query.push(("source".to_string(), value.clone()));
1405        }
1406        let query = if query.is_empty() { None } else { Some(query) };
1407
1408        let mut extra_headers = HeaderMap::new();
1409        let headers = if extra_headers.is_empty() {
1410            None
1411        } else {
1412            Some(extra_headers)
1413        };
1414        let body = None;
1415
1416        self.client
1417            .request_json(Method::GET, &path, headers, query, body)
1418            .await
1419    }
1420    /// 获取你的公网IP及归属信息
1421    #[instrument(skip(self, params))]
1422    pub async fn get_network_myip(&self, params: GetNetworkMyipParams) -> Result<Value> {
1423        let mut path = "/network/myip".to_string();
1424
1425        let mut query: Vec<(String, String)> = Vec::new();
1426        if let Some(value) = &params.source_query {
1427            query.push(("source".to_string(), value.clone()));
1428        }
1429        let query = if query.is_empty() { None } else { Some(query) };
1430
1431        let mut extra_headers = HeaderMap::new();
1432        let headers = if extra_headers.is_empty() {
1433            None
1434        } else {
1435            Some(extra_headers)
1436        };
1437        let body = None;
1438
1439        self.client
1440            .request_json(Method::GET, &path, headers, query, body)
1441            .await
1442    }
1443    /// 从服务器Ping指定主机
1444    #[instrument(skip(self, params))]
1445    pub async fn get_network_ping(&self, params: GetNetworkPingParams) -> Result<Value> {
1446        let mut path = "/network/ping".to_string();
1447
1448        let mut query: Vec<(String, String)> = Vec::new();
1449        query.push(("host".to_string(), params.host_query.clone()));
1450        let query = if query.is_empty() { None } else { Some(query) };
1451
1452        let mut extra_headers = HeaderMap::new();
1453        let headers = if extra_headers.is_empty() {
1454            None
1455        } else {
1456            Some(extra_headers)
1457        };
1458        let body = None;
1459
1460        self.client
1461            .request_json(Method::GET, &path, headers, query, body)
1462            .await
1463    }
1464    /// 从服务器Ping你的客户端IP
1465    #[instrument(skip(self))]
1466    pub async fn get_network_pingmyip(&self) -> Result<Value> {
1467        let mut path = "/network/pingmyip".to_string();
1468
1469        let mut query: Vec<(String, String)> = Vec::new();
1470        let query = if query.is_empty() { None } else { Some(query) };
1471
1472        let mut extra_headers = HeaderMap::new();
1473        let headers = if extra_headers.is_empty() {
1474            None
1475        } else {
1476            Some(extra_headers)
1477        };
1478        let body = None;
1479
1480        self.client
1481            .request_json(Method::GET, &path, headers, query, body)
1482            .await
1483    }
1484    /// 扫描远程主机的指定端口
1485    #[instrument(skip(self, params))]
1486    pub async fn get_network_portscan(&self, params: GetNetworkPortscanParams) -> Result<Value> {
1487        let mut path = "/network/portscan".to_string();
1488
1489        let mut query: Vec<(String, String)> = Vec::new();
1490        query.push(("host".to_string(), params.host_query.clone()));
1491        query.push(("port".to_string(), params.port_query.clone()));
1492        if let Some(value) = &params.protocol_query {
1493            query.push(("protocol".to_string(), value.clone()));
1494        }
1495        let query = if query.is_empty() { None } else { Some(query) };
1496
1497        let mut extra_headers = HeaderMap::new();
1498        let headers = if extra_headers.is_empty() {
1499            None
1500        } else {
1501            Some(extra_headers)
1502        };
1503        let body = None;
1504
1505        self.client
1506            .request_json(Method::GET, &path, headers, query, body)
1507            .await
1508    }
1509    /// 检查URL的可访问性状态
1510    #[instrument(skip(self, params))]
1511    pub async fn get_network_urlstatus(&self, params: GetNetworkUrlstatusParams) -> Result<Value> {
1512        let mut path = "/network/urlstatus".to_string();
1513
1514        let mut query: Vec<(String, String)> = Vec::new();
1515        query.push(("url".to_string(), params.url_query.clone()));
1516        let query = if query.is_empty() { None } else { Some(query) };
1517
1518        let mut extra_headers = HeaderMap::new();
1519        let headers = if extra_headers.is_empty() {
1520            None
1521        } else {
1522            Some(extra_headers)
1523        };
1524        let body = None;
1525
1526        self.client
1527            .request_json(Method::GET, &path, headers, query, body)
1528            .await
1529    }
1530    /// 查询域名的WHOIS注册信息
1531    #[instrument(skip(self, params))]
1532    pub async fn get_network_whois(&self, params: GetNetworkWhoisParams) -> Result<Value> {
1533        let mut path = "/network/whois".to_string();
1534
1535        let mut query: Vec<(String, String)> = Vec::new();
1536        query.push(("domain".to_string(), params.domain_query.clone()));
1537        if let Some(value) = &params.format_query {
1538            query.push(("format".to_string(), value.clone()));
1539        }
1540        let query = if query.is_empty() { None } else { Some(query) };
1541
1542        let mut extra_headers = HeaderMap::new();
1543        let headers = if extra_headers.is_empty() {
1544            None
1545        } else {
1546            Some(extra_headers)
1547        };
1548        let body = None;
1549
1550        self.client
1551            .request_json(Method::GET, &path, headers, query, body)
1552            .await
1553    }
1554    /// 检查域名在微信中的访问状态
1555    #[instrument(skip(self, params))]
1556    pub async fn get_network_wxdomain(&self, params: GetNetworkWxdomainParams) -> Result<Value> {
1557        let mut path = "/network/wxdomain".to_string();
1558
1559        let mut query: Vec<(String, String)> = Vec::new();
1560        query.push(("domain".to_string(), params.domain_query.clone()));
1561        let query = if query.is_empty() { None } else { Some(query) };
1562
1563        let mut extra_headers = HeaderMap::new();
1564        let headers = if extra_headers.is_empty() {
1565            None
1566        } else {
1567            Some(extra_headers)
1568        };
1569        let body = None;
1570
1571        self.client
1572            .request_json(Method::GET, &path, headers, query, body)
1573            .await
1574    }
1575}
1576
1577#[derive(Debug, Clone)]
1578pub struct GetNetworkDnsParams {
1579    pub domain_query: String,
1580    pub type_query: Option<String>,
1581}
1582
1583impl GetNetworkDnsParams {
1584    pub fn new(domain_query: impl Into<String>) -> Self {
1585        Self {
1586            domain_query: domain_query.into(),
1587            type_query: None,
1588        }
1589    }
1590    pub fn type_query(mut self, value: impl Into<String>) -> Self {
1591        self.type_query = Some(value.into());
1592        self
1593    }
1594}
1595
1596#[derive(Debug, Clone)]
1597pub struct GetNetworkIcpParams {
1598    pub domain_query: String,
1599}
1600
1601impl GetNetworkIcpParams {
1602    pub fn new(domain_query: impl Into<String>) -> Self {
1603        Self {
1604            domain_query: domain_query.into(),
1605        }
1606    }
1607}
1608
1609#[derive(Debug, Clone)]
1610pub struct GetNetworkIpinfoParams {
1611    pub ip_query: String,
1612    pub source_query: Option<String>,
1613}
1614
1615impl GetNetworkIpinfoParams {
1616    pub fn new(ip_query: impl Into<String>) -> Self {
1617        Self {
1618            ip_query: ip_query.into(),
1619            source_query: None,
1620        }
1621    }
1622    pub fn source_query(mut self, value: impl Into<String>) -> Self {
1623        self.source_query = Some(value.into());
1624        self
1625    }
1626}
1627
1628#[derive(Debug, Clone)]
1629pub struct GetNetworkMyipParams {
1630    pub source_query: Option<String>,
1631}
1632
1633impl GetNetworkMyipParams {
1634    pub fn new() -> Self {
1635        Self { source_query: None }
1636    }
1637    pub fn source_query(mut self, value: impl Into<String>) -> Self {
1638        self.source_query = Some(value.into());
1639        self
1640    }
1641}
1642
1643#[derive(Debug, Clone)]
1644pub struct GetNetworkPingParams {
1645    pub host_query: String,
1646}
1647
1648impl GetNetworkPingParams {
1649    pub fn new(host_query: impl Into<String>) -> Self {
1650        Self {
1651            host_query: host_query.into(),
1652        }
1653    }
1654}
1655
1656#[derive(Debug, Clone)]
1657pub struct GetNetworkPortscanParams {
1658    pub host_query: String,
1659    pub port_query: String,
1660    pub protocol_query: Option<String>,
1661}
1662
1663impl GetNetworkPortscanParams {
1664    pub fn new(host_query: impl Into<String>, port_query: impl Into<String>) -> Self {
1665        Self {
1666            host_query: host_query.into(),
1667            port_query: port_query.into(),
1668            protocol_query: None,
1669        }
1670    }
1671    pub fn protocol_query(mut self, value: impl Into<String>) -> Self {
1672        self.protocol_query = Some(value.into());
1673        self
1674    }
1675}
1676
1677#[derive(Debug, Clone)]
1678pub struct GetNetworkUrlstatusParams {
1679    pub url_query: String,
1680}
1681
1682impl GetNetworkUrlstatusParams {
1683    pub fn new(url_query: impl Into<String>) -> Self {
1684        Self {
1685            url_query: url_query.into(),
1686        }
1687    }
1688}
1689
1690#[derive(Debug, Clone)]
1691pub struct GetNetworkWhoisParams {
1692    pub domain_query: String,
1693    pub format_query: Option<String>,
1694}
1695
1696impl GetNetworkWhoisParams {
1697    pub fn new(domain_query: impl Into<String>) -> Self {
1698        Self {
1699            domain_query: domain_query.into(),
1700            format_query: None,
1701        }
1702    }
1703    pub fn format_query(mut self, value: impl Into<String>) -> Self {
1704        self.format_query = Some(value.into());
1705        self
1706    }
1707}
1708
1709#[derive(Debug, Clone)]
1710pub struct GetNetworkWxdomainParams {
1711    pub domain_query: String,
1712}
1713
1714impl GetNetworkWxdomainParams {
1715    pub fn new(domain_query: impl Into<String>) -> Self {
1716        Self {
1717            domain_query: domain_query.into(),
1718        }
1719    }
1720}
1721#[derive(Debug, Clone)]
1722pub struct PoemService<'a> {
1723    pub(crate) client: &'a Client,
1724}
1725
1726impl<'a> PoemService<'a> {
1727    /// 随机获取一句诗词或名言
1728    #[instrument(skip(self))]
1729    pub async fn get_saying(&self) -> Result<Value> {
1730        let mut path = "/saying".to_string();
1731
1732        let mut query: Vec<(String, String)> = Vec::new();
1733        let query = if query.is_empty() { None } else { Some(query) };
1734
1735        let mut extra_headers = HeaderMap::new();
1736        let headers = if extra_headers.is_empty() {
1737            None
1738        } else {
1739            Some(extra_headers)
1740        };
1741        let body = None;
1742
1743        self.client
1744            .request_json(Method::GET, &path, headers, query, body)
1745            .await
1746    }
1747}
1748
1749#[derive(Debug, Clone)]
1750pub struct RandomService<'a> {
1751    pub(crate) client: &'a Client,
1752}
1753
1754impl<'a> RandomService<'a> {
1755    /// 获取答案之书的神秘答案 (GET)
1756    #[instrument(skip(self, params))]
1757    pub async fn get_answerbook_ask(&self, params: GetAnswerbookAskParams) -> Result<Value> {
1758        let mut path = "/answerbook/ask".to_string();
1759
1760        let mut query: Vec<(String, String)> = Vec::new();
1761        query.push(("question".to_string(), params.question_query.clone()));
1762        let query = if query.is_empty() { None } else { Some(query) };
1763
1764        let mut extra_headers = HeaderMap::new();
1765        let headers = if extra_headers.is_empty() {
1766            None
1767        } else {
1768            Some(extra_headers)
1769        };
1770        let body = None;
1771
1772        self.client
1773            .request_json(Method::GET, &path, headers, query, body)
1774            .await
1775    }
1776    /// 随机二次元、风景、动漫图片壁纸
1777    #[instrument(skip(self, params))]
1778    pub async fn get_random_image(&self, params: GetRandomImageParams) -> Result<Value> {
1779        let mut path = "/random/image".to_string();
1780
1781        let mut query: Vec<(String, String)> = Vec::new();
1782        if let Some(value) = &params.category_query {
1783            query.push(("category".to_string(), value.clone()));
1784        }
1785        if let Some(value) = &params.type_query {
1786            query.push(("type".to_string(), value.clone()));
1787        }
1788        let query = if query.is_empty() { None } else { Some(query) };
1789
1790        let mut extra_headers = HeaderMap::new();
1791        let headers = if extra_headers.is_empty() {
1792            None
1793        } else {
1794            Some(extra_headers)
1795        };
1796        let body = None;
1797
1798        self.client
1799            .request_json(Method::GET, &path, headers, query, body)
1800            .await
1801    }
1802    /// 生成高度可定制的随机字符串
1803    #[instrument(skip(self, params))]
1804    pub async fn get_random_string(&self, params: GetRandomStringParams) -> Result<Value> {
1805        let mut path = "/random/string".to_string();
1806
1807        let mut query: Vec<(String, String)> = Vec::new();
1808        if let Some(value) = &params.length_query {
1809            query.push(("length".to_string(), value.clone()));
1810        }
1811        if let Some(value) = &params.type_query {
1812            query.push(("type".to_string(), value.clone()));
1813        }
1814        let query = if query.is_empty() { None } else { Some(query) };
1815
1816        let mut extra_headers = HeaderMap::new();
1817        let headers = if extra_headers.is_empty() {
1818            None
1819        } else {
1820            Some(extra_headers)
1821        };
1822        let body = None;
1823
1824        self.client
1825            .request_json(Method::GET, &path, headers, query, body)
1826            .await
1827    }
1828    /// 获取答案之书的神秘答案 (POST)
1829    #[instrument(skip(self, params))]
1830    pub async fn post_answerbook_ask(&self, params: PostAnswerbookAskParams) -> Result<Value> {
1831        let mut path = "/answerbook/ask".to_string();
1832
1833        let mut query: Vec<(String, String)> = Vec::new();
1834        let query = if query.is_empty() { None } else { Some(query) };
1835
1836        let mut extra_headers = HeaderMap::new();
1837        let headers = if extra_headers.is_empty() {
1838            None
1839        } else {
1840            Some(extra_headers)
1841        };
1842        let body = params.body.clone();
1843
1844        self.client
1845            .request_json(Method::POST, &path, headers, query, body)
1846            .await
1847    }
1848}
1849
1850#[derive(Debug, Clone)]
1851pub struct GetAnswerbookAskParams {
1852    pub question_query: String,
1853}
1854
1855impl GetAnswerbookAskParams {
1856    pub fn new(question_query: impl Into<String>) -> Self {
1857        Self {
1858            question_query: question_query.into(),
1859        }
1860    }
1861}
1862
1863#[derive(Debug, Clone)]
1864pub struct GetRandomImageParams {
1865    pub category_query: Option<String>,
1866    pub type_query: Option<String>,
1867}
1868
1869impl GetRandomImageParams {
1870    pub fn new() -> Self {
1871        Self {
1872            category_query: None,
1873            type_query: None,
1874        }
1875    }
1876    pub fn category_query(mut self, value: impl Into<String>) -> Self {
1877        self.category_query = Some(value.into());
1878        self
1879    }
1880    pub fn type_query(mut self, value: impl Into<String>) -> Self {
1881        self.type_query = Some(value.into());
1882        self
1883    }
1884}
1885
1886#[derive(Debug, Clone)]
1887pub struct GetRandomStringParams {
1888    pub length_query: Option<String>,
1889    pub type_query: Option<String>,
1890}
1891
1892impl GetRandomStringParams {
1893    pub fn new() -> Self {
1894        Self {
1895            length_query: None,
1896            type_query: None,
1897        }
1898    }
1899    pub fn length_query(mut self, value: impl Into<String>) -> Self {
1900        self.length_query = Some(value.into());
1901        self
1902    }
1903    pub fn type_query(mut self, value: impl Into<String>) -> Self {
1904        self.type_query = Some(value.into());
1905        self
1906    }
1907}
1908
1909#[derive(Debug, Clone)]
1910pub struct PostAnswerbookAskParams {
1911    pub body: Option<Value>,
1912}
1913
1914impl PostAnswerbookAskParams {
1915    pub fn new() -> Self {
1916        Self { body: None }
1917    }
1918    pub fn body(mut self, value: Value) -> Self {
1919        self.body = Some(value);
1920        self
1921    }
1922}
1923#[derive(Debug, Clone)]
1924pub struct SocialService<'a> {
1925    pub(crate) client: &'a Client,
1926}
1927
1928impl<'a> SocialService<'a> {
1929    /// 获取GitHub仓库信息
1930    #[instrument(skip(self, params))]
1931    pub async fn get_github_repo(&self, params: GetGithubRepoParams) -> Result<Value> {
1932        let mut path = "/github/repo".to_string();
1933
1934        let mut query: Vec<(String, String)> = Vec::new();
1935        query.push(("repo".to_string(), params.repo_query.clone()));
1936        let query = if query.is_empty() { None } else { Some(query) };
1937
1938        let mut extra_headers = HeaderMap::new();
1939        let headers = if extra_headers.is_empty() {
1940            None
1941        } else {
1942            Some(extra_headers)
1943        };
1944        let body = None;
1945
1946        self.client
1947            .request_json(Method::GET, &path, headers, query, body)
1948            .await
1949    }
1950    /// 获取Bilibili用户投稿列表
1951    #[instrument(skip(self, params))]
1952    pub async fn get_social_bilibili_archives(
1953        &self,
1954        params: GetSocialBilibiliArchivesParams,
1955    ) -> Result<Value> {
1956        let mut path = "/social/bilibili/archives".to_string();
1957
1958        let mut query: Vec<(String, String)> = Vec::new();
1959        query.push(("mid".to_string(), params.mid_query.clone()));
1960        if let Some(value) = &params.keywords_query {
1961            query.push(("keywords".to_string(), value.clone()));
1962        }
1963        if let Some(value) = &params.orderby_query {
1964            query.push(("orderby".to_string(), value.clone()));
1965        }
1966        if let Some(value) = &params.ps_query {
1967            query.push(("ps".to_string(), value.clone()));
1968        }
1969        if let Some(value) = &params.pn_query {
1970            query.push(("pn".to_string(), value.clone()));
1971        }
1972        let query = if query.is_empty() { None } else { Some(query) };
1973
1974        let mut extra_headers = HeaderMap::new();
1975        let headers = if extra_headers.is_empty() {
1976            None
1977        } else {
1978            Some(extra_headers)
1979        };
1980        let body = None;
1981
1982        self.client
1983            .request_json(Method::GET, &path, headers, query, body)
1984            .await
1985    }
1986    /// 获取Bilibili直播间信息
1987    #[instrument(skip(self, params))]
1988    pub async fn get_social_bilibili_liveroom(
1989        &self,
1990        params: GetSocialBilibiliLiveroomParams,
1991    ) -> Result<Value> {
1992        let mut path = "/social/bilibili/liveroom".to_string();
1993
1994        let mut query: Vec<(String, String)> = Vec::new();
1995        if let Some(value) = &params.mid_query {
1996            query.push(("mid".to_string(), value.clone()));
1997        }
1998        if let Some(value) = &params.room_id_query {
1999            query.push(("room_id".to_string(), value.clone()));
2000        }
2001        let query = if query.is_empty() { None } else { Some(query) };
2002
2003        let mut extra_headers = HeaderMap::new();
2004        let headers = if extra_headers.is_empty() {
2005            None
2006        } else {
2007            Some(extra_headers)
2008        };
2009        let body = None;
2010
2011        self.client
2012            .request_json(Method::GET, &path, headers, query, body)
2013            .await
2014    }
2015    /// 获取Bilibili视频评论
2016    #[instrument(skip(self, params))]
2017    pub async fn get_social_bilibili_replies(
2018        &self,
2019        params: GetSocialBilibiliRepliesParams,
2020    ) -> Result<Value> {
2021        let mut path = "/social/bilibili/replies".to_string();
2022
2023        let mut query: Vec<(String, String)> = Vec::new();
2024        query.push(("oid".to_string(), params.oid_query.clone()));
2025        if let Some(value) = &params.sort_query {
2026            query.push(("sort".to_string(), value.clone()));
2027        }
2028        if let Some(value) = &params.ps_query {
2029            query.push(("ps".to_string(), value.clone()));
2030        }
2031        if let Some(value) = &params.pn_query {
2032            query.push(("pn".to_string(), value.clone()));
2033        }
2034        let query = if query.is_empty() { None } else { Some(query) };
2035
2036        let mut extra_headers = HeaderMap::new();
2037        let headers = if extra_headers.is_empty() {
2038            None
2039        } else {
2040            Some(extra_headers)
2041        };
2042        let body = None;
2043
2044        self.client
2045            .request_json(Method::GET, &path, headers, query, body)
2046            .await
2047    }
2048    /// 查询Bilibili用户信息
2049    #[instrument(skip(self, params))]
2050    pub async fn get_social_bilibili_userinfo(
2051        &self,
2052        params: GetSocialBilibiliUserinfoParams,
2053    ) -> Result<Value> {
2054        let mut path = "/social/bilibili/userinfo".to_string();
2055
2056        let mut query: Vec<(String, String)> = Vec::new();
2057        query.push(("uid".to_string(), params.uid_query.clone()));
2058        let query = if query.is_empty() { None } else { Some(query) };
2059
2060        let mut extra_headers = HeaderMap::new();
2061        let headers = if extra_headers.is_empty() {
2062            None
2063        } else {
2064            Some(extra_headers)
2065        };
2066        let body = None;
2067
2068        self.client
2069            .request_json(Method::GET, &path, headers, query, body)
2070            .await
2071    }
2072    /// 获取Bilibili视频详细信息
2073    #[instrument(skip(self, params))]
2074    pub async fn get_social_bilibili_videoinfo(
2075        &self,
2076        params: GetSocialBilibiliVideoinfoParams,
2077    ) -> Result<Value> {
2078        let mut path = "/social/bilibili/videoinfo".to_string();
2079
2080        let mut query: Vec<(String, String)> = Vec::new();
2081        if let Some(value) = &params.aid_query {
2082            query.push(("aid".to_string(), value.clone()));
2083        }
2084        if let Some(value) = &params.bvid_query {
2085            query.push(("bvid".to_string(), value.clone()));
2086        }
2087        let query = if query.is_empty() { None } else { Some(query) };
2088
2089        let mut extra_headers = HeaderMap::new();
2090        let headers = if extra_headers.is_empty() {
2091            None
2092        } else {
2093            Some(extra_headers)
2094        };
2095        let body = None;
2096
2097        self.client
2098            .request_json(Method::GET, &path, headers, query, body)
2099            .await
2100    }
2101    /// 获取QQ群名称、头像、简介
2102    #[instrument(skip(self, params))]
2103    pub async fn get_social_qq_groupinfo(
2104        &self,
2105        params: GetSocialQqGroupinfoParams,
2106    ) -> Result<Value> {
2107        let mut path = "/social/qq/groupinfo".to_string();
2108
2109        let mut query: Vec<(String, String)> = Vec::new();
2110        query.push(("group_id".to_string(), params.group_id_query.clone()));
2111        let query = if query.is_empty() { None } else { Some(query) };
2112
2113        let mut extra_headers = HeaderMap::new();
2114        let headers = if extra_headers.is_empty() {
2115            None
2116        } else {
2117            Some(extra_headers)
2118        };
2119        let body = None;
2120
2121        self.client
2122            .request_json(Method::GET, &path, headers, query, body)
2123            .await
2124    }
2125    /// 独家获取QQ号头像、昵称
2126    #[instrument(skip(self, params))]
2127    pub async fn get_social_qq_userinfo(&self, params: GetSocialQqUserinfoParams) -> Result<Value> {
2128        let mut path = "/social/qq/userinfo".to_string();
2129
2130        let mut query: Vec<(String, String)> = Vec::new();
2131        query.push(("qq".to_string(), params.qq_query.clone()));
2132        let query = if query.is_empty() { None } else { Some(query) };
2133
2134        let mut extra_headers = HeaderMap::new();
2135        let headers = if extra_headers.is_empty() {
2136            None
2137        } else {
2138            Some(extra_headers)
2139        };
2140        let body = None;
2141
2142        self.client
2143            .request_json(Method::GET, &path, headers, query, body)
2144            .await
2145    }
2146}
2147
2148#[derive(Debug, Clone)]
2149pub struct GetGithubRepoParams {
2150    pub repo_query: String,
2151}
2152
2153impl GetGithubRepoParams {
2154    pub fn new(repo_query: impl Into<String>) -> Self {
2155        Self {
2156            repo_query: repo_query.into(),
2157        }
2158    }
2159}
2160
2161#[derive(Debug, Clone)]
2162pub struct GetSocialBilibiliArchivesParams {
2163    pub mid_query: String,
2164    pub keywords_query: Option<String>,
2165    pub orderby_query: Option<String>,
2166    pub ps_query: Option<String>,
2167    pub pn_query: Option<String>,
2168}
2169
2170impl GetSocialBilibiliArchivesParams {
2171    pub fn new(mid_query: impl Into<String>) -> Self {
2172        Self {
2173            mid_query: mid_query.into(),
2174            keywords_query: None,
2175            orderby_query: None,
2176            ps_query: None,
2177            pn_query: None,
2178        }
2179    }
2180    pub fn keywords_query(mut self, value: impl Into<String>) -> Self {
2181        self.keywords_query = Some(value.into());
2182        self
2183    }
2184    pub fn orderby_query(mut self, value: impl Into<String>) -> Self {
2185        self.orderby_query = Some(value.into());
2186        self
2187    }
2188    pub fn ps_query(mut self, value: impl Into<String>) -> Self {
2189        self.ps_query = Some(value.into());
2190        self
2191    }
2192    pub fn pn_query(mut self, value: impl Into<String>) -> Self {
2193        self.pn_query = Some(value.into());
2194        self
2195    }
2196}
2197
2198#[derive(Debug, Clone)]
2199pub struct GetSocialBilibiliLiveroomParams {
2200    pub mid_query: Option<String>,
2201    pub room_id_query: Option<String>,
2202}
2203
2204impl GetSocialBilibiliLiveroomParams {
2205    pub fn new() -> Self {
2206        Self {
2207            mid_query: None,
2208            room_id_query: None,
2209        }
2210    }
2211    pub fn mid_query(mut self, value: impl Into<String>) -> Self {
2212        self.mid_query = Some(value.into());
2213        self
2214    }
2215    pub fn room_id_query(mut self, value: impl Into<String>) -> Self {
2216        self.room_id_query = Some(value.into());
2217        self
2218    }
2219}
2220
2221#[derive(Debug, Clone)]
2222pub struct GetSocialBilibiliRepliesParams {
2223    pub oid_query: String,
2224    pub sort_query: Option<String>,
2225    pub ps_query: Option<String>,
2226    pub pn_query: Option<String>,
2227}
2228
2229impl GetSocialBilibiliRepliesParams {
2230    pub fn new(oid_query: impl Into<String>) -> Self {
2231        Self {
2232            oid_query: oid_query.into(),
2233            sort_query: None,
2234            ps_query: None,
2235            pn_query: None,
2236        }
2237    }
2238    pub fn sort_query(mut self, value: impl Into<String>) -> Self {
2239        self.sort_query = Some(value.into());
2240        self
2241    }
2242    pub fn ps_query(mut self, value: impl Into<String>) -> Self {
2243        self.ps_query = Some(value.into());
2244        self
2245    }
2246    pub fn pn_query(mut self, value: impl Into<String>) -> Self {
2247        self.pn_query = Some(value.into());
2248        self
2249    }
2250}
2251
2252#[derive(Debug, Clone)]
2253pub struct GetSocialBilibiliUserinfoParams {
2254    pub uid_query: String,
2255}
2256
2257impl GetSocialBilibiliUserinfoParams {
2258    pub fn new(uid_query: impl Into<String>) -> Self {
2259        Self {
2260            uid_query: uid_query.into(),
2261        }
2262    }
2263}
2264
2265#[derive(Debug, Clone)]
2266pub struct GetSocialBilibiliVideoinfoParams {
2267    pub aid_query: Option<String>,
2268    pub bvid_query: Option<String>,
2269}
2270
2271impl GetSocialBilibiliVideoinfoParams {
2272    pub fn new() -> Self {
2273        Self {
2274            aid_query: None,
2275            bvid_query: None,
2276        }
2277    }
2278    pub fn aid_query(mut self, value: impl Into<String>) -> Self {
2279        self.aid_query = Some(value.into());
2280        self
2281    }
2282    pub fn bvid_query(mut self, value: impl Into<String>) -> Self {
2283        self.bvid_query = Some(value.into());
2284        self
2285    }
2286}
2287
2288#[derive(Debug, Clone)]
2289pub struct GetSocialQqGroupinfoParams {
2290    pub group_id_query: String,
2291}
2292
2293impl GetSocialQqGroupinfoParams {
2294    pub fn new(group_id_query: impl Into<String>) -> Self {
2295        Self {
2296            group_id_query: group_id_query.into(),
2297        }
2298    }
2299}
2300
2301#[derive(Debug, Clone)]
2302pub struct GetSocialQqUserinfoParams {
2303    pub qq_query: String,
2304}
2305
2306impl GetSocialQqUserinfoParams {
2307    pub fn new(qq_query: impl Into<String>) -> Self {
2308        Self {
2309            qq_query: qq_query.into(),
2310        }
2311    }
2312}
2313#[derive(Debug, Clone)]
2314pub struct StatusService<'a> {
2315    pub(crate) client: &'a Client,
2316}
2317
2318impl<'a> StatusService<'a> {
2319    /// 获取API限流器实时状态
2320    #[instrument(skip(self, params))]
2321    pub async fn get_status_ratelimit(&self, params: GetStatusRatelimitParams) -> Result<Value> {
2322        let mut path = "/status/ratelimit".to_string();
2323
2324        let mut query: Vec<(String, String)> = Vec::new();
2325        let query = if query.is_empty() { None } else { Some(query) };
2326
2327        let mut extra_headers = HeaderMap::new();
2328        extra_headers.insert(
2329            "Authorization",
2330            HeaderValue::from_str(&params.authorization_header).map_err(|_| {
2331                Error::InvalidHeader {
2332                    name: "Authorization".into(),
2333                }
2334            })?,
2335        );
2336        let headers = if extra_headers.is_empty() {
2337            None
2338        } else {
2339            Some(extra_headers)
2340        };
2341        let body = None;
2342
2343        self.client
2344            .request_json(Method::GET, &path, headers, query, body)
2345            .await
2346    }
2347    /// 获取API端点使用统计
2348    #[instrument(skip(self, params))]
2349    pub async fn get_status_usage(&self, params: GetStatusUsageParams) -> Result<Value> {
2350        let mut path = "/status/usage".to_string();
2351
2352        let mut query: Vec<(String, String)> = Vec::new();
2353        if let Some(value) = &params.path_query {
2354            query.push(("path".to_string(), value.clone()));
2355        }
2356        let query = if query.is_empty() { None } else { Some(query) };
2357
2358        let mut extra_headers = HeaderMap::new();
2359        let headers = if extra_headers.is_empty() {
2360            None
2361        } else {
2362            Some(extra_headers)
2363        };
2364        let body = None;
2365
2366        self.client
2367            .request_json(Method::GET, &path, headers, query, body)
2368            .await
2369    }
2370}
2371
2372#[derive(Debug, Clone)]
2373pub struct GetStatusRatelimitParams {
2374    pub authorization_header: String,
2375}
2376
2377impl GetStatusRatelimitParams {
2378    pub fn new(authorization_header: impl Into<String>) -> Self {
2379        Self {
2380            authorization_header: authorization_header.into(),
2381        }
2382    }
2383}
2384
2385#[derive(Debug, Clone)]
2386pub struct GetStatusUsageParams {
2387    pub path_query: Option<String>,
2388}
2389
2390impl GetStatusUsageParams {
2391    pub fn new() -> Self {
2392        Self { path_query: None }
2393    }
2394    pub fn path_query(mut self, value: impl Into<String>) -> Self {
2395        self.path_query = Some(value.into());
2396        self
2397    }
2398}
2399#[derive(Debug, Clone)]
2400pub struct TextService<'a> {
2401    pub(crate) client: &'a Client,
2402}
2403
2404impl<'a> TextService<'a> {
2405    /// 计算文本的MD5哈希值(GET)
2406    #[instrument(skip(self, params))]
2407    pub async fn get_text_md_5(&self, params: GetTextMd5Params) -> Result<Value> {
2408        let mut path = "/text/md5".to_string();
2409
2410        let mut query: Vec<(String, String)> = Vec::new();
2411        query.push(("text".to_string(), params.text_query.clone()));
2412        let query = if query.is_empty() { None } else { Some(query) };
2413
2414        let mut extra_headers = HeaderMap::new();
2415        let headers = if extra_headers.is_empty() {
2416            None
2417        } else {
2418            Some(extra_headers)
2419        };
2420        let body = None;
2421
2422        self.client
2423            .request_json(Method::GET, &path, headers, query, body)
2424            .await
2425    }
2426    /// 使用AES算法解密文本
2427    #[instrument(skip(self, params))]
2428    pub async fn post_text_aes_decrypt(&self, params: PostTextAesDecryptParams) -> Result<Value> {
2429        let mut path = "/text/aes/decrypt".to_string();
2430
2431        let mut query: Vec<(String, String)> = Vec::new();
2432        let query = if query.is_empty() { None } else { Some(query) };
2433
2434        let mut extra_headers = HeaderMap::new();
2435        let headers = if extra_headers.is_empty() {
2436            None
2437        } else {
2438            Some(extra_headers)
2439        };
2440        let body = params.body.clone();
2441
2442        self.client
2443            .request_json(Method::POST, &path, headers, query, body)
2444            .await
2445    }
2446    /// 使用AES算法加密文本
2447    #[instrument(skip(self, params))]
2448    pub async fn post_text_aes_encrypt(&self, params: PostTextAesEncryptParams) -> Result<Value> {
2449        let mut path = "/text/aes/encrypt".to_string();
2450
2451        let mut query: Vec<(String, String)> = Vec::new();
2452        let query = if query.is_empty() { None } else { Some(query) };
2453
2454        let mut extra_headers = HeaderMap::new();
2455        let headers = if extra_headers.is_empty() {
2456            None
2457        } else {
2458            Some(extra_headers)
2459        };
2460        let body = params.body.clone();
2461
2462        self.client
2463            .request_json(Method::POST, &path, headers, query, body)
2464            .await
2465    }
2466    /// 多维度分析文本内容
2467    #[instrument(skip(self, params))]
2468    pub async fn post_text_analyze(&self, params: PostTextAnalyzeParams) -> Result<Value> {
2469        let mut path = "/text/analyze".to_string();
2470
2471        let mut query: Vec<(String, String)> = Vec::new();
2472        let query = if query.is_empty() { None } else { Some(query) };
2473
2474        let mut extra_headers = HeaderMap::new();
2475        let headers = if extra_headers.is_empty() {
2476            None
2477        } else {
2478            Some(extra_headers)
2479        };
2480        let body = params.body.clone();
2481
2482        self.client
2483            .request_json(Method::POST, &path, headers, query, body)
2484            .await
2485    }
2486    /// 解码Base64编码的文本
2487    #[instrument(skip(self, params))]
2488    pub async fn post_text_base_64_decode(
2489        &self,
2490        params: PostTextBase64DecodeParams,
2491    ) -> Result<Value> {
2492        let mut path = "/text/base64/decode".to_string();
2493
2494        let mut query: Vec<(String, String)> = Vec::new();
2495        let query = if query.is_empty() { None } else { Some(query) };
2496
2497        let mut extra_headers = HeaderMap::new();
2498        let headers = if extra_headers.is_empty() {
2499            None
2500        } else {
2501            Some(extra_headers)
2502        };
2503        let body = params.body.clone();
2504
2505        self.client
2506            .request_json(Method::POST, &path, headers, query, body)
2507            .await
2508    }
2509    /// 将文本进行Base64编码
2510    #[instrument(skip(self, params))]
2511    pub async fn post_text_base_64_encode(
2512        &self,
2513        params: PostTextBase64EncodeParams,
2514    ) -> Result<Value> {
2515        let mut path = "/text/base64/encode".to_string();
2516
2517        let mut query: Vec<(String, String)> = Vec::new();
2518        let query = if query.is_empty() { None } else { Some(query) };
2519
2520        let mut extra_headers = HeaderMap::new();
2521        let headers = if extra_headers.is_empty() {
2522            None
2523        } else {
2524            Some(extra_headers)
2525        };
2526        let body = params.body.clone();
2527
2528        self.client
2529            .request_json(Method::POST, &path, headers, query, body)
2530            .await
2531    }
2532    /// 计算文本的MD5哈希值 (POST)
2533    #[instrument(skip(self, params))]
2534    pub async fn post_text_md_5(&self, params: PostTextMd5Params) -> Result<Value> {
2535        let mut path = "/text/md5".to_string();
2536
2537        let mut query: Vec<(String, String)> = Vec::new();
2538        let query = if query.is_empty() { None } else { Some(query) };
2539
2540        let mut extra_headers = HeaderMap::new();
2541        let headers = if extra_headers.is_empty() {
2542            None
2543        } else {
2544            Some(extra_headers)
2545        };
2546        let body = params.body.clone();
2547
2548        self.client
2549            .request_json(Method::POST, &path, headers, query, body)
2550            .await
2551    }
2552    /// 校验MD5哈希值
2553    #[instrument(skip(self, params))]
2554    pub async fn post_text_md_5_verify(&self, params: PostTextMd5VerifyParams) -> Result<Value> {
2555        let mut path = "/text/md5/verify".to_string();
2556
2557        let mut query: Vec<(String, String)> = Vec::new();
2558        let query = if query.is_empty() { None } else { Some(query) };
2559
2560        let mut extra_headers = HeaderMap::new();
2561        let headers = if extra_headers.is_empty() {
2562            None
2563        } else {
2564            Some(extra_headers)
2565        };
2566        let body = params.body.clone();
2567
2568        self.client
2569            .request_json(Method::POST, &path, headers, query, body)
2570            .await
2571    }
2572}
2573
2574#[derive(Debug, Clone)]
2575pub struct GetTextMd5Params {
2576    pub text_query: String,
2577}
2578
2579impl GetTextMd5Params {
2580    pub fn new(text_query: impl Into<String>) -> Self {
2581        Self {
2582            text_query: text_query.into(),
2583        }
2584    }
2585}
2586
2587#[derive(Debug, Clone)]
2588pub struct PostTextAesDecryptParams {
2589    pub body: Option<Value>,
2590}
2591
2592impl PostTextAesDecryptParams {
2593    pub fn new() -> Self {
2594        Self { body: None }
2595    }
2596    pub fn body(mut self, value: Value) -> Self {
2597        self.body = Some(value);
2598        self
2599    }
2600}
2601
2602#[derive(Debug, Clone)]
2603pub struct PostTextAesEncryptParams {
2604    pub body: Option<Value>,
2605}
2606
2607impl PostTextAesEncryptParams {
2608    pub fn new() -> Self {
2609        Self { body: None }
2610    }
2611    pub fn body(mut self, value: Value) -> Self {
2612        self.body = Some(value);
2613        self
2614    }
2615}
2616
2617#[derive(Debug, Clone)]
2618pub struct PostTextAnalyzeParams {
2619    pub body: Option<Value>,
2620}
2621
2622impl PostTextAnalyzeParams {
2623    pub fn new() -> Self {
2624        Self { body: None }
2625    }
2626    pub fn body(mut self, value: Value) -> Self {
2627        self.body = Some(value);
2628        self
2629    }
2630}
2631
2632#[derive(Debug, Clone)]
2633pub struct PostTextBase64DecodeParams {
2634    pub body: Option<Value>,
2635}
2636
2637impl PostTextBase64DecodeParams {
2638    pub fn new() -> Self {
2639        Self { body: None }
2640    }
2641    pub fn body(mut self, value: Value) -> Self {
2642        self.body = Some(value);
2643        self
2644    }
2645}
2646
2647#[derive(Debug, Clone)]
2648pub struct PostTextBase64EncodeParams {
2649    pub body: Option<Value>,
2650}
2651
2652impl PostTextBase64EncodeParams {
2653    pub fn new() -> Self {
2654        Self { body: None }
2655    }
2656    pub fn body(mut self, value: Value) -> Self {
2657        self.body = Some(value);
2658        self
2659    }
2660}
2661
2662#[derive(Debug, Clone)]
2663pub struct PostTextMd5Params {
2664    pub body: Option<Value>,
2665}
2666
2667impl PostTextMd5Params {
2668    pub fn new() -> Self {
2669        Self { body: None }
2670    }
2671    pub fn body(mut self, value: Value) -> Self {
2672        self.body = Some(value);
2673        self
2674    }
2675}
2676
2677#[derive(Debug, Clone)]
2678pub struct PostTextMd5VerifyParams {
2679    pub body: Option<Value>,
2680}
2681
2682impl PostTextMd5VerifyParams {
2683    pub fn new() -> Self {
2684        Self { body: None }
2685    }
2686    pub fn body(mut self, value: Value) -> Self {
2687        self.body = Some(value);
2688        self
2689    }
2690}
2691#[derive(Debug, Clone)]
2692pub struct TranslateService<'a> {
2693    pub(crate) client: &'a Client,
2694}
2695
2696impl<'a> TranslateService<'a> {
2697    /// 获取AI翻译支持的语言和配置
2698    #[instrument(skip(self))]
2699    pub async fn get_ai_translate_languages(&self) -> Result<Value> {
2700        let mut path = "/ai/translate/languages".to_string();
2701
2702        let mut query: Vec<(String, String)> = Vec::new();
2703        let query = if query.is_empty() { None } else { Some(query) };
2704
2705        let mut extra_headers = HeaderMap::new();
2706        let headers = if extra_headers.is_empty() {
2707            None
2708        } else {
2709            Some(extra_headers)
2710        };
2711        let body = None;
2712
2713        self.client
2714            .request_json(Method::GET, &path, headers, query, body)
2715            .await
2716    }
2717    /// AI智能翻译
2718    #[instrument(skip(self, params))]
2719    pub async fn post_ai_translate(&self, params: PostAiTranslateParams) -> Result<Value> {
2720        let mut path = "/ai/translate".to_string();
2721
2722        let mut query: Vec<(String, String)> = Vec::new();
2723        query.push(("target_lang".to_string(), params.target_lang_query.clone()));
2724        let query = if query.is_empty() { None } else { Some(query) };
2725
2726        let mut extra_headers = HeaderMap::new();
2727        let headers = if extra_headers.is_empty() {
2728            None
2729        } else {
2730            Some(extra_headers)
2731        };
2732        let body = params.body.clone();
2733
2734        self.client
2735            .request_json(Method::POST, &path, headers, query, body)
2736            .await
2737    }
2738    /// 多语言文本翻译
2739    #[instrument(skip(self, params))]
2740    pub async fn post_translate_text(&self, params: PostTranslateTextParams) -> Result<Value> {
2741        let mut path = "/translate/text".to_string();
2742
2743        let mut query: Vec<(String, String)> = Vec::new();
2744        query.push(("to_lang".to_string(), params.to_lang_query.clone()));
2745        let query = if query.is_empty() { None } else { Some(query) };
2746
2747        let mut extra_headers = HeaderMap::new();
2748        let headers = if extra_headers.is_empty() {
2749            None
2750        } else {
2751            Some(extra_headers)
2752        };
2753        let body = params.body.clone();
2754
2755        self.client
2756            .request_json(Method::POST, &path, headers, query, body)
2757            .await
2758    }
2759}
2760
2761#[derive(Debug, Clone)]
2762pub struct PostAiTranslateParams {
2763    pub target_lang_query: String,
2764    pub body: Option<Value>,
2765}
2766
2767impl PostAiTranslateParams {
2768    pub fn new(target_lang_query: impl Into<String>) -> Self {
2769        Self {
2770            target_lang_query: target_lang_query.into(),
2771            body: None,
2772        }
2773    }
2774    pub fn body(mut self, value: Value) -> Self {
2775        self.body = Some(value);
2776        self
2777    }
2778}
2779
2780#[derive(Debug, Clone)]
2781pub struct PostTranslateTextParams {
2782    pub to_lang_query: String,
2783    pub body: Option<Value>,
2784}
2785
2786impl PostTranslateTextParams {
2787    pub fn new(to_lang_query: impl Into<String>) -> Self {
2788        Self {
2789            to_lang_query: to_lang_query.into(),
2790            body: None,
2791        }
2792    }
2793    pub fn body(mut self, value: Value) -> Self {
2794        self.body = Some(value);
2795        self
2796    }
2797}
2798#[derive(Debug, Clone)]
2799pub struct WebparseService<'a> {
2800    pub(crate) client: &'a Client,
2801}
2802
2803impl<'a> WebparseService<'a> {
2804    /// 查询网页转换任务状态和结果
2805    #[instrument(skip(self, params))]
2806    pub async fn get_web_tomarkdown_async_status(
2807        &self,
2808        params: GetWebTomarkdownAsyncStatusParams,
2809    ) -> Result<Value> {
2810        let mut path = "/web/tomarkdown/async/{task_id}".to_string();
2811        {
2812            let encoded = encode(&params.task_id_path).into_owned();
2813            path = path.replace("{task_id}", &encoded);
2814        }
2815
2816        let mut query: Vec<(String, String)> = Vec::new();
2817        let query = if query.is_empty() { None } else { Some(query) };
2818
2819        let mut extra_headers = HeaderMap::new();
2820        let headers = if extra_headers.is_empty() {
2821            None
2822        } else {
2823            Some(extra_headers)
2824        };
2825        let body = None;
2826
2827        self.client
2828            .request_json(Method::GET, &path, headers, query, body)
2829            .await
2830    }
2831    /// 提取网页中的所有图片
2832    #[instrument(skip(self, params))]
2833    pub async fn get_webparse_extractimages(
2834        &self,
2835        params: GetWebparseExtractimagesParams,
2836    ) -> Result<Value> {
2837        let mut path = "/webparse/extractimages".to_string();
2838
2839        let mut query: Vec<(String, String)> = Vec::new();
2840        query.push(("url".to_string(), params.url_query.clone()));
2841        let query = if query.is_empty() { None } else { Some(query) };
2842
2843        let mut extra_headers = HeaderMap::new();
2844        let headers = if extra_headers.is_empty() {
2845            None
2846        } else {
2847            Some(extra_headers)
2848        };
2849        let body = None;
2850
2851        self.client
2852            .request_json(Method::GET, &path, headers, query, body)
2853            .await
2854    }
2855    /// 抓取并解析网页的元数据
2856    #[instrument(skip(self, params))]
2857    pub async fn get_webparse_metadata(&self, params: GetWebparseMetadataParams) -> Result<Value> {
2858        let mut path = "/webparse/metadata".to_string();
2859
2860        let mut query: Vec<(String, String)> = Vec::new();
2861        query.push(("url".to_string(), params.url_query.clone()));
2862        let query = if query.is_empty() { None } else { Some(query) };
2863
2864        let mut extra_headers = HeaderMap::new();
2865        let headers = if extra_headers.is_empty() {
2866            None
2867        } else {
2868            Some(extra_headers)
2869        };
2870        let body = None;
2871
2872        self.client
2873            .request_json(Method::GET, &path, headers, query, body)
2874            .await
2875    }
2876    /// 深度抓取网页转Markdown
2877    #[instrument(skip(self, params))]
2878    pub async fn post_web_tomarkdown_async(
2879        &self,
2880        params: PostWebTomarkdownAsyncParams,
2881    ) -> Result<Value> {
2882        let mut path = "/web/tomarkdown/async".to_string();
2883
2884        let mut query: Vec<(String, String)> = Vec::new();
2885        query.push(("url".to_string(), params.url_query.clone()));
2886        let query = if query.is_empty() { None } else { Some(query) };
2887
2888        let mut extra_headers = HeaderMap::new();
2889        let headers = if extra_headers.is_empty() {
2890            None
2891        } else {
2892            Some(extra_headers)
2893        };
2894        let body = None;
2895
2896        self.client
2897            .request_json(Method::POST, &path, headers, query, body)
2898            .await
2899    }
2900}
2901
2902#[derive(Debug, Clone)]
2903pub struct GetWebTomarkdownAsyncStatusParams {
2904    pub task_id_path: String,
2905}
2906
2907impl GetWebTomarkdownAsyncStatusParams {
2908    pub fn new(task_id_path: impl Into<String>) -> Self {
2909        Self {
2910            task_id_path: task_id_path.into(),
2911        }
2912    }
2913}
2914
2915#[derive(Debug, Clone)]
2916pub struct GetWebparseExtractimagesParams {
2917    pub url_query: String,
2918}
2919
2920impl GetWebparseExtractimagesParams {
2921    pub fn new(url_query: impl Into<String>) -> Self {
2922        Self {
2923            url_query: url_query.into(),
2924        }
2925    }
2926}
2927
2928#[derive(Debug, Clone)]
2929pub struct GetWebparseMetadataParams {
2930    pub url_query: String,
2931}
2932
2933impl GetWebparseMetadataParams {
2934    pub fn new(url_query: impl Into<String>) -> Self {
2935        Self {
2936            url_query: url_query.into(),
2937        }
2938    }
2939}
2940
2941#[derive(Debug, Clone)]
2942pub struct PostWebTomarkdownAsyncParams {
2943    pub url_query: String,
2944}
2945
2946impl PostWebTomarkdownAsyncParams {
2947    pub fn new(url_query: impl Into<String>) -> Self {
2948        Self {
2949            url_query: url_query.into(),
2950        }
2951    }
2952}
2953#[derive(Debug, Clone)]
2954pub struct MinGanCiShiBieService<'a> {
2955    pub(crate) client: &'a Client,
2956}
2957
2958impl<'a> MinGanCiShiBieService<'a> {
2959    /// 查询参数分析
2960    #[instrument(skip(self, params))]
2961    pub async fn get_sensitive_word_analyze_query(
2962        &self,
2963        params: GetSensitiveWordAnalyzeQueryParams,
2964    ) -> Result<Value> {
2965        let mut path = "/sensitive-word/analyze-query".to_string();
2966
2967        let mut query: Vec<(String, String)> = Vec::new();
2968        query.push(("keyword".to_string(), params.keyword_query.clone()));
2969        let query = if query.is_empty() { None } else { Some(query) };
2970
2971        let mut extra_headers = HeaderMap::new();
2972        let headers = if extra_headers.is_empty() {
2973            None
2974        } else {
2975            Some(extra_headers)
2976        };
2977        let body = None;
2978
2979        self.client
2980            .request_json(Method::GET, &path, headers, query, body)
2981            .await
2982    }
2983    /// 分析敏感词
2984    #[instrument(skip(self, params))]
2985    pub async fn post_sensitive_word_analyze(
2986        &self,
2987        params: PostSensitiveWordAnalyzeParams,
2988    ) -> Result<Value> {
2989        let mut path = "/sensitive-word/analyze".to_string();
2990
2991        let mut query: Vec<(String, String)> = Vec::new();
2992        let query = if query.is_empty() { None } else { Some(query) };
2993
2994        let mut extra_headers = HeaderMap::new();
2995        let headers = if extra_headers.is_empty() {
2996            None
2997        } else {
2998            Some(extra_headers)
2999        };
3000        let body = params.body.clone();
3001
3002        self.client
3003            .request_json(Method::POST, &path, headers, query, body)
3004            .await
3005    }
3006    /// 敏感词检测(快速)
3007    #[instrument(skip(self, params))]
3008    pub async fn post_sensitive_word_quick_check(
3009        &self,
3010        params: PostSensitiveWordQuickCheckParams,
3011    ) -> Result<Value> {
3012        let mut path = "/text/profanitycheck".to_string();
3013
3014        let mut query: Vec<(String, String)> = Vec::new();
3015        let query = if query.is_empty() { None } else { Some(query) };
3016
3017        let mut extra_headers = HeaderMap::new();
3018        let headers = if extra_headers.is_empty() {
3019            None
3020        } else {
3021            Some(extra_headers)
3022        };
3023        let body = params.body.clone();
3024
3025        self.client
3026            .request_json(Method::POST, &path, headers, query, body)
3027            .await
3028    }
3029}
3030
3031#[derive(Debug, Clone)]
3032pub struct GetSensitiveWordAnalyzeQueryParams {
3033    pub keyword_query: String,
3034}
3035
3036impl GetSensitiveWordAnalyzeQueryParams {
3037    pub fn new(keyword_query: impl Into<String>) -> Self {
3038        Self {
3039            keyword_query: keyword_query.into(),
3040        }
3041    }
3042}
3043
3044#[derive(Debug, Clone)]
3045pub struct PostSensitiveWordAnalyzeParams {
3046    pub body: Option<Value>,
3047}
3048
3049impl PostSensitiveWordAnalyzeParams {
3050    pub fn new() -> Self {
3051        Self { body: None }
3052    }
3053    pub fn body(mut self, value: Value) -> Self {
3054        self.body = Some(value);
3055        self
3056    }
3057}
3058
3059#[derive(Debug, Clone)]
3060pub struct PostSensitiveWordQuickCheckParams {
3061    pub body: Option<Value>,
3062}
3063
3064impl PostSensitiveWordQuickCheckParams {
3065    pub fn new() -> Self {
3066        Self { body: None }
3067    }
3068    pub fn body(mut self, value: Value) -> Self {
3069        self.body = Some(value);
3070        self
3071    }
3072}
3073#[derive(Debug, Clone)]
3074pub struct ZhiNengSouSuoService<'a> {
3075    pub(crate) client: &'a Client,
3076}
3077
3078impl<'a> ZhiNengSouSuoService<'a> {
3079    /// 获取搜索引擎信息
3080    #[instrument(skip(self))]
3081    pub async fn get_search_engines(&self) -> Result<Value> {
3082        let mut path = "/search/engines".to_string();
3083
3084        let mut query: Vec<(String, String)> = Vec::new();
3085        let query = if query.is_empty() { None } else { Some(query) };
3086
3087        let mut extra_headers = HeaderMap::new();
3088        let headers = if extra_headers.is_empty() {
3089            None
3090        } else {
3091            Some(extra_headers)
3092        };
3093        let body = None;
3094
3095        self.client
3096            .request_json(Method::GET, &path, headers, query, body)
3097            .await
3098    }
3099    /// 智能搜索
3100    #[instrument(skip(self, params))]
3101    pub async fn post_search_aggregate(&self, params: PostSearchAggregateParams) -> Result<Value> {
3102        let mut path = "/search/aggregate".to_string();
3103
3104        let mut query: Vec<(String, String)> = Vec::new();
3105        let query = if query.is_empty() { None } else { Some(query) };
3106
3107        let mut extra_headers = HeaderMap::new();
3108        let headers = if extra_headers.is_empty() {
3109            None
3110        } else {
3111            Some(extra_headers)
3112        };
3113        let body = params.body.clone();
3114
3115        self.client
3116            .request_json(Method::POST, &path, headers, query, body)
3117            .await
3118    }
3119}
3120
3121#[derive(Debug, Clone)]
3122pub struct PostSearchAggregateParams {
3123    pub body: Option<Value>,
3124}
3125
3126impl PostSearchAggregateParams {
3127    pub fn new() -> Self {
3128        Self { body: None }
3129    }
3130    pub fn body(mut self, value: Value) -> Self {
3131        self.body = Some(value);
3132        self
3133    }
3134}