qiniu_apis/storage/
async_fetch_object.rs

1// THIS FILE IS GENERATED BY api-generator, DO NOT EDIT DIRECTLY!
2//
3#[derive(Clone, Debug, serde :: Serialize, serde :: Deserialize)]
4#[serde(transparent)]
5#[doc = "调用 API 所用的请求体参数"]
6pub struct RequestBody(serde_json::Value);
7impl RequestBody {
8    #[allow(dead_code)]
9    pub(crate) fn new(value: serde_json::Value) -> Self {
10        Self(value)
11    }
12}
13impl Default for RequestBody {
14    #[inline]
15    fn default() -> Self {
16        Self(serde_json::Value::Object(Default::default()))
17    }
18}
19impl From<RequestBody> for serde_json::Value {
20    #[inline]
21    fn from(val: RequestBody) -> Self {
22        val.0
23    }
24}
25impl AsRef<serde_json::Value> for RequestBody {
26    #[inline]
27    fn as_ref(&self) -> &serde_json::Value {
28        &self.0
29    }
30}
31impl AsMut<serde_json::Value> for RequestBody {
32    #[inline]
33    fn as_mut(&mut self) -> &mut serde_json::Value {
34        &mut self.0
35    }
36}
37impl RequestBody {
38    #[doc = "获取 需要抓取的 URL,支持设置多个用于高可用,以’;'分隔,当指定多个 URL 时可以在前一个 URL 抓取失败时重试下一个"]
39    pub fn get_body_as_str(&self) -> &str {
40        self.0.as_object().unwrap().get("body").unwrap().as_str().unwrap()
41    }
42}
43impl RequestBody {
44    #[doc = "设置 需要抓取的 URL,支持设置多个用于高可用,以’;'分隔,当指定多个 URL 时可以在前一个 URL 抓取失败时重试下一个"]
45    pub fn set_body_as_str(&mut self, new: String) -> Option<String> {
46        self.0
47            .as_object_mut()
48            .unwrap()
49            .insert("body".to_owned(), new.into())
50            .and_then(|val| match val {
51                serde_json::Value::String(s) => Some(s),
52                _ => None,
53            })
54    }
55}
56impl RequestBody {
57    #[doc = "获取 所在区域的存储空间"]
58    pub fn get_bucket_as_str(&self) -> &str {
59        self.0.as_object().unwrap().get("bucket").unwrap().as_str().unwrap()
60    }
61}
62impl RequestBody {
63    #[doc = "设置 所在区域的存储空间"]
64    pub fn set_bucket_as_str(&mut self, new: String) -> Option<String> {
65        self.0
66            .as_object_mut()
67            .unwrap()
68            .insert("bucket".to_owned(), new.into())
69            .and_then(|val| match val {
70                serde_json::Value::String(s) => Some(s),
71                _ => None,
72            })
73    }
74}
75impl RequestBody {
76    #[doc = "获取 从指定 URL 下载数据时使用的 Host"]
77    pub fn get_host_as_str(&self) -> Option<&str> {
78        self.0
79            .as_object()
80            .and_then(|obj| obj.get("host"))
81            .and_then(|val| val.as_str())
82    }
83}
84impl RequestBody {
85    #[doc = "设置 从指定 URL 下载数据时使用的 Host"]
86    pub fn set_host_as_str(&mut self, new: String) -> Option<String> {
87        self.0.as_object_mut().and_then(|object| {
88            object.insert("host".to_owned(), new.into()).and_then(|val| match val {
89                serde_json::Value::String(s) => Some(s),
90                _ => None,
91            })
92        })
93    }
94}
95impl RequestBody {
96    #[doc = "获取 对象名称,如果不传,则默认为文件的哈希值"]
97    pub fn get_key_as_str(&self) -> Option<&str> {
98        self.0
99            .as_object()
100            .and_then(|obj| obj.get("key"))
101            .and_then(|val| val.as_str())
102    }
103}
104impl RequestBody {
105    #[doc = "设置 对象名称,如果不传,则默认为文件的哈希值"]
106    pub fn set_key_as_str(&mut self, new: String) -> Option<String> {
107        self.0.as_object_mut().and_then(|object| {
108            object.insert("key".to_owned(), new.into()).and_then(|val| match val {
109                serde_json::Value::String(s) => Some(s),
110                _ => None,
111            })
112        })
113    }
114}
115impl RequestBody {
116    #[doc = "获取 对象内容的 ETag,传入以后会在存入存储时对文件做校验,校验失败则不存入指定空间"]
117    pub fn get_etag_as_str(&self) -> Option<&str> {
118        self.0
119            .as_object()
120            .and_then(|obj| obj.get("etag"))
121            .and_then(|val| val.as_str())
122    }
123}
124impl RequestBody {
125    #[doc = "设置 对象内容的 ETag,传入以后会在存入存储时对文件做校验,校验失败则不存入指定空间"]
126    pub fn set_etag_as_str(&mut self, new: String) -> Option<String> {
127        self.0.as_object_mut().and_then(|object| {
128            object.insert("etag".to_owned(), new.into()).and_then(|val| match val {
129                serde_json::Value::String(s) => Some(s),
130                _ => None,
131            })
132        })
133    }
134}
135impl RequestBody {
136    #[doc = "获取 回调 URL"]
137    pub fn get_callback_url_as_str(&self) -> Option<&str> {
138        self.0
139            .as_object()
140            .and_then(|obj| obj.get("callbackurl"))
141            .and_then(|val| val.as_str())
142    }
143}
144impl RequestBody {
145    #[doc = "设置 回调 URL"]
146    pub fn set_callback_url_as_str(&mut self, new: String) -> Option<String> {
147        self.0.as_object_mut().and_then(|object| {
148            object
149                .insert("callbackurl".to_owned(), new.into())
150                .and_then(|val| match val {
151                    serde_json::Value::String(s) => Some(s),
152                    _ => None,
153                })
154        })
155    }
156}
157impl RequestBody {
158    #[doc = "获取 回调负荷,如果 callback_url 不为空则必须指定"]
159    pub fn get_callback_body_as_str(&self) -> Option<&str> {
160        self.0
161            .as_object()
162            .and_then(|obj| obj.get("callbackbody"))
163            .and_then(|val| val.as_str())
164    }
165}
166impl RequestBody {
167    #[doc = "设置 回调负荷,如果 callback_url 不为空则必须指定"]
168    pub fn set_callback_body_as_str(&mut self, new: String) -> Option<String> {
169        self.0.as_object_mut().and_then(|object| {
170            object
171                .insert("callbackbody".to_owned(), new.into())
172                .and_then(|val| match val {
173                    serde_json::Value::String(s) => Some(s),
174                    _ => None,
175                })
176        })
177    }
178}
179impl RequestBody {
180    #[doc = "获取 回调负荷内容类型,默认为 \"application/x-www-form-urlencoded\""]
181    pub fn get_callback_body_type_as_str(&self) -> Option<&str> {
182        self.0
183            .as_object()
184            .and_then(|obj| obj.get("callbackbodytype"))
185            .and_then(|val| val.as_str())
186    }
187}
188impl RequestBody {
189    #[doc = "设置 回调负荷内容类型,默认为 \"application/x-www-form-urlencoded\""]
190    pub fn set_callback_body_type_as_str(&mut self, new: String) -> Option<String> {
191        self.0.as_object_mut().and_then(|object| {
192            object
193                .insert("callbackbodytype".to_owned(), new.into())
194                .and_then(|val| match val {
195                    serde_json::Value::String(s) => Some(s),
196                    _ => None,
197                })
198        })
199    }
200}
201impl RequestBody {
202    #[doc = "获取 回调时使用的 Host"]
203    pub fn get_callback_host_as_str(&self) -> Option<&str> {
204        self.0
205            .as_object()
206            .and_then(|obj| obj.get("callbackhost"))
207            .and_then(|val| val.as_str())
208    }
209}
210impl RequestBody {
211    #[doc = "设置 回调时使用的 Host"]
212    pub fn set_callback_host_as_str(&mut self, new: String) -> Option<String> {
213        self.0.as_object_mut().and_then(|object| {
214            object
215                .insert("callbackhost".to_owned(), new.into())
216                .and_then(|val| match val {
217                    serde_json::Value::String(s) => Some(s),
218                    _ => None,
219                })
220        })
221    }
222}
223impl RequestBody {
224    #[doc = "获取 存储文件类型 `0`: 标准存储(默认),`1`: 低频存储,`2`: 归档存储"]
225    pub fn get_file_type_as_i64(&self) -> Option<i64> {
226        self.0
227            .as_object()
228            .and_then(|obj| obj.get("file_type"))
229            .and_then(|val| val.as_i64())
230    }
231}
232impl RequestBody {
233    #[doc = "设置 存储文件类型 `0`: 标准存储(默认),`1`: 低频存储,`2`: 归档存储"]
234    pub fn set_file_type_as_i64(&mut self, new: i64) -> Option<i64> {
235        self.0.as_object_mut().and_then(|object| {
236            object
237                .insert("file_type".to_owned(), new.into())
238                .and_then(|val| val.as_i64())
239        })
240    }
241}
242impl RequestBody {
243    #[doc = "获取 存储文件类型 `0`: 标准存储(默认),`1`: 低频存储,`2`: 归档存储"]
244    pub fn get_file_type_as_u64(&self) -> Option<u64> {
245        self.0
246            .as_object()
247            .and_then(|obj| obj.get("file_type"))
248            .and_then(|val| val.as_u64())
249    }
250}
251impl RequestBody {
252    #[doc = "设置 存储文件类型 `0`: 标准存储(默认),`1`: 低频存储,`2`: 归档存储"]
253    pub fn set_file_type_as_u64(&mut self, new: u64) -> Option<u64> {
254        self.0.as_object_mut().and_then(|object| {
255            object
256                .insert("file_type".to_owned(), new.into())
257                .and_then(|val| val.as_u64())
258        })
259    }
260}
261impl RequestBody {
262    #[doc = "获取 如果空间中已经存在同名文件则放弃本次抓取(仅对比对象名称,不校验文件内容)"]
263    pub fn get_ignore_same_key_as_bool(&self) -> Option<bool> {
264        self.0
265            .as_object()
266            .and_then(|obj| obj.get("ignore_same_key"))
267            .and_then(|val| val.as_bool())
268    }
269}
270impl RequestBody {
271    #[doc = "设置 如果空间中已经存在同名文件则放弃本次抓取(仅对比对象名称,不校验文件内容)"]
272    pub fn set_ignore_same_key_as_bool(&mut self, new: bool) -> Option<bool> {
273        self.0.as_object_mut().and_then(|object| {
274            object
275                .insert("ignore_same_key".to_owned(), new.into())
276                .and_then(|val| val.as_bool())
277        })
278    }
279}
280#[derive(Clone, Debug, serde :: Serialize, serde :: Deserialize)]
281#[serde(transparent)]
282#[doc = "获取 API 所用的响应体参数"]
283pub struct ResponseBody(serde_json::Value);
284impl ResponseBody {
285    #[allow(dead_code)]
286    pub(crate) fn new(value: serde_json::Value) -> Self {
287        Self(value)
288    }
289}
290impl Default for ResponseBody {
291    #[inline]
292    fn default() -> Self {
293        Self(serde_json::Value::Object(Default::default()))
294    }
295}
296impl From<ResponseBody> for serde_json::Value {
297    #[inline]
298    fn from(val: ResponseBody) -> Self {
299        val.0
300    }
301}
302impl AsRef<serde_json::Value> for ResponseBody {
303    #[inline]
304    fn as_ref(&self) -> &serde_json::Value {
305        &self.0
306    }
307}
308impl AsMut<serde_json::Value> for ResponseBody {
309    #[inline]
310    fn as_mut(&mut self) -> &mut serde_json::Value {
311        &mut self.0
312    }
313}
314impl ResponseBody {
315    #[doc = "获取 异步任务 ID"]
316    pub fn get_id_as_str(&self) -> &str {
317        self.0.as_object().unwrap().get("id").unwrap().as_str().unwrap()
318    }
319}
320impl ResponseBody {
321    #[doc = "设置 异步任务 ID"]
322    pub fn set_id_as_str(&mut self, new: String) -> Option<String> {
323        self.0
324            .as_object_mut()
325            .unwrap()
326            .insert("id".to_owned(), new.into())
327            .and_then(|val| match val {
328                serde_json::Value::String(s) => Some(s),
329                _ => None,
330            })
331    }
332}
333impl ResponseBody {
334    #[doc = "获取 当前任务前面的排队任务数量,`0` 表示当前任务正在进行,`-1` 表示任务已经至少被处理过一次(可能会进入重试逻辑)"]
335    pub fn get_queued_tasks_count_as_i64(&self) -> i64 {
336        self.0.as_object().unwrap().get("wait").unwrap().as_i64().unwrap()
337    }
338}
339impl ResponseBody {
340    #[doc = "设置 当前任务前面的排队任务数量,`0` 表示当前任务正在进行,`-1` 表示任务已经至少被处理过一次(可能会进入重试逻辑)"]
341    pub fn set_queued_tasks_count_as_i64(&mut self, new: i64) -> Option<i64> {
342        self.0
343            .as_object_mut()
344            .unwrap()
345            .insert("wait".to_owned(), new.into())
346            .and_then(|val| val.as_i64())
347    }
348}
349impl ResponseBody {
350    #[doc = "获取 当前任务前面的排队任务数量,`0` 表示当前任务正在进行,`-1` 表示任务已经至少被处理过一次(可能会进入重试逻辑)"]
351    pub fn get_queued_tasks_count_as_u64(&self) -> u64 {
352        self.0.as_object().unwrap().get("wait").unwrap().as_u64().unwrap()
353    }
354}
355impl ResponseBody {
356    #[doc = "设置 当前任务前面的排队任务数量,`0` 表示当前任务正在进行,`-1` 表示任务已经至少被处理过一次(可能会进入重试逻辑)"]
357    pub fn set_queued_tasks_count_as_u64(&mut self, new: u64) -> Option<u64> {
358        self.0
359            .as_object_mut()
360            .unwrap()
361            .insert("wait".to_owned(), new.into())
362            .and_then(|val| val.as_u64())
363    }
364}
365#[doc = "API 调用客户端"]
366#[derive(Debug, Clone)]
367pub struct Client<'client>(&'client qiniu_http_client::HttpClient);
368impl<'client> Client<'client> {
369    pub(super) fn new(http_client: &'client qiniu_http_client::HttpClient) -> Self {
370        Self(http_client)
371    }
372}
373impl<'client> Client<'client> {
374    #[inline]
375    #[doc = "创建一个新的阻塞请求,该方法的异步版本为 [`Self::new_async_request`]"]
376    pub fn new_request<E: qiniu_http_client::EndpointsProvider + 'client>(
377        &self,
378        endpoints_provider: E,
379        credential: impl qiniu_http_client::credential::CredentialProvider + Clone + 'client,
380    ) -> SyncRequestBuilder<'client, E> {
381        RequestBuilder({
382            let mut builder = self.0.post(&[qiniu_http_client::ServiceName::Api], endpoints_provider);
383            builder.authorization(qiniu_http_client::Authorization::v2(credential));
384            builder.idempotent(qiniu_http_client::Idempotent::Default);
385            builder.path("sisyphus/fetch");
386            builder.accept_json();
387            builder
388        })
389    }
390    #[inline]
391    #[cfg(feature = "async")]
392    #[doc = "创建一个新的异步请求"]
393    pub fn new_async_request<E: qiniu_http_client::EndpointsProvider + 'client>(
394        &self,
395        endpoints_provider: E,
396        credential: impl qiniu_http_client::credential::CredentialProvider + Clone + 'client,
397    ) -> AsyncRequestBuilder<'client, E> {
398        RequestBuilder({
399            let mut builder = self
400                .0
401                .async_post(&[qiniu_http_client::ServiceName::Api], endpoints_provider);
402            builder.authorization(qiniu_http_client::Authorization::v2(credential));
403            builder.idempotent(qiniu_http_client::Idempotent::Default);
404            builder.path("sisyphus/fetch");
405            builder.accept_json();
406            builder
407        })
408    }
409}
410#[derive(Debug)]
411#[doc = "API 请求构造器"]
412pub struct RequestBuilder<'req, B, E>(qiniu_http_client::RequestBuilder<'req, B, E>);
413#[doc = "API 阻塞请求构造器"]
414pub type SyncRequestBuilder<'req, E> = RequestBuilder<'req, qiniu_http_client::SyncRequestBody<'req>, E>;
415#[cfg(feature = "async")]
416#[cfg_attr(feature = "docs", doc(cfg(feature = "async")))]
417#[doc = "API 异步请求构造器"]
418pub type AsyncRequestBuilder<'req, E> = RequestBuilder<'req, qiniu_http_client::AsyncRequestBody<'req>, E>;
419impl<'req, B, E> RequestBuilder<'req, B, E> {
420    #[inline]
421    #[doc = "设置是否使用 HTTPS"]
422    pub fn use_https(&mut self, use_https: bool) -> &mut Self {
423        self.0.use_https(use_https);
424        self
425    }
426    #[inline]
427    #[doc = "设置 HTTP 协议版本"]
428    pub fn version(&mut self, version: qiniu_http_client::http::Version) -> &mut Self {
429        self.0.version(version);
430        self
431    }
432    #[inline]
433    #[doc = "设置 HTTP 请求头"]
434    pub fn headers(
435        &mut self,
436        headers: impl Into<std::borrow::Cow<'req, qiniu_http_client::http::HeaderMap>>,
437    ) -> &mut Self {
438        self.0.headers(headers);
439        self
440    }
441    #[inline]
442    #[doc = "添加 HTTP 请求头"]
443    pub fn set_header(
444        &mut self,
445        header_name: impl qiniu_http_client::http::header::IntoHeaderName,
446        header_value: impl Into<qiniu_http_client::http::HeaderValue>,
447    ) -> &mut Self {
448        self.0.set_header(header_name, header_value);
449        self
450    }
451    #[inline]
452    #[doc = "设置查询参数"]
453    pub fn query(&mut self, query: impl Into<std::borrow::Cow<'req, str>>) -> &mut Self {
454        self.0.query(query);
455        self
456    }
457    #[inline]
458    #[doc = "设置查询参数"]
459    pub fn query_pairs(&mut self, query_pairs: impl Into<Vec<qiniu_http_client::QueryPair<'req>>>) -> &mut Self {
460        self.0.query_pairs(query_pairs);
461        self
462    }
463    #[inline]
464    #[doc = "追加查询参数"]
465    pub fn append_query_pair(
466        &mut self,
467        query_pair_key: impl Into<qiniu_http_client::QueryPairKey<'req>>,
468        query_pair_value: impl Into<qiniu_http_client::QueryPairValue<'req>>,
469    ) -> &mut Self {
470        self.0.append_query_pair(query_pair_key, query_pair_value);
471        self
472    }
473    #[inline]
474    #[doc = "设置扩展信息"]
475    pub fn extensions(&mut self, extensions: qiniu_http_client::http::Extensions) -> &mut Self {
476        self.0.extensions(extensions);
477        self
478    }
479    #[doc = "添加扩展信息"]
480    #[inline]
481    pub fn add_extension<T: Send + Sync + 'static>(&mut self, val: T) -> &mut Self {
482        self.0.add_extension(val);
483        self
484    }
485    #[inline]
486    #[doc = "上传进度回调函数"]
487    pub fn on_uploading_progress(
488        &mut self,
489        callback: impl Fn(
490                &dyn qiniu_http_client::SimplifiedCallbackContext,
491                qiniu_http_client::http::TransferProgressInfo,
492            ) -> anyhow::Result<()>
493            + Send
494            + Sync
495            + 'req,
496    ) -> &mut Self {
497        self.0.on_uploading_progress(callback);
498        self
499    }
500    #[inline]
501    #[doc = "设置响应状态码回调函数"]
502    pub fn on_receive_response_status(
503        &mut self,
504        callback: impl Fn(
505                &dyn qiniu_http_client::SimplifiedCallbackContext,
506                qiniu_http_client::http::StatusCode,
507            ) -> anyhow::Result<()>
508            + Send
509            + Sync
510            + 'req,
511    ) -> &mut Self {
512        self.0.on_receive_response_status(callback);
513        self
514    }
515    #[inline]
516    #[doc = "设置响应 HTTP 头回调函数"]
517    pub fn on_receive_response_header(
518        &mut self,
519        callback: impl Fn(
520                &dyn qiniu_http_client::SimplifiedCallbackContext,
521                &qiniu_http_client::http::HeaderName,
522                &qiniu_http_client::http::HeaderValue,
523            ) -> anyhow::Result<()>
524            + Send
525            + Sync
526            + 'req,
527    ) -> &mut Self {
528        self.0.on_receive_response_header(callback);
529        self
530    }
531    #[inline]
532    #[doc = "设置域名解析前回调函数"]
533    pub fn on_to_resolve_domain(
534        &mut self,
535        callback: impl Fn(&mut dyn qiniu_http_client::CallbackContext, &str) -> anyhow::Result<()> + Send + Sync + 'req,
536    ) -> &mut Self {
537        self.0.on_to_resolve_domain(callback);
538        self
539    }
540    #[inline]
541    #[doc = "设置域名解析成功回调函数"]
542    pub fn on_domain_resolved(
543        &mut self,
544        callback: impl Fn(
545                &mut dyn qiniu_http_client::CallbackContext,
546                &str,
547                &qiniu_http_client::ResolveAnswers,
548            ) -> anyhow::Result<()>
549            + Send
550            + Sync
551            + 'req,
552    ) -> &mut Self {
553        self.0.on_domain_resolved(callback);
554        self
555    }
556    #[inline]
557    #[doc = "设置 IP 地址选择前回调函数"]
558    pub fn on_to_choose_ips(
559        &mut self,
560        callback: impl Fn(&mut dyn qiniu_http_client::CallbackContext, &[qiniu_http_client::IpAddrWithPort]) -> anyhow::Result<()>
561            + Send
562            + Sync
563            + 'req,
564    ) -> &mut Self {
565        self.0.on_to_choose_ips(callback);
566        self
567    }
568    #[inline]
569    #[doc = "设置 IP 地址选择成功回调函数"]
570    pub fn on_ips_chosen(
571        &mut self,
572        callback: impl Fn(
573                &mut dyn qiniu_http_client::CallbackContext,
574                &[qiniu_http_client::IpAddrWithPort],
575                &[qiniu_http_client::IpAddrWithPort],
576            ) -> anyhow::Result<()>
577            + Send
578            + Sync
579            + 'req,
580    ) -> &mut Self {
581        self.0.on_ips_chosen(callback);
582        self
583    }
584    #[inline]
585    #[doc = "设置 HTTP 请求签名前回调函数"]
586    pub fn on_before_request_signed(
587        &mut self,
588        callback: impl Fn(&mut dyn qiniu_http_client::ExtendedCallbackContext) -> anyhow::Result<()> + Send + Sync + 'req,
589    ) -> &mut Self {
590        self.0.on_before_request_signed(callback);
591        self
592    }
593    #[inline]
594    #[doc = "设置 HTTP 请求前回调函数"]
595    pub fn on_after_request_signed(
596        &mut self,
597        callback: impl Fn(&mut dyn qiniu_http_client::ExtendedCallbackContext) -> anyhow::Result<()> + Send + Sync + 'req,
598    ) -> &mut Self {
599        self.0.on_after_request_signed(callback);
600        self
601    }
602    #[inline]
603    #[doc = "设置响应成功回调函数"]
604    pub fn on_response(
605        &mut self,
606        callback: impl Fn(
607                &mut dyn qiniu_http_client::ExtendedCallbackContext,
608                &qiniu_http_client::http::ResponseParts,
609            ) -> anyhow::Result<()>
610            + Send
611            + Sync
612            + 'req,
613    ) -> &mut Self {
614        self.0.on_response(callback);
615        self
616    }
617    #[inline]
618    #[doc = "设置响应错误回调函数"]
619    pub fn on_error(
620        &mut self,
621        callback: impl Fn(
622                &mut dyn qiniu_http_client::ExtendedCallbackContext,
623                &mut qiniu_http_client::ResponseError,
624            ) -> anyhow::Result<()>
625            + Send
626            + Sync
627            + 'req,
628    ) -> &mut Self {
629        self.0.on_error(callback);
630        self
631    }
632    #[inline]
633    #[doc = "设置退避前回调函数"]
634    pub fn on_before_backoff(
635        &mut self,
636        callback: impl Fn(&mut dyn qiniu_http_client::ExtendedCallbackContext, std::time::Duration) -> anyhow::Result<()>
637            + Send
638            + Sync
639            + 'req,
640    ) -> &mut Self {
641        self.0.on_before_backoff(callback);
642        self
643    }
644    #[inline]
645    #[doc = "设置退避后回调函数"]
646    pub fn on_after_backoff(
647        &mut self,
648        callback: impl Fn(&mut dyn qiniu_http_client::ExtendedCallbackContext, std::time::Duration) -> anyhow::Result<()>
649            + Send
650            + Sync
651            + 'req,
652    ) -> &mut Self {
653        self.0.on_after_backoff(callback);
654        self
655    }
656    #[inline]
657    #[doc = "获取 HTTP 请求构建器部分参数"]
658    pub fn parts(&self) -> &qiniu_http_client::RequestBuilderParts<'req> {
659        self.0.parts()
660    }
661    #[inline]
662    #[doc = "获取 HTTP 请求构建器部分参数的可变引用"]
663    pub fn parts_mut(&mut self) -> &mut qiniu_http_client::RequestBuilderParts<'req> {
664        self.0.parts_mut()
665    }
666}
667impl<'req, E: qiniu_http_client::EndpointsProvider + Clone + 'req> SyncRequestBuilder<'req, E> {
668    #[doc = "阻塞发起 HTTP 请求"]
669    pub fn call(
670        &mut self,
671        body: &RequestBody,
672    ) -> qiniu_http_client::ApiResult<qiniu_http_client::Response<ResponseBody>> {
673        let request = self.0.json(body)?;
674        let response = request.call()?;
675        let parsed = response.parse_json()?;
676        Ok(parsed)
677    }
678}
679#[cfg(feature = "async")]
680impl<'req, E: qiniu_http_client::EndpointsProvider + Clone + 'req> AsyncRequestBuilder<'req, E> {
681    #[doc = "异步发起 HTTP 请求"]
682    pub async fn call(
683        &mut self,
684        body: &RequestBody,
685    ) -> qiniu_http_client::ApiResult<qiniu_http_client::Response<ResponseBody>> {
686        let request = self.0.json(body)?;
687        let response = request.call().await?;
688        let parsed = response.parse_json().await?;
689        Ok(parsed)
690    }
691}