open-lark 0.14.0

Enterprise-grade Lark/Feishu Open API SDK with comprehensive Chinese documentation and advanced error handling
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
use reqwest::Method;
use serde::{Deserialize, Serialize};

use crate::{
    core::{
        api_req::ApiRequest,
        api_resp::{ApiResponseTrait, BaseResponse, ResponseFormat},
        config::Config,
        constants::AccessTokenType,
        endpoints::hire::*,
        endpoints::EndpointBuilder,
        http::Transport,
        req_option::RequestOption,
        SDKResult,
    },
    service::hire::models::{CommonResponse, PageResponse},
};

/// 附件服务
pub struct AttachmentService {
    pub config: Config,
}

/// 附件信息
#[derive(Debug, Serialize, Deserialize)]
pub struct Attachment {
    /// 附件ID
    pub id: String,
    /// 附件名称
    pub name: String,
    /// 附件类型
    pub attachment_type: String,
    /// 文件类型
    pub file_type: String,
    /// 文件大小(字节)
    pub file_size: u64,
    /// 附件URL
    pub url: String,
    /// 下载URL
    pub download_url: Option<String>,
    /// 预览URL
    pub preview_url: Option<String>,
    /// 关联对象类型
    pub object_type: String,
    /// 关联对象ID
    pub object_id: String,
    /// 上传人ID
    pub uploader_id: String,
    /// 附件描述
    pub description: Option<String>,
    /// 是否公开
    pub is_public: bool,
    /// 过期时间
    pub expiration_time: Option<String>,
    /// 创建时间
    pub created_time: Option<String>,
    /// 更新时间
    pub updated_time: Option<String>,
}

/// 附件上传请求
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AttachmentUploadRequest {
    /// 附件名称
    pub name: String,
    /// 附件类型
    pub attachment_type: String,
    /// 关联对象类型
    pub object_type: String,
    /// 关联对象ID
    pub object_id: String,
    /// 附件描述
    pub description: Option<String>,
    /// 是否公开
    pub is_public: Option<bool>,
    /// 过期时间
    pub expiration_time: Option<String>,
}

/// 附件上传信息
#[derive(Debug, Serialize, Deserialize)]
pub struct AttachmentUploadInfo {
    /// 上传URL
    pub upload_url: String,
    /// 上传方法
    pub upload_method: String,
    /// 上传头部信息
    pub upload_headers: Option<std::collections::HashMap<String, String>>,
    /// 附件ID
    pub attachment_id: String,
    /// 过期时间
    pub expires_at: String,
}

/// 附件更新请求
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AttachmentUpdateRequest {
    /// 附件名称
    pub name: Option<String>,
    /// 附件描述
    pub description: Option<String>,
    /// 是否公开
    pub is_public: Option<bool>,
    /// 过期时间
    pub expiration_time: Option<String>,
}

/// 附件列表请求
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AttachmentListRequest {
    /// 分页大小
    pub page_size: Option<u32>,
    /// 分页标记
    pub page_token: Option<String>,
    /// 关联对象类型
    pub object_type: Option<String>,
    /// 关联对象ID
    pub object_id: Option<String>,
    /// 附件类型
    pub attachment_type: Option<String>,
    /// 上传人ID
    pub uploader_id: Option<String>,
    /// 创建时间开始
    pub created_start_time: Option<String>,
    /// 创建时间结束
    pub created_end_time: Option<String>,
}

/// 批量下载请求
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BatchDownloadRequest {
    /// 附件ID列表
    pub attachment_ids: Vec<String>,
    /// 压缩包名称
    pub archive_name: Option<String>,
}

/// 附件列表响应
#[derive(Debug, Serialize, Deserialize)]
pub struct AttachmentListResponse {
    /// 附件列表
    #[serde(flatten)]
    pub attachments: PageResponse<Attachment>,
}

impl ApiResponseTrait for AttachmentListResponse {
    fn data_format() -> ResponseFormat {
        ResponseFormat::Data
    }
}

/// 附件详情响应
#[derive(Debug, Serialize, Deserialize)]
pub struct AttachmentDetailResponse {
    /// 附件信息
    pub attachment: Attachment,
}

impl ApiResponseTrait for AttachmentDetailResponse {
    fn data_format() -> ResponseFormat {
        ResponseFormat::Data
    }
}

/// 附件上传响应
#[derive(Debug, Serialize, Deserialize)]
pub struct AttachmentUploadResponse {
    /// 上传信息
    pub upload_info: AttachmentUploadInfo,
}

impl ApiResponseTrait for AttachmentUploadResponse {
    fn data_format() -> ResponseFormat {
        ResponseFormat::Data
    }
}

/// 批量下载响应
#[derive(Debug, Serialize, Deserialize)]
pub struct BatchDownloadResponse {
    /// 下载链接
    pub download_url: String,
    /// 过期时间
    pub expires_at: String,
}

impl ApiResponseTrait for BatchDownloadResponse {
    fn data_format() -> ResponseFormat {
        ResponseFormat::Data
    }
}

/// 附件操作响应
#[derive(Debug, Serialize, Deserialize)]
pub struct AttachmentOperationResponse {
    /// 操作结果
    #[serde(flatten)]
    pub result: CommonResponse,
    /// 相关ID
    pub id: Option<String>,
}

impl ApiResponseTrait for AttachmentOperationResponse {
    fn data_format() -> ResponseFormat {
        ResponseFormat::Data
    }
}

impl AttachmentService {
    pub fn new(config: Config) -> Self {
        Self { config }
    }

    /// 创建附件上传任务
    ///
    /// 该接口用于创建附件上传任务,获取上传URL和相关
    /// 上传信息。客户端可以使用返回的信息直接上传文件。
    ///
    /// # 参数
    ///
    /// - `request`: 附件上传请求参数,包括:
    ///   - `name`: 附件名称(必填)
    ///   - `attachment_type`: 附件类型(必填)
    ///   - `object_type`: 关联对象类型(必填)
    ///   - `object_id`: 关联对象ID(必填)
    ///   - `description`: 附件描述
    ///   - `is_public`: 是否公开
    ///   - `expiration_time`: 过期时间
    /// - `option`: 可选的请求配置
    ///
    /// # 返回值
    ///
    /// 返回附件上传信息,包括:
    /// - 上传URL和方法
    /// - 上传头部信息
    /// - 附件ID和过期时间
    ///
    /// # 示例
    ///
    /// ```ignore
    /// use open_lark::service::hire::attachment::AttachmentUploadRequest;
    ///
    /// let request = AttachmentUploadRequest {
    ///     name: "候选人简历.pdf".to_string(),
    ///     attachment_type: "resume".to_string(),
    ///     object_type: "talent".to_string(),
    ///     object_id: "talent_123456".to_string(),
    ///     description: Some("候选人的最新简历".to_string()),
    ///     is_public: Some(false),
    ///     expiration_time: Some("2024-12-31T23:59:59Z".to_string()),
    /// };
    ///
    /// let response = client.hire.attachment.create_upload_task(request, None).await?;
    ///
    /// if let Some(data) = &response.data {
    ///     println!("上传URL: {}", data.upload_info.upload_url);
    ///     println!("附件ID: {}", data.upload_info.attachment_id);
    /// }
    /// ```
    pub async fn create_upload_task(
        &self,
        request: AttachmentUploadRequest,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentUploadResponse>> {
        let api_req = ApiRequest {
            http_method: Method::POST,
            api_path: HIRE_V1_ATTACHMENT_UPLOAD.to_string(),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: serde_json::to_vec(&request).unwrap_or_default(),
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 获取附件详情
    ///
    /// 该接口用于获取指定附件的详细信息,包括附件
    /// 基本信息、下载链接、预览链接等完整数据。
    ///
    /// # 参数
    ///
    /// - `attachment_id`: 附件ID
    /// - `option`: 可选的请求配置
    ///
    /// # 返回值
    ///
    /// 返回附件详细信息,包括:
    /// - 附件基本信息(名称、类型、大小等)
    /// - 下载和预览链接
    /// - 关联对象信息
    /// - 创建和更新时间
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let attachment_id = "attachment_123456";
    /// let response = client.hire.attachment.get_attachment_detail(attachment_id, None).await?;
    ///
    /// if let Some(data) = &response.data {
    ///     println!("附件名称: {}", data.attachment.name);
    ///     println!("文件大小: {} 字节", data.attachment.file_size);
    ///     println!("下载链接: {:?}", data.attachment.download_url);
    /// }
    /// ```
    pub async fn get_attachment_detail(
        &self,
        attachment_id: &str,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentDetailResponse>> {
        let api_req = ApiRequest {
            http_method: Method::GET,
            api_path: EndpointBuilder::replace_param(
                HIRE_V1_ATTACHMENT_GET,
                "attachment_id",
                attachment_id,
            ),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 获取附件列表
    ///
    /// 该接口用于获取附件列表,支持按关联对象、
    /// 附件类型、上传人、时间等条件筛选。返回的
    /// 列表包含附件基本信息,可用于附件管理。
    ///
    /// # 参数
    ///
    /// - `request`: 附件列表查询请求参数,包括:
    ///   - `page_size`: 分页大小,最大值100
    ///   - `page_token`: 分页标记
    ///   - `object_type`: 关联对象类型筛选
    ///   - `object_id`: 关联对象ID筛选
    ///   - `attachment_type`: 附件类型筛选
    ///   - `uploader_id`: 上传人ID筛选
    ///   - `created_start_time`: 创建时间开始
    ///   - `created_end_time`: 创建时间结束
    /// - `option`: 可选的请求配置
    ///
    /// # 返回值
    ///
    /// 返回分页的附件列表,包括:
    /// - 附件基本信息列表
    /// - 分页信息(是否有更多数据、下一页标记)
    ///
    /// # 示例
    ///
    /// ```ignore
    /// use open_lark::service::hire::attachment::AttachmentListRequest;
    ///
    /// let request = AttachmentListRequest {
    ///     page_size: Some(50),
    ///     page_token: None,
    ///     object_type: Some("talent".to_string()),
    ///     object_id: Some("talent_123456".to_string()),
    ///     attachment_type: Some("resume".to_string()),
    ///     ..Default::default()
    /// };
    ///
    /// let response = client.hire.attachment.list_attachments(request, None).await?;
    ///
    /// if let Some(data) = &response.data {
    ///     println!("附件总数: {}", data.attachments.items.len());
    ///     for attachment in &data.attachments.items {
    ///         println!("附件: {} ({})", attachment.name, attachment.file_type);
    ///     }
    /// }
    /// ```
    pub async fn list_attachments(
        &self,
        request: AttachmentListRequest,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentListResponse>> {
        let mut api_req = ApiRequest {
            http_method: Method::GET,
            api_path: HIRE_V1_ATTACHMENTS.to_string(),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        // 添加查询参数
        if let Some(page_size) = request.page_size {
            api_req
                .query_params
                .insert("page_size", page_size.to_string());
        }

        if let Some(page_token) = request.page_token {
            api_req.query_params.insert("page_token", page_token);
        }

        if let Some(object_type) = request.object_type {
            api_req.query_params.insert("object_type", object_type);
        }

        if let Some(object_id) = request.object_id {
            api_req.query_params.insert("object_id", object_id);
        }

        if let Some(attachment_type) = request.attachment_type {
            api_req
                .query_params
                .insert("attachment_type", attachment_type);
        }

        if let Some(uploader_id) = request.uploader_id {
            api_req.query_params.insert("uploader_id", uploader_id);
        }

        if let Some(created_start_time) = request.created_start_time {
            api_req
                .query_params
                .insert("created_start_time", created_start_time);
        }

        if let Some(created_end_time) = request.created_end_time {
            api_req
                .query_params
                .insert("created_end_time", created_end_time);
        }

        Transport::request(api_req, &self.config, option).await
    }

    /// 更新附件信息
    ///
    /// 该接口用于更新附件的基本信息,包括名称、
    /// 描述、公开状态等属性。
    ///
    /// # 参数
    ///
    /// - `attachment_id`: 附件ID
    /// - `request`: 附件更新请求参数
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// use open_lark::service::hire::attachment::AttachmentUpdateRequest;
    ///
    /// let attachment_id = "attachment_123456";
    /// let request = AttachmentUpdateRequest {
    ///     name: Some("更新后的简历.pdf".to_string()),
    ///     description: Some("候选人的最新简历版本".to_string()),
    ///     is_public: Some(true),
    ///     expiration_time: Some("2025-12-31T23:59:59Z".to_string()),
    /// };
    ///
    /// let response = client.hire.attachment.update_attachment(attachment_id, request, None).await?;
    /// ```
    pub async fn update_attachment(
        &self,
        attachment_id: &str,
        request: AttachmentUpdateRequest,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentOperationResponse>> {
        let api_req = ApiRequest {
            http_method: Method::POST,
            api_path: EndpointBuilder::replace_param(
                HIRE_V1_ATTACHMENT_GET,
                "attachment_id",
                attachment_id,
            ),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: serde_json::to_vec(&request).unwrap_or_default(),
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 删除附件
    ///
    /// 该接口用于删除指定的附件文件,删除后
    /// 附件将无法再次访问和下载。
    ///
    /// # 参数
    ///
    /// - `attachment_id`: 附件ID
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let attachment_id = "attachment_123456";
    /// let response = client.hire.attachment.delete_attachment(attachment_id, None).await?;
    /// ```
    pub async fn delete_attachment(
        &self,
        attachment_id: &str,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentOperationResponse>> {
        let api_req = ApiRequest {
            http_method: Method::DELETE,
            api_path: EndpointBuilder::replace_param(
                HIRE_V1_ATTACHMENT_GET,
                "attachment_id",
                attachment_id,
            ),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 获取附件下载链接
    ///
    /// 该接口用于获取附件的临时下载链接,
    /// 链接具有一定的有效期。
    ///
    /// # 参数
    ///
    /// - `attachment_id`: 附件ID
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let attachment_id = "attachment_123456";
    /// let response = client.hire.attachment.get_download_url(attachment_id, None).await?;
    /// ```
    pub async fn get_download_url(
        &self,
        attachment_id: &str,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<serde_json::Value>> {
        let api_req = ApiRequest {
            http_method: Method::GET,
            api_path: EndpointBuilder::replace_param(
                HIRE_V1_ATTACHMENT_DOWNLOAD,
                "attachment_id",
                attachment_id,
            ),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 获取附件预览链接
    ///
    /// 该接口用于获取附件的预览链接,支持在线
    /// 预览文档、图片等格式的附件。
    ///
    /// # 参数
    ///
    /// - `attachment_id`: 附件ID
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let attachment_id = "attachment_123456";
    /// let response = client.hire.attachment.get_preview_url(attachment_id, None).await?;
    /// ```
    pub async fn get_preview_url(
        &self,
        attachment_id: &str,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<serde_json::Value>> {
        let api_req = ApiRequest {
            http_method: Method::GET,
            api_path: EndpointBuilder::replace_param(
                HIRE_V1_ATTACHMENT_PREVIEW,
                "attachment_id",
                attachment_id,
            ),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 批量下载附件
    ///
    /// 该接口用于批量下载多个附件,系统会将
    /// 选中的附件打包成压缩文件供下载。
    ///
    /// # 参数
    ///
    /// - `request`: 批量下载请求参数,包括:
    ///   - `attachment_ids`: 附件ID列表(必填)
    ///   - `archive_name`: 压缩包名称
    /// - `option`: 可选的请求配置
    ///
    /// # 返回值
    ///
    /// 返回批量下载信息,包括:
    /// - 下载链接和过期时间
    ///
    /// # 示例
    ///
    /// ```ignore
    /// use open_lark::service::hire::attachment::BatchDownloadRequest;
    ///
    /// let request = BatchDownloadRequest {
    ///     attachment_ids: vec![
    ///         "attachment_001".to_string(),
    ///         "attachment_002".to_string(),
    ///         "attachment_003".to_string(),
    ///     ],
    ///     archive_name: Some("候选人材料.zip".to_string()),
    /// };
    ///
    /// let response = client.hire.attachment.batch_download(request, None).await?;
    ///
    /// if let Some(data) = &response.data {
    ///     println!("下载链接: {}", data.download_url);
    ///     println!("过期时间: {}", data.expires_at);
    /// }
    /// ```
    pub async fn batch_download(
        &self,
        request: BatchDownloadRequest,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<BatchDownloadResponse>> {
        let api_req = ApiRequest {
            http_method: Method::POST,
            api_path: HIRE_V1_ATTACHMENTS_BATCH_DOWNLOAD.to_string(),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: serde_json::to_vec(&request).unwrap_or_default(),
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 批量删除附件
    ///
    /// 该接口用于批量删除多个附件,
    /// 提高操作效率。
    ///
    /// # 参数
    ///
    /// - `attachment_ids`: 附件ID列表
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let attachment_ids = vec![
    ///     "attachment_001".to_string(),
    ///     "attachment_002".to_string(),
    ///     "attachment_003".to_string(),
    /// ];
    ///
    /// let response = client.hire.attachment.batch_delete(attachment_ids, None).await?;
    /// ```
    pub async fn batch_delete(
        &self,
        attachment_ids: Vec<String>,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<AttachmentOperationResponse>> {
        #[derive(Serialize)]
        struct BatchDeleteRequest {
            attachment_ids: Vec<String>,
        }

        let request = BatchDeleteRequest { attachment_ids };

        let api_req = ApiRequest {
            http_method: Method::POST,
            api_path: HIRE_V1_ATTACHMENTS_BATCH_DELETE.to_string(),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: serde_json::to_vec(&request).unwrap_or_default(),
            ..Default::default()
        };

        Transport::request(api_req, &self.config, option).await
    }

    /// 获取附件统计信息
    ///
    /// 该接口用于获取附件相关的统计数据,包括
    /// 附件总数、存储容量、文件类型分布等信息。
    ///
    /// # 参数
    ///
    /// - `object_type`: 关联对象类型(可选)
    /// - `start_date`: 统计开始日期(可选)
    /// - `end_date`: 统计结束日期(可选)
    /// - `option`: 可选的请求配置
    ///
    /// # 示例
    ///
    /// ```ignore
    /// let object_type = Some("talent".to_string());
    /// let start_date = Some("2024-01-01".to_string());
    /// let end_date = Some("2024-01-31".to_string());
    ///
    /// let response = client.hire.attachment.get_attachment_statistics(
    ///     object_type,
    ///     start_date,
    ///     end_date,
    ///     None
    /// ).await?;
    /// ```
    pub async fn get_attachment_statistics(
        &self,
        object_type: Option<String>,
        start_date: Option<String>,
        end_date: Option<String>,
        option: Option<RequestOption>,
    ) -> SDKResult<BaseResponse<serde_json::Value>> {
        let mut api_req = ApiRequest {
            http_method: Method::GET,
            api_path: HIRE_V1_ATTACHMENT_STATISTICS.to_string(),
            supported_access_token_types: vec![AccessTokenType::Tenant],
            body: vec![],
            ..Default::default()
        };

        // 添加查询参数
        if let Some(object_type) = object_type {
            api_req.query_params.insert("object_type", object_type);
        }

        if let Some(start_date) = start_date {
            api_req.query_params.insert("start_date", start_date);
        }

        if let Some(end_date) = end_date {
            api_req.query_params.insert("end_date", end_date);
        }

        Transport::request(api_req, &self.config, option).await
    }
}