1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteMqStreamByNameError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteMqStreamByNameMessageBySeqError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteMqStreamByStreamConsumerByNameError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetMqHealthError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetMqInfoError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetMqStreamError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetMqStreamByNameError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetMqStreamByNameMessageError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetMqStreamByStreamConsumerError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetMqStreamByStreamConsumerByNameError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostMqStreamError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PostMqStreamByNamePurgeError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PostMqStreamByStreamConsumerError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PostMqStreamByStreamConsumerByNameNextError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PutMqStreamByNameError {
120 UnknownValue(serde_json::Value),
121}
122
123
124pub async fn delete_mq_stream_by_name(configuration: &configuration::Configuration, name: &str) -> Result<(), Error<DeleteMqStreamByNameError>> {
126 let p_name = name;
128
129 let uri_str = format!("{}/v1/mq/stream/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
130 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
131
132 if let Some(ref user_agent) = configuration.user_agent {
133 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
134 }
135 if let Some(ref token) = configuration.bearer_access_token {
136 req_builder = req_builder.bearer_auth(token.to_owned());
137 };
138
139 let req = req_builder.build()?;
140 let resp = configuration.client.execute(req).await?;
141
142 let status = resp.status();
143
144 if !status.is_client_error() && !status.is_server_error() {
145 Ok(())
146 } else {
147 let content = resp.text().await?;
148 let entity: Option<DeleteMqStreamByNameError> = serde_json::from_str(&content).ok();
149 Err(Error::ResponseError(ResponseContent { status, content, entity }))
150 }
151}
152
153pub async fn delete_mq_stream_by_name_message_by_seq(configuration: &configuration::Configuration, name: &str, seq: i32) -> Result<(), Error<DeleteMqStreamByNameMessageBySeqError>> {
155 let p_name = name;
157 let p_seq = seq;
158
159 let uri_str = format!("{}/v1/mq/stream/{name}/message/{seq}", configuration.base_path, name=crate::apis::urlencode(p_name), seq=p_seq);
160 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
161
162 if let Some(ref user_agent) = configuration.user_agent {
163 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
164 }
165 if let Some(ref token) = configuration.bearer_access_token {
166 req_builder = req_builder.bearer_auth(token.to_owned());
167 };
168
169 let req = req_builder.build()?;
170 let resp = configuration.client.execute(req).await?;
171
172 let status = resp.status();
173
174 if !status.is_client_error() && !status.is_server_error() {
175 Ok(())
176 } else {
177 let content = resp.text().await?;
178 let entity: Option<DeleteMqStreamByNameMessageBySeqError> = serde_json::from_str(&content).ok();
179 Err(Error::ResponseError(ResponseContent { status, content, entity }))
180 }
181}
182
183pub async fn delete_mq_stream_by_stream_consumer_by_name(configuration: &configuration::Configuration, stream: &str, name: &str) -> Result<(), Error<DeleteMqStreamByStreamConsumerByNameError>> {
185 let p_stream = stream;
187 let p_name = name;
188
189 let uri_str = format!("{}/v1/mq/stream/{stream}/consumer/{name}", configuration.base_path, stream=crate::apis::urlencode(p_stream), name=crate::apis::urlencode(p_name));
190 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
191
192 if let Some(ref user_agent) = configuration.user_agent {
193 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
194 }
195 if let Some(ref token) = configuration.bearer_access_token {
196 req_builder = req_builder.bearer_auth(token.to_owned());
197 };
198
199 let req = req_builder.build()?;
200 let resp = configuration.client.execute(req).await?;
201
202 let status = resp.status();
203
204 if !status.is_client_error() && !status.is_server_error() {
205 Ok(())
206 } else {
207 let content = resp.text().await?;
208 let entity: Option<DeleteMqStreamByStreamConsumerByNameError> = serde_json::from_str(&content).ok();
209 Err(Error::ResponseError(ResponseContent { status, content, entity }))
210 }
211}
212
213pub async fn get_mq_health(configuration: &configuration::Configuration, ) -> Result<models::Health, Error<GetMqHealthError>> {
215
216 let uri_str = format!("{}/v1/mq/health", configuration.base_path);
217 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
218
219 if let Some(ref user_agent) = configuration.user_agent {
220 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
221 }
222 if let Some(ref token) = configuration.bearer_access_token {
223 req_builder = req_builder.bearer_auth(token.to_owned());
224 };
225
226 let req = req_builder.build()?;
227 let resp = configuration.client.execute(req).await?;
228
229 let status = resp.status();
230 let content_type = resp
231 .headers()
232 .get("content-type")
233 .and_then(|v| v.to_str().ok())
234 .unwrap_or("application/octet-stream");
235 let content_type = super::ContentType::from(content_type);
236
237 if !status.is_client_error() && !status.is_server_error() {
238 let content = resp.text().await?;
239 match content_type {
240 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
241 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Health`"))),
242 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Health`")))),
243 }
244 } else {
245 let content = resp.text().await?;
246 let entity: Option<GetMqHealthError> = serde_json::from_str(&content).ok();
247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
248 }
249}
250
251pub async fn get_mq_info(configuration: &configuration::Configuration, ) -> Result<models::InfoOut, Error<GetMqInfoError>> {
253
254 let uri_str = format!("{}/v1/mq/info", configuration.base_path);
255 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
256
257 if let Some(ref user_agent) = configuration.user_agent {
258 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
259 }
260 if let Some(ref token) = configuration.bearer_access_token {
261 req_builder = req_builder.bearer_auth(token.to_owned());
262 };
263
264 let req = req_builder.build()?;
265 let resp = configuration.client.execute(req).await?;
266
267 let status = resp.status();
268 let content_type = resp
269 .headers()
270 .get("content-type")
271 .and_then(|v| v.to_str().ok())
272 .unwrap_or("application/octet-stream");
273 let content_type = super::ContentType::from(content_type);
274
275 if !status.is_client_error() && !status.is_server_error() {
276 let content = resp.text().await?;
277 match content_type {
278 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
279 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InfoOut`"))),
280 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::InfoOut`")))),
281 }
282 } else {
283 let content = resp.text().await?;
284 let entity: Option<GetMqInfoError> = serde_json::from_str(&content).ok();
285 Err(Error::ResponseError(ResponseContent { status, content, entity }))
286 }
287}
288
289pub async fn get_mq_stream(configuration: &configuration::Configuration, limit: Option<i32>, offset: Option<i32>) -> Result<models::Streams, Error<GetMqStreamError>> {
291 let p_limit = limit;
293 let p_offset = offset;
294
295 let uri_str = format!("{}/v1/mq/stream", configuration.base_path);
296 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
297
298 if let Some(ref param_value) = p_limit {
299 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
300 }
301 if let Some(ref param_value) = p_offset {
302 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
303 }
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307 if let Some(ref token) = configuration.bearer_access_token {
308 req_builder = req_builder.bearer_auth(token.to_owned());
309 };
310
311 let req = req_builder.build()?;
312 let resp = configuration.client.execute(req).await?;
313
314 let status = resp.status();
315 let content_type = resp
316 .headers()
317 .get("content-type")
318 .and_then(|v| v.to_str().ok())
319 .unwrap_or("application/octet-stream");
320 let content_type = super::ContentType::from(content_type);
321
322 if !status.is_client_error() && !status.is_server_error() {
323 let content = resp.text().await?;
324 match content_type {
325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Streams`"))),
327 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Streams`")))),
328 }
329 } else {
330 let content = resp.text().await?;
331 let entity: Option<GetMqStreamError> = serde_json::from_str(&content).ok();
332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
333 }
334}
335
336pub async fn get_mq_stream_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::Stream, Error<GetMqStreamByNameError>> {
338 let p_name = name;
340
341 let uri_str = format!("{}/v1/mq/stream/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
342 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
343
344 if let Some(ref user_agent) = configuration.user_agent {
345 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346 }
347 if let Some(ref token) = configuration.bearer_access_token {
348 req_builder = req_builder.bearer_auth(token.to_owned());
349 };
350
351 let req = req_builder.build()?;
352 let resp = configuration.client.execute(req).await?;
353
354 let status = resp.status();
355 let content_type = resp
356 .headers()
357 .get("content-type")
358 .and_then(|v| v.to_str().ok())
359 .unwrap_or("application/octet-stream");
360 let content_type = super::ContentType::from(content_type);
361
362 if !status.is_client_error() && !status.is_server_error() {
363 let content = resp.text().await?;
364 match content_type {
365 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
366 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Stream`"))),
367 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Stream`")))),
368 }
369 } else {
370 let content = resp.text().await?;
371 let entity: Option<GetMqStreamByNameError> = serde_json::from_str(&content).ok();
372 Err(Error::ResponseError(ResponseContent { status, content, entity }))
373 }
374}
375
376pub async fn get_mq_stream_by_name_message(configuration: &configuration::Configuration, name: &str, seq: Option<i32>, last_by_subject: Option<&str>, next_by_subject: Option<&str>, limit: Option<i32>) -> Result<models::ReadOut, Error<GetMqStreamByNameMessageError>> {
378 let p_name = name;
380 let p_seq = seq;
381 let p_last_by_subject = last_by_subject;
382 let p_next_by_subject = next_by_subject;
383 let p_limit = limit;
384
385 let uri_str = format!("{}/v1/mq/stream/{name}/message", configuration.base_path, name=crate::apis::urlencode(p_name));
386 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
387
388 if let Some(ref param_value) = p_seq {
389 req_builder = req_builder.query(&[("seq", ¶m_value.to_string())]);
390 }
391 if let Some(ref param_value) = p_last_by_subject {
392 req_builder = req_builder.query(&[("last_by_subject", ¶m_value.to_string())]);
393 }
394 if let Some(ref param_value) = p_next_by_subject {
395 req_builder = req_builder.query(&[("next_by_subject", ¶m_value.to_string())]);
396 }
397 if let Some(ref param_value) = p_limit {
398 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
399 }
400 if let Some(ref user_agent) = configuration.user_agent {
401 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
402 }
403 if let Some(ref token) = configuration.bearer_access_token {
404 req_builder = req_builder.bearer_auth(token.to_owned());
405 };
406
407 let req = req_builder.build()?;
408 let resp = configuration.client.execute(req).await?;
409
410 let status = resp.status();
411 let content_type = resp
412 .headers()
413 .get("content-type")
414 .and_then(|v| v.to_str().ok())
415 .unwrap_or("application/octet-stream");
416 let content_type = super::ContentType::from(content_type);
417
418 if !status.is_client_error() && !status.is_server_error() {
419 let content = resp.text().await?;
420 match content_type {
421 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
422 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReadOut`"))),
423 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReadOut`")))),
424 }
425 } else {
426 let content = resp.text().await?;
427 let entity: Option<GetMqStreamByNameMessageError> = serde_json::from_str(&content).ok();
428 Err(Error::ResponseError(ResponseContent { status, content, entity }))
429 }
430}
431
432pub async fn get_mq_stream_by_stream_consumer(configuration: &configuration::Configuration, stream: &str, limit: Option<i32>, offset: Option<i32>) -> Result<models::PickOut, Error<GetMqStreamByStreamConsumerError>> {
434 let p_stream = stream;
436 let p_limit = limit;
437 let p_offset = offset;
438
439 let uri_str = format!("{}/v1/mq/stream/{stream}/consumer", configuration.base_path, stream=crate::apis::urlencode(p_stream));
440 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
441
442 if let Some(ref param_value) = p_limit {
443 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
444 }
445 if let Some(ref param_value) = p_offset {
446 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
447 }
448 if let Some(ref user_agent) = configuration.user_agent {
449 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
450 }
451 if let Some(ref token) = configuration.bearer_access_token {
452 req_builder = req_builder.bearer_auth(token.to_owned());
453 };
454
455 let req = req_builder.build()?;
456 let resp = configuration.client.execute(req).await?;
457
458 let status = resp.status();
459 let content_type = resp
460 .headers()
461 .get("content-type")
462 .and_then(|v| v.to_str().ok())
463 .unwrap_or("application/octet-stream");
464 let content_type = super::ContentType::from(content_type);
465
466 if !status.is_client_error() && !status.is_server_error() {
467 let content = resp.text().await?;
468 match content_type {
469 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
470 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PickOut`"))),
471 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PickOut`")))),
472 }
473 } else {
474 let content = resp.text().await?;
475 let entity: Option<GetMqStreamByStreamConsumerError> = serde_json::from_str(&content).ok();
476 Err(Error::ResponseError(ResponseContent { status, content, entity }))
477 }
478}
479
480pub async fn get_mq_stream_by_stream_consumer_by_name(configuration: &configuration::Configuration, stream: &str, name: &str) -> Result<models::Consumer, Error<GetMqStreamByStreamConsumerByNameError>> {
482 let p_stream = stream;
484 let p_name = name;
485
486 let uri_str = format!("{}/v1/mq/stream/{stream}/consumer/{name}", configuration.base_path, stream=crate::apis::urlencode(p_stream), name=crate::apis::urlencode(p_name));
487 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
488
489 if let Some(ref user_agent) = configuration.user_agent {
490 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
491 }
492 if let Some(ref token) = configuration.bearer_access_token {
493 req_builder = req_builder.bearer_auth(token.to_owned());
494 };
495
496 let req = req_builder.build()?;
497 let resp = configuration.client.execute(req).await?;
498
499 let status = resp.status();
500 let content_type = resp
501 .headers()
502 .get("content-type")
503 .and_then(|v| v.to_str().ok())
504 .unwrap_or("application/octet-stream");
505 let content_type = super::ContentType::from(content_type);
506
507 if !status.is_client_error() && !status.is_server_error() {
508 let content = resp.text().await?;
509 match content_type {
510 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
511 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Consumer`"))),
512 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Consumer`")))),
513 }
514 } else {
515 let content = resp.text().await?;
516 let entity: Option<GetMqStreamByStreamConsumerByNameError> = serde_json::from_str(&content).ok();
517 Err(Error::ResponseError(ResponseContent { status, content, entity }))
518 }
519}
520
521pub async fn post_mq_stream(configuration: &configuration::Configuration, config: models::Config) -> Result<models::Stream, Error<PostMqStreamError>> {
523 let p_config = config;
525
526 let uri_str = format!("{}/v1/mq/stream", configuration.base_path);
527 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
528
529 if let Some(ref user_agent) = configuration.user_agent {
530 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
531 }
532 if let Some(ref token) = configuration.bearer_access_token {
533 req_builder = req_builder.bearer_auth(token.to_owned());
534 };
535 req_builder = req_builder.json(&p_config);
536
537 let req = req_builder.build()?;
538 let resp = configuration.client.execute(req).await?;
539
540 let status = resp.status();
541 let content_type = resp
542 .headers()
543 .get("content-type")
544 .and_then(|v| v.to_str().ok())
545 .unwrap_or("application/octet-stream");
546 let content_type = super::ContentType::from(content_type);
547
548 if !status.is_client_error() && !status.is_server_error() {
549 let content = resp.text().await?;
550 match content_type {
551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Stream`"))),
553 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Stream`")))),
554 }
555 } else {
556 let content = resp.text().await?;
557 let entity: Option<PostMqStreamError> = serde_json::from_str(&content).ok();
558 Err(Error::ResponseError(ResponseContent { status, content, entity }))
559 }
560}
561
562pub async fn post_mq_stream_by_name_purge(configuration: &configuration::Configuration, name: &str, purge: models::Purge) -> Result<models::PurgeOut, Error<PostMqStreamByNamePurgeError>> {
564 let p_name = name;
566 let p_purge = purge;
567
568 let uri_str = format!("{}/v1/mq/stream/{name}/purge", configuration.base_path, name=crate::apis::urlencode(p_name));
569 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
570
571 if let Some(ref user_agent) = configuration.user_agent {
572 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
573 }
574 if let Some(ref token) = configuration.bearer_access_token {
575 req_builder = req_builder.bearer_auth(token.to_owned());
576 };
577 req_builder = req_builder.json(&p_purge);
578
579 let req = req_builder.build()?;
580 let resp = configuration.client.execute(req).await?;
581
582 let status = resp.status();
583 let content_type = resp
584 .headers()
585 .get("content-type")
586 .and_then(|v| v.to_str().ok())
587 .unwrap_or("application/octet-stream");
588 let content_type = super::ContentType::from(content_type);
589
590 if !status.is_client_error() && !status.is_server_error() {
591 let content = resp.text().await?;
592 match content_type {
593 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
594 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PurgeOut`"))),
595 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PurgeOut`")))),
596 }
597 } else {
598 let content = resp.text().await?;
599 let entity: Option<PostMqStreamByNamePurgeError> = serde_json::from_str(&content).ok();
600 Err(Error::ResponseError(ResponseContent { status, content, entity }))
601 }
602}
603
604pub async fn post_mq_stream_by_stream_consumer(configuration: &configuration::Configuration, stream: &str, make_in: models::MakeIn) -> Result<models::Consumer, Error<PostMqStreamByStreamConsumerError>> {
606 let p_stream = stream;
608 let p_make_in = make_in;
609
610 let uri_str = format!("{}/v1/mq/stream/{stream}/consumer", configuration.base_path, stream=crate::apis::urlencode(p_stream));
611 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
612
613 if let Some(ref user_agent) = configuration.user_agent {
614 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
615 }
616 if let Some(ref token) = configuration.bearer_access_token {
617 req_builder = req_builder.bearer_auth(token.to_owned());
618 };
619 req_builder = req_builder.json(&p_make_in);
620
621 let req = req_builder.build()?;
622 let resp = configuration.client.execute(req).await?;
623
624 let status = resp.status();
625 let content_type = resp
626 .headers()
627 .get("content-type")
628 .and_then(|v| v.to_str().ok())
629 .unwrap_or("application/octet-stream");
630 let content_type = super::ContentType::from(content_type);
631
632 if !status.is_client_error() && !status.is_server_error() {
633 let content = resp.text().await?;
634 match content_type {
635 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
636 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Consumer`"))),
637 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Consumer`")))),
638 }
639 } else {
640 let content = resp.text().await?;
641 let entity: Option<PostMqStreamByStreamConsumerError> = serde_json::from_str(&content).ok();
642 Err(Error::ResponseError(ResponseContent { status, content, entity }))
643 }
644}
645
646pub async fn post_mq_stream_by_stream_consumer_by_name_next(configuration: &configuration::Configuration, stream: &str, name: &str, next_in: models::NextIn) -> Result<models::ReadOut, Error<PostMqStreamByStreamConsumerByNameNextError>> {
648 let p_stream = stream;
650 let p_name = name;
651 let p_next_in = next_in;
652
653 let uri_str = format!("{}/v1/mq/stream/{stream}/consumer/{name}/next", configuration.base_path, stream=crate::apis::urlencode(p_stream), name=crate::apis::urlencode(p_name));
654 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
655
656 if let Some(ref user_agent) = configuration.user_agent {
657 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
658 }
659 if let Some(ref token) = configuration.bearer_access_token {
660 req_builder = req_builder.bearer_auth(token.to_owned());
661 };
662 req_builder = req_builder.json(&p_next_in);
663
664 let req = req_builder.build()?;
665 let resp = configuration.client.execute(req).await?;
666
667 let status = resp.status();
668 let content_type = resp
669 .headers()
670 .get("content-type")
671 .and_then(|v| v.to_str().ok())
672 .unwrap_or("application/octet-stream");
673 let content_type = super::ContentType::from(content_type);
674
675 if !status.is_client_error() && !status.is_server_error() {
676 let content = resp.text().await?;
677 match content_type {
678 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
679 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReadOut`"))),
680 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReadOut`")))),
681 }
682 } else {
683 let content = resp.text().await?;
684 let entity: Option<PostMqStreamByStreamConsumerByNameNextError> = serde_json::from_str(&content).ok();
685 Err(Error::ResponseError(ResponseContent { status, content, entity }))
686 }
687}
688
689pub async fn put_mq_stream_by_name(configuration: &configuration::Configuration, name: &str, config: models::Config) -> Result<models::Stream, Error<PutMqStreamByNameError>> {
691 let p_name = name;
693 let p_config = config;
694
695 let uri_str = format!("{}/v1/mq/stream/{name}", configuration.base_path, name=crate::apis::urlencode(p_name));
696 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
697
698 if let Some(ref user_agent) = configuration.user_agent {
699 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
700 }
701 if let Some(ref token) = configuration.bearer_access_token {
702 req_builder = req_builder.bearer_auth(token.to_owned());
703 };
704 req_builder = req_builder.json(&p_config);
705
706 let req = req_builder.build()?;
707 let resp = configuration.client.execute(req).await?;
708
709 let status = resp.status();
710 let content_type = resp
711 .headers()
712 .get("content-type")
713 .and_then(|v| v.to_str().ok())
714 .unwrap_or("application/octet-stream");
715 let content_type = super::ContentType::from(content_type);
716
717 if !status.is_client_error() && !status.is_server_error() {
718 let content = resp.text().await?;
719 match content_type {
720 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
721 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Stream`"))),
722 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Stream`")))),
723 }
724 } else {
725 let content = resp.text().await?;
726 let entity: Option<PutMqStreamByNameError> = serde_json::from_str(&content).ok();
727 Err(Error::ResponseError(ResponseContent { status, content, entity }))
728 }
729}
730