@@ -37,7 +37,7 @@ use crate::{
37
37
} ;
38
38
use percent_encoding:: percent_encode;
39
39
use serde:: Serialize ;
40
- use std:: borrow:: Cow ;
40
+ use std:: { borrow:: Cow , time :: Duration } ;
41
41
#[ derive( Debug , Clone , PartialEq ) ]
42
42
#[ doc = "API parts for the Async Search Delete API" ]
43
43
pub enum AsyncSearchDeleteParts < ' b > {
@@ -68,6 +68,7 @@ pub struct AsyncSearchDelete<'a, 'b> {
68
68
headers : HeaderMap ,
69
69
human : Option < bool > ,
70
70
pretty : Option < bool > ,
71
+ request_timeout : Option < Duration > ,
71
72
source : Option < & ' b str > ,
72
73
}
73
74
impl < ' a , ' b > AsyncSearchDelete < ' a , ' b > {
@@ -82,6 +83,7 @@ impl<'a, 'b> AsyncSearchDelete<'a, 'b> {
82
83
filter_path : None ,
83
84
human : None ,
84
85
pretty : None ,
86
+ request_timeout : None ,
85
87
source : None ,
86
88
}
87
89
}
@@ -110,6 +112,11 @@ impl<'a, 'b> AsyncSearchDelete<'a, 'b> {
110
112
self . pretty = Some ( pretty) ;
111
113
self
112
114
}
115
+ #[ doc = "Sets a request timeout for this API call.\n \n The timeout is applied from when the request starts connecting until the response body has finished." ]
116
+ pub fn request_timeout ( mut self , timeout : Duration ) -> Self {
117
+ self . request_timeout = Some ( timeout) ;
118
+ self
119
+ }
113
120
#[ doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests." ]
114
121
pub fn source ( mut self , source : & ' b str ) -> Self {
115
122
self . source = Some ( source) ;
@@ -120,6 +127,7 @@ impl<'a, 'b> AsyncSearchDelete<'a, 'b> {
120
127
let path = self . parts . url ( ) ;
121
128
let method = Method :: Delete ;
122
129
let headers = self . headers ;
130
+ let timeout = self . request_timeout ;
123
131
let query_string = {
124
132
#[ serde_with:: skip_serializing_none]
125
133
#[ derive( Serialize ) ]
@@ -150,7 +158,7 @@ impl<'a, 'b> AsyncSearchDelete<'a, 'b> {
150
158
let body = Option :: < ( ) > :: None ;
151
159
let response = self
152
160
. transport
153
- . send ( method, & path, headers, query_string. as_ref ( ) , body)
161
+ . send ( method, & path, headers, query_string. as_ref ( ) , body, timeout )
154
162
. await ?;
155
163
Ok ( response)
156
164
}
@@ -186,6 +194,7 @@ pub struct AsyncSearchGet<'a, 'b> {
186
194
human : Option < bool > ,
187
195
keep_alive : Option < & ' b str > ,
188
196
pretty : Option < bool > ,
197
+ request_timeout : Option < Duration > ,
189
198
source : Option < & ' b str > ,
190
199
typed_keys : Option < bool > ,
191
200
wait_for_completion_timeout : Option < & ' b str > ,
@@ -203,6 +212,7 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> {
203
212
human : None ,
204
213
keep_alive : None ,
205
214
pretty : None ,
215
+ request_timeout : None ,
206
216
source : None ,
207
217
typed_keys : None ,
208
218
wait_for_completion_timeout : None ,
@@ -238,6 +248,11 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> {
238
248
self . pretty = Some ( pretty) ;
239
249
self
240
250
}
251
+ #[ doc = "Sets a request timeout for this API call.\n \n The timeout is applied from when the request starts connecting until the response body has finished." ]
252
+ pub fn request_timeout ( mut self , timeout : Duration ) -> Self {
253
+ self . request_timeout = Some ( timeout) ;
254
+ self
255
+ }
241
256
#[ doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests." ]
242
257
pub fn source ( mut self , source : & ' b str ) -> Self {
243
258
self . source = Some ( source) ;
@@ -258,6 +273,7 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> {
258
273
let path = self . parts . url ( ) ;
259
274
let method = Method :: Get ;
260
275
let headers = self . headers ;
276
+ let timeout = self . request_timeout ;
261
277
let query_string = {
262
278
#[ serde_with:: skip_serializing_none]
263
279
#[ derive( Serialize ) ]
@@ -297,7 +313,7 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> {
297
313
let body = Option :: < ( ) > :: None ;
298
314
let response = self
299
315
. transport
300
- . send ( method, & path, headers, query_string. as_ref ( ) , body)
316
+ . send ( method, & path, headers, query_string. as_ref ( ) , body, timeout )
301
317
. await ?;
302
318
Ok ( response)
303
319
}
@@ -362,6 +378,7 @@ pub struct AsyncSearchSubmit<'a, 'b, B> {
362
378
pretty : Option < bool > ,
363
379
q : Option < & ' b str > ,
364
380
request_cache : Option < bool > ,
381
+ request_timeout : Option < Duration > ,
365
382
routing : Option < & ' b [ & ' b str ] > ,
366
383
search_type : Option < SearchType > ,
367
384
seq_no_primary_term : Option < bool > ,
@@ -421,6 +438,7 @@ where
421
438
pretty : None ,
422
439
q : None ,
423
440
request_cache : None ,
441
+ request_timeout : None ,
424
442
routing : None ,
425
443
search_type : None ,
426
444
seq_no_primary_term : None ,
@@ -519,6 +537,7 @@ where
519
537
pretty : self . pretty ,
520
538
q : self . q ,
521
539
request_cache : self . request_cache ,
540
+ request_timeout : self . request_timeout ,
522
541
routing : self . routing ,
523
542
search_type : self . search_type ,
524
543
seq_no_primary_term : self . seq_no_primary_term ,
@@ -640,6 +659,11 @@ where
640
659
self . request_cache = Some ( request_cache) ;
641
660
self
642
661
}
662
+ #[ doc = "Sets a request timeout for this API call.\n \n The timeout is applied from when the request starts connecting until the response body has finished." ]
663
+ pub fn request_timeout ( mut self , timeout : Duration ) -> Self {
664
+ self . request_timeout = Some ( timeout) ;
665
+ self
666
+ }
643
667
#[ doc = "A comma-separated list of specific routing values" ]
644
668
pub fn routing ( mut self , routing : & ' b [ & ' b str ] ) -> Self {
645
669
self . routing = Some ( routing) ;
@@ -740,6 +764,7 @@ where
740
764
let path = self . parts . url ( ) ;
741
765
let method = Method :: Post ;
742
766
let headers = self . headers ;
767
+ let timeout = self . request_timeout ;
743
768
let query_string = {
744
769
#[ serde_with:: skip_serializing_none]
745
770
#[ derive( Serialize ) ]
@@ -914,7 +939,7 @@ where
914
939
let body = self . body ;
915
940
let response = self
916
941
. transport
917
- . send ( method, & path, headers, query_string. as_ref ( ) , body)
942
+ . send ( method, & path, headers, query_string. as_ref ( ) , body, timeout )
918
943
. await ?;
919
944
Ok ( response)
920
945
}
0 commit comments