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 DeleteMarketingAudiencesByIdError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteMarketingCalendarByIdError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteMarketingCampaignsByIdError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteMarketingSuppressionsError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetMarketingAudiencesError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetMarketingAudiencesByIdError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetMarketingAudiencesByIdPreviewError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetMarketingCalendarError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetMarketingCalendarByIdError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetMarketingCampaignsError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetMarketingCampaignsByIdError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetMarketingPromosError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetMarketingPromosByCodeEligibilityError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetMarketingPromosByCodeRedemptionError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetMarketingSequencesError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetMarketingSequencesByIdError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetMarketingSequencesByIdEnrollmentsError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetMarketingSequencesByIdStepsError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetMarketingSummaryError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetMarketingSuppressionsError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetMarketingUnsubscribeError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PostMarketingAudiencesError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum PostMarketingCalendarError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum PostMarketingCalendarByIdPublishError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum PostMarketingCampaignsError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum PostMarketingCampaignsByIdScheduleError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum PostMarketingPromosByCodeRedeemError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum PostMarketingSequencesError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PostMarketingSequencesByIdEnrollError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum PostMarketingSequencesByIdEnrollmentsByEidCancelError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum PostMarketingSequencesByIdStatusError {
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum PostMarketingSequencesByIdStepsError {
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum PostMarketingSuppressionsError {
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum PutMarketingCalendarByIdError {
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum PutMarketingCampaignsByIdError {
260 UnknownValue(serde_json::Value),
261}
262
263
264pub async fn delete_marketing_audiences_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteMarketingAudiencesByIdError>> {
266 let p_id = id;
268
269 let uri_str = format!("{}/v1/marketing/audiences/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
270 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
271
272 if let Some(ref user_agent) = configuration.user_agent {
273 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
274 }
275 if let Some(ref token) = configuration.bearer_access_token {
276 req_builder = req_builder.bearer_auth(token.to_owned());
277 };
278
279 let req = req_builder.build()?;
280 let resp = configuration.client.execute(req).await?;
281
282 let status = resp.status();
283
284 if !status.is_client_error() && !status.is_server_error() {
285 Ok(())
286 } else {
287 let content = resp.text().await?;
288 let entity: Option<DeleteMarketingAudiencesByIdError> = serde_json::from_str(&content).ok();
289 Err(Error::ResponseError(ResponseContent { status, content, entity }))
290 }
291}
292
293pub async fn delete_marketing_calendar_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteMarketingCalendarByIdError>> {
295 let p_id = id;
297
298 let uri_str = format!("{}/v1/marketing/calendar/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
299 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
300
301 if let Some(ref user_agent) = configuration.user_agent {
302 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
303 }
304 if let Some(ref token) = configuration.bearer_access_token {
305 req_builder = req_builder.bearer_auth(token.to_owned());
306 };
307
308 let req = req_builder.build()?;
309 let resp = configuration.client.execute(req).await?;
310
311 let status = resp.status();
312
313 if !status.is_client_error() && !status.is_server_error() {
314 Ok(())
315 } else {
316 let content = resp.text().await?;
317 let entity: Option<DeleteMarketingCalendarByIdError> = serde_json::from_str(&content).ok();
318 Err(Error::ResponseError(ResponseContent { status, content, entity }))
319 }
320}
321
322pub async fn delete_marketing_campaigns_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteMarketingCampaignsByIdError>> {
324 let p_id = id;
326
327 let uri_str = format!("{}/v1/marketing/campaigns/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
328 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
329
330 if let Some(ref user_agent) = configuration.user_agent {
331 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
332 }
333 if let Some(ref token) = configuration.bearer_access_token {
334 req_builder = req_builder.bearer_auth(token.to_owned());
335 };
336
337 let req = req_builder.build()?;
338 let resp = configuration.client.execute(req).await?;
339
340 let status = resp.status();
341
342 if !status.is_client_error() && !status.is_server_error() {
343 Ok(())
344 } else {
345 let content = resp.text().await?;
346 let entity: Option<DeleteMarketingCampaignsByIdError> = serde_json::from_str(&content).ok();
347 Err(Error::ResponseError(ResponseContent { status, content, entity }))
348 }
349}
350
351pub async fn delete_marketing_suppressions(configuration: &configuration::Configuration, channel: Option<&str>, address: Option<&str>, reason: Option<&str>, created_at: Option<i32>) -> Result<(), Error<DeleteMarketingSuppressionsError>> {
353 let p_channel = channel;
355 let p_address = address;
356 let p_reason = reason;
357 let p_created_at = created_at;
358
359 let uri_str = format!("{}/v1/marketing/suppressions", configuration.base_path);
360 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
361
362 if let Some(ref param_value) = p_channel {
363 req_builder = req_builder.query(&[("channel", ¶m_value.to_string())]);
364 }
365 if let Some(ref param_value) = p_address {
366 req_builder = req_builder.query(&[("address", ¶m_value.to_string())]);
367 }
368 if let Some(ref param_value) = p_reason {
369 req_builder = req_builder.query(&[("reason", ¶m_value.to_string())]);
370 }
371 if let Some(ref param_value) = p_created_at {
372 req_builder = req_builder.query(&[("createdAt", ¶m_value.to_string())]);
373 }
374 if let Some(ref user_agent) = configuration.user_agent {
375 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
376 }
377 if let Some(ref token) = configuration.bearer_access_token {
378 req_builder = req_builder.bearer_auth(token.to_owned());
379 };
380
381 let req = req_builder.build()?;
382 let resp = configuration.client.execute(req).await?;
383
384 let status = resp.status();
385
386 if !status.is_client_error() && !status.is_server_error() {
387 Ok(())
388 } else {
389 let content = resp.text().await?;
390 let entity: Option<DeleteMarketingSuppressionsError> = serde_json::from_str(&content).ok();
391 Err(Error::ResponseError(ResponseContent { status, content, entity }))
392 }
393}
394
395pub async fn get_marketing_audiences(configuration: &configuration::Configuration, limit: Option<i32>) -> Result<models::AudienceList, Error<GetMarketingAudiencesError>> {
397 let p_limit = limit;
399
400 let uri_str = format!("{}/v1/marketing/audiences", configuration.base_path);
401 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
402
403 if let Some(ref param_value) = p_limit {
404 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
405 }
406 if let Some(ref user_agent) = configuration.user_agent {
407 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
408 }
409 if let Some(ref token) = configuration.bearer_access_token {
410 req_builder = req_builder.bearer_auth(token.to_owned());
411 };
412
413 let req = req_builder.build()?;
414 let resp = configuration.client.execute(req).await?;
415
416 let status = resp.status();
417 let content_type = resp
418 .headers()
419 .get("content-type")
420 .and_then(|v| v.to_str().ok())
421 .unwrap_or("application/octet-stream");
422 let content_type = super::ContentType::from(content_type);
423
424 if !status.is_client_error() && !status.is_server_error() {
425 let content = resp.text().await?;
426 match content_type {
427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AudienceList`"))),
429 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::AudienceList`")))),
430 }
431 } else {
432 let content = resp.text().await?;
433 let entity: Option<GetMarketingAudiencesError> = serde_json::from_str(&content).ok();
434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
435 }
436}
437
438pub async fn get_marketing_audiences_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::Audience, Error<GetMarketingAudiencesByIdError>> {
440 let p_id = id;
442
443 let uri_str = format!("{}/v1/marketing/audiences/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
444 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
445
446 if let Some(ref user_agent) = configuration.user_agent {
447 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
448 }
449 if let Some(ref token) = configuration.bearer_access_token {
450 req_builder = req_builder.bearer_auth(token.to_owned());
451 };
452
453 let req = req_builder.build()?;
454 let resp = configuration.client.execute(req).await?;
455
456 let status = resp.status();
457 let content_type = resp
458 .headers()
459 .get("content-type")
460 .and_then(|v| v.to_str().ok())
461 .unwrap_or("application/octet-stream");
462 let content_type = super::ContentType::from(content_type);
463
464 if !status.is_client_error() && !status.is_server_error() {
465 let content = resp.text().await?;
466 match content_type {
467 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
468 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Audience`"))),
469 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::Audience`")))),
470 }
471 } else {
472 let content = resp.text().await?;
473 let entity: Option<GetMarketingAudiencesByIdError> = serde_json::from_str(&content).ok();
474 Err(Error::ResponseError(ResponseContent { status, content, entity }))
475 }
476}
477
478pub async fn get_marketing_audiences_by_id_preview(configuration: &configuration::Configuration, id: &str) -> Result<models::AudiencePreview, Error<GetMarketingAudiencesByIdPreviewError>> {
480 let p_id = id;
482
483 let uri_str = format!("{}/v1/marketing/audiences/{id}/preview", configuration.base_path, id=crate::apis::urlencode(p_id));
484 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
485
486 if let Some(ref user_agent) = configuration.user_agent {
487 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
488 }
489 if let Some(ref token) = configuration.bearer_access_token {
490 req_builder = req_builder.bearer_auth(token.to_owned());
491 };
492
493 let req = req_builder.build()?;
494 let resp = configuration.client.execute(req).await?;
495
496 let status = resp.status();
497 let content_type = resp
498 .headers()
499 .get("content-type")
500 .and_then(|v| v.to_str().ok())
501 .unwrap_or("application/octet-stream");
502 let content_type = super::ContentType::from(content_type);
503
504 if !status.is_client_error() && !status.is_server_error() {
505 let content = resp.text().await?;
506 match content_type {
507 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
508 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AudiencePreview`"))),
509 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::AudiencePreview`")))),
510 }
511 } else {
512 let content = resp.text().await?;
513 let entity: Option<GetMarketingAudiencesByIdPreviewError> = serde_json::from_str(&content).ok();
514 Err(Error::ResponseError(ResponseContent { status, content, entity }))
515 }
516}
517
518pub async fn get_marketing_calendar(configuration: &configuration::Configuration, status: Option<&str>, limit: Option<i32>) -> Result<models::PostList, Error<GetMarketingCalendarError>> {
520 let p_status = status;
522 let p_limit = limit;
523
524 let uri_str = format!("{}/v1/marketing/calendar", configuration.base_path);
525 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
526
527 if let Some(ref param_value) = p_status {
528 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
529 }
530 if let Some(ref param_value) = p_limit {
531 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
532 }
533 if let Some(ref user_agent) = configuration.user_agent {
534 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
535 }
536 if let Some(ref token) = configuration.bearer_access_token {
537 req_builder = req_builder.bearer_auth(token.to_owned());
538 };
539
540 let req = req_builder.build()?;
541 let resp = configuration.client.execute(req).await?;
542
543 let status = resp.status();
544 let content_type = resp
545 .headers()
546 .get("content-type")
547 .and_then(|v| v.to_str().ok())
548 .unwrap_or("application/octet-stream");
549 let content_type = super::ContentType::from(content_type);
550
551 if !status.is_client_error() && !status.is_server_error() {
552 let content = resp.text().await?;
553 match content_type {
554 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
555 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PostList`"))),
556 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::PostList`")))),
557 }
558 } else {
559 let content = resp.text().await?;
560 let entity: Option<GetMarketingCalendarError> = serde_json::from_str(&content).ok();
561 Err(Error::ResponseError(ResponseContent { status, content, entity }))
562 }
563}
564
565pub async fn get_marketing_calendar_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::CalendarPost, Error<GetMarketingCalendarByIdError>> {
567 let p_id = id;
569
570 let uri_str = format!("{}/v1/marketing/calendar/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
571 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
572
573 if let Some(ref user_agent) = configuration.user_agent {
574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
575 }
576 if let Some(ref token) = configuration.bearer_access_token {
577 req_builder = req_builder.bearer_auth(token.to_owned());
578 };
579
580 let req = req_builder.build()?;
581 let resp = configuration.client.execute(req).await?;
582
583 let status = resp.status();
584 let content_type = resp
585 .headers()
586 .get("content-type")
587 .and_then(|v| v.to_str().ok())
588 .unwrap_or("application/octet-stream");
589 let content_type = super::ContentType::from(content_type);
590
591 if !status.is_client_error() && !status.is_server_error() {
592 let content = resp.text().await?;
593 match content_type {
594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
595 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CalendarPost`"))),
596 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::CalendarPost`")))),
597 }
598 } else {
599 let content = resp.text().await?;
600 let entity: Option<GetMarketingCalendarByIdError> = serde_json::from_str(&content).ok();
601 Err(Error::ResponseError(ResponseContent { status, content, entity }))
602 }
603}
604
605pub async fn get_marketing_campaigns(configuration: &configuration::Configuration, status: Option<&str>, limit: Option<i32>) -> Result<models::CampaignList, Error<GetMarketingCampaignsError>> {
607 let p_status = status;
609 let p_limit = limit;
610
611 let uri_str = format!("{}/v1/marketing/campaigns", configuration.base_path);
612 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
613
614 if let Some(ref param_value) = p_status {
615 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
616 }
617 if let Some(ref param_value) = p_limit {
618 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
619 }
620 if let Some(ref user_agent) = configuration.user_agent {
621 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
622 }
623 if let Some(ref token) = configuration.bearer_access_token {
624 req_builder = req_builder.bearer_auth(token.to_owned());
625 };
626
627 let req = req_builder.build()?;
628 let resp = configuration.client.execute(req).await?;
629
630 let status = resp.status();
631 let content_type = resp
632 .headers()
633 .get("content-type")
634 .and_then(|v| v.to_str().ok())
635 .unwrap_or("application/octet-stream");
636 let content_type = super::ContentType::from(content_type);
637
638 if !status.is_client_error() && !status.is_server_error() {
639 let content = resp.text().await?;
640 match content_type {
641 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
642 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CampaignList`"))),
643 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::CampaignList`")))),
644 }
645 } else {
646 let content = resp.text().await?;
647 let entity: Option<GetMarketingCampaignsError> = serde_json::from_str(&content).ok();
648 Err(Error::ResponseError(ResponseContent { status, content, entity }))
649 }
650}
651
652pub async fn get_marketing_campaigns_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::Campaign, Error<GetMarketingCampaignsByIdError>> {
654 let p_id = id;
656
657 let uri_str = format!("{}/v1/marketing/campaigns/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
658 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
659
660 if let Some(ref user_agent) = configuration.user_agent {
661 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
662 }
663 if let Some(ref token) = configuration.bearer_access_token {
664 req_builder = req_builder.bearer_auth(token.to_owned());
665 };
666
667 let req = req_builder.build()?;
668 let resp = configuration.client.execute(req).await?;
669
670 let status = resp.status();
671 let content_type = resp
672 .headers()
673 .get("content-type")
674 .and_then(|v| v.to_str().ok())
675 .unwrap_or("application/octet-stream");
676 let content_type = super::ContentType::from(content_type);
677
678 if !status.is_client_error() && !status.is_server_error() {
679 let content = resp.text().await?;
680 match content_type {
681 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
682 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Campaign`"))),
683 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::Campaign`")))),
684 }
685 } else {
686 let content = resp.text().await?;
687 let entity: Option<GetMarketingCampaignsByIdError> = serde_json::from_str(&content).ok();
688 Err(Error::ResponseError(ResponseContent { status, content, entity }))
689 }
690}
691
692pub async fn get_marketing_promos(configuration: &configuration::Configuration, ) -> Result<models::PromoList, Error<GetMarketingPromosError>> {
694
695 let uri_str = format!("{}/v1/marketing/promos", configuration.base_path);
696 let mut req_builder = configuration.client.request(reqwest::Method::GET, &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
705 let req = req_builder.build()?;
706 let resp = configuration.client.execute(req).await?;
707
708 let status = resp.status();
709 let content_type = resp
710 .headers()
711 .get("content-type")
712 .and_then(|v| v.to_str().ok())
713 .unwrap_or("application/octet-stream");
714 let content_type = super::ContentType::from(content_type);
715
716 if !status.is_client_error() && !status.is_server_error() {
717 let content = resp.text().await?;
718 match content_type {
719 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
720 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PromoList`"))),
721 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::PromoList`")))),
722 }
723 } else {
724 let content = resp.text().await?;
725 let entity: Option<GetMarketingPromosError> = serde_json::from_str(&content).ok();
726 Err(Error::ResponseError(ResponseContent { status, content, entity }))
727 }
728}
729
730pub async fn get_marketing_promos_by_code_eligibility(configuration: &configuration::Configuration, code: &str, plan: Option<&str>, seats: Option<i32>) -> Result<models::Quote, Error<GetMarketingPromosByCodeEligibilityError>> {
732 let p_code = code;
734 let p_plan = plan;
735 let p_seats = seats;
736
737 let uri_str = format!("{}/v1/marketing/promos/{code}/eligibility", configuration.base_path, code=crate::apis::urlencode(p_code));
738 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
739
740 if let Some(ref param_value) = p_plan {
741 req_builder = req_builder.query(&[("plan", ¶m_value.to_string())]);
742 }
743 if let Some(ref param_value) = p_seats {
744 req_builder = req_builder.query(&[("seats", ¶m_value.to_string())]);
745 }
746 if let Some(ref user_agent) = configuration.user_agent {
747 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
748 }
749 if let Some(ref token) = configuration.bearer_access_token {
750 req_builder = req_builder.bearer_auth(token.to_owned());
751 };
752
753 let req = req_builder.build()?;
754 let resp = configuration.client.execute(req).await?;
755
756 let status = resp.status();
757 let content_type = resp
758 .headers()
759 .get("content-type")
760 .and_then(|v| v.to_str().ok())
761 .unwrap_or("application/octet-stream");
762 let content_type = super::ContentType::from(content_type);
763
764 if !status.is_client_error() && !status.is_server_error() {
765 let content = resp.text().await?;
766 match content_type {
767 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
768 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Quote`"))),
769 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::Quote`")))),
770 }
771 } else {
772 let content = resp.text().await?;
773 let entity: Option<GetMarketingPromosByCodeEligibilityError> = serde_json::from_str(&content).ok();
774 Err(Error::ResponseError(ResponseContent { status, content, entity }))
775 }
776}
777
778pub async fn get_marketing_promos_by_code_redemption(configuration: &configuration::Configuration, code: &str) -> Result<models::Redemption, Error<GetMarketingPromosByCodeRedemptionError>> {
780 let p_code = code;
782
783 let uri_str = format!("{}/v1/marketing/promos/{code}/redemption", configuration.base_path, code=crate::apis::urlencode(p_code));
784 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
785
786 if let Some(ref user_agent) = configuration.user_agent {
787 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
788 }
789 if let Some(ref token) = configuration.bearer_access_token {
790 req_builder = req_builder.bearer_auth(token.to_owned());
791 };
792
793 let req = req_builder.build()?;
794 let resp = configuration.client.execute(req).await?;
795
796 let status = resp.status();
797 let content_type = resp
798 .headers()
799 .get("content-type")
800 .and_then(|v| v.to_str().ok())
801 .unwrap_or("application/octet-stream");
802 let content_type = super::ContentType::from(content_type);
803
804 if !status.is_client_error() && !status.is_server_error() {
805 let content = resp.text().await?;
806 match content_type {
807 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
808 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Redemption`"))),
809 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::Redemption`")))),
810 }
811 } else {
812 let content = resp.text().await?;
813 let entity: Option<GetMarketingPromosByCodeRedemptionError> = serde_json::from_str(&content).ok();
814 Err(Error::ResponseError(ResponseContent { status, content, entity }))
815 }
816}
817
818pub async fn get_marketing_sequences(configuration: &configuration::Configuration, limit: Option<i32>) -> Result<models::SequenceList, Error<GetMarketingSequencesError>> {
820 let p_limit = limit;
822
823 let uri_str = format!("{}/v1/marketing/sequences", configuration.base_path);
824 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
825
826 if let Some(ref param_value) = p_limit {
827 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
828 }
829 if let Some(ref user_agent) = configuration.user_agent {
830 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
831 }
832 if let Some(ref token) = configuration.bearer_access_token {
833 req_builder = req_builder.bearer_auth(token.to_owned());
834 };
835
836 let req = req_builder.build()?;
837 let resp = configuration.client.execute(req).await?;
838
839 let status = resp.status();
840 let content_type = resp
841 .headers()
842 .get("content-type")
843 .and_then(|v| v.to_str().ok())
844 .unwrap_or("application/octet-stream");
845 let content_type = super::ContentType::from(content_type);
846
847 if !status.is_client_error() && !status.is_server_error() {
848 let content = resp.text().await?;
849 match content_type {
850 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
851 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SequenceList`"))),
852 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::SequenceList`")))),
853 }
854 } else {
855 let content = resp.text().await?;
856 let entity: Option<GetMarketingSequencesError> = serde_json::from_str(&content).ok();
857 Err(Error::ResponseError(ResponseContent { status, content, entity }))
858 }
859}
860
861pub async fn get_marketing_sequences_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::SequenceView, Error<GetMarketingSequencesByIdError>> {
863 let p_id = id;
865
866 let uri_str = format!("{}/v1/marketing/sequences/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
867 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
868
869 if let Some(ref user_agent) = configuration.user_agent {
870 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
871 }
872 if let Some(ref token) = configuration.bearer_access_token {
873 req_builder = req_builder.bearer_auth(token.to_owned());
874 };
875
876 let req = req_builder.build()?;
877 let resp = configuration.client.execute(req).await?;
878
879 let status = resp.status();
880 let content_type = resp
881 .headers()
882 .get("content-type")
883 .and_then(|v| v.to_str().ok())
884 .unwrap_or("application/octet-stream");
885 let content_type = super::ContentType::from(content_type);
886
887 if !status.is_client_error() && !status.is_server_error() {
888 let content = resp.text().await?;
889 match content_type {
890 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
891 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SequenceView`"))),
892 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::SequenceView`")))),
893 }
894 } else {
895 let content = resp.text().await?;
896 let entity: Option<GetMarketingSequencesByIdError> = serde_json::from_str(&content).ok();
897 Err(Error::ResponseError(ResponseContent { status, content, entity }))
898 }
899}
900
901pub async fn get_marketing_sequences_by_id_enrollments(configuration: &configuration::Configuration, id: &str, limit: Option<i32>) -> Result<models::EnrollmentList, Error<GetMarketingSequencesByIdEnrollmentsError>> {
903 let p_id = id;
905 let p_limit = limit;
906
907 let uri_str = format!("{}/v1/marketing/sequences/{id}/enrollments", configuration.base_path, id=crate::apis::urlencode(p_id));
908 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
909
910 if let Some(ref param_value) = p_limit {
911 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
912 }
913 if let Some(ref user_agent) = configuration.user_agent {
914 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
915 }
916 if let Some(ref token) = configuration.bearer_access_token {
917 req_builder = req_builder.bearer_auth(token.to_owned());
918 };
919
920 let req = req_builder.build()?;
921 let resp = configuration.client.execute(req).await?;
922
923 let status = resp.status();
924 let content_type = resp
925 .headers()
926 .get("content-type")
927 .and_then(|v| v.to_str().ok())
928 .unwrap_or("application/octet-stream");
929 let content_type = super::ContentType::from(content_type);
930
931 if !status.is_client_error() && !status.is_server_error() {
932 let content = resp.text().await?;
933 match content_type {
934 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
935 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EnrollmentList`"))),
936 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::EnrollmentList`")))),
937 }
938 } else {
939 let content = resp.text().await?;
940 let entity: Option<GetMarketingSequencesByIdEnrollmentsError> = serde_json::from_str(&content).ok();
941 Err(Error::ResponseError(ResponseContent { status, content, entity }))
942 }
943}
944
945pub async fn get_marketing_sequences_by_id_steps(configuration: &configuration::Configuration, id: &str) -> Result<models::StepList, Error<GetMarketingSequencesByIdStepsError>> {
947 let p_id = id;
949
950 let uri_str = format!("{}/v1/marketing/sequences/{id}/steps", configuration.base_path, id=crate::apis::urlencode(p_id));
951 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
952
953 if let Some(ref user_agent) = configuration.user_agent {
954 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
955 }
956 if let Some(ref token) = configuration.bearer_access_token {
957 req_builder = req_builder.bearer_auth(token.to_owned());
958 };
959
960 let req = req_builder.build()?;
961 let resp = configuration.client.execute(req).await?;
962
963 let status = resp.status();
964 let content_type = resp
965 .headers()
966 .get("content-type")
967 .and_then(|v| v.to_str().ok())
968 .unwrap_or("application/octet-stream");
969 let content_type = super::ContentType::from(content_type);
970
971 if !status.is_client_error() && !status.is_server_error() {
972 let content = resp.text().await?;
973 match content_type {
974 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
975 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StepList`"))),
976 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::StepList`")))),
977 }
978 } else {
979 let content = resp.text().await?;
980 let entity: Option<GetMarketingSequencesByIdStepsError> = serde_json::from_str(&content).ok();
981 Err(Error::ResponseError(ResponseContent { status, content, entity }))
982 }
983}
984
985pub async fn get_marketing_summary(configuration: &configuration::Configuration, ) -> Result<models::Summary, Error<GetMarketingSummaryError>> {
987
988 let uri_str = format!("{}/v1/marketing/summary", configuration.base_path);
989 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
990
991 if let Some(ref user_agent) = configuration.user_agent {
992 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
993 }
994 if let Some(ref token) = configuration.bearer_access_token {
995 req_builder = req_builder.bearer_auth(token.to_owned());
996 };
997
998 let req = req_builder.build()?;
999 let resp = configuration.client.execute(req).await?;
1000
1001 let status = resp.status();
1002 let content_type = resp
1003 .headers()
1004 .get("content-type")
1005 .and_then(|v| v.to_str().ok())
1006 .unwrap_or("application/octet-stream");
1007 let content_type = super::ContentType::from(content_type);
1008
1009 if !status.is_client_error() && !status.is_server_error() {
1010 let content = resp.text().await?;
1011 match content_type {
1012 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1013 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Summary`"))),
1014 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::Summary`")))),
1015 }
1016 } else {
1017 let content = resp.text().await?;
1018 let entity: Option<GetMarketingSummaryError> = serde_json::from_str(&content).ok();
1019 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1020 }
1021}
1022
1023pub async fn get_marketing_suppressions(configuration: &configuration::Configuration, limit: Option<i32>) -> Result<models::SuppressionList, Error<GetMarketingSuppressionsError>> {
1025 let p_limit = limit;
1027
1028 let uri_str = format!("{}/v1/marketing/suppressions", configuration.base_path);
1029 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1030
1031 if let Some(ref param_value) = p_limit {
1032 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1033 }
1034 if let Some(ref user_agent) = configuration.user_agent {
1035 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1036 }
1037 if let Some(ref token) = configuration.bearer_access_token {
1038 req_builder = req_builder.bearer_auth(token.to_owned());
1039 };
1040
1041 let req = req_builder.build()?;
1042 let resp = configuration.client.execute(req).await?;
1043
1044 let status = resp.status();
1045 let content_type = resp
1046 .headers()
1047 .get("content-type")
1048 .and_then(|v| v.to_str().ok())
1049 .unwrap_or("application/octet-stream");
1050 let content_type = super::ContentType::from(content_type);
1051
1052 if !status.is_client_error() && !status.is_server_error() {
1053 let content = resp.text().await?;
1054 match content_type {
1055 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1056 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuppressionList`"))),
1057 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::SuppressionList`")))),
1058 }
1059 } else {
1060 let content = resp.text().await?;
1061 let entity: Option<GetMarketingSuppressionsError> = serde_json::from_str(&content).ok();
1062 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1063 }
1064}
1065
1066pub async fn get_marketing_unsubscribe(configuration: &configuration::Configuration, org: Option<&str>, channel: Option<&str>, address: Option<&str>, token: Option<&str>) -> Result<models::Unsubscribed, Error<GetMarketingUnsubscribeError>> {
1068 let p_org = org;
1070 let p_channel = channel;
1071 let p_address = address;
1072 let p_token = token;
1073
1074 let uri_str = format!("{}/v1/marketing/unsubscribe", configuration.base_path);
1075 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1076
1077 if let Some(ref param_value) = p_org {
1078 req_builder = req_builder.query(&[("org", ¶m_value.to_string())]);
1079 }
1080 if let Some(ref param_value) = p_channel {
1081 req_builder = req_builder.query(&[("channel", ¶m_value.to_string())]);
1082 }
1083 if let Some(ref param_value) = p_address {
1084 req_builder = req_builder.query(&[("address", ¶m_value.to_string())]);
1085 }
1086 if let Some(ref param_value) = p_token {
1087 req_builder = req_builder.query(&[("token", ¶m_value.to_string())]);
1088 }
1089 if let Some(ref user_agent) = configuration.user_agent {
1090 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1091 }
1092 if let Some(ref token) = configuration.bearer_access_token {
1093 req_builder = req_builder.bearer_auth(token.to_owned());
1094 };
1095
1096 let req = req_builder.build()?;
1097 let resp = configuration.client.execute(req).await?;
1098
1099 let status = resp.status();
1100 let content_type = resp
1101 .headers()
1102 .get("content-type")
1103 .and_then(|v| v.to_str().ok())
1104 .unwrap_or("application/octet-stream");
1105 let content_type = super::ContentType::from(content_type);
1106
1107 if !status.is_client_error() && !status.is_server_error() {
1108 let content = resp.text().await?;
1109 match content_type {
1110 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1111 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Unsubscribed`"))),
1112 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::Unsubscribed`")))),
1113 }
1114 } else {
1115 let content = resp.text().await?;
1116 let entity: Option<GetMarketingUnsubscribeError> = serde_json::from_str(&content).ok();
1117 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1118 }
1119}
1120
1121pub async fn post_marketing_audiences(configuration: &configuration::Configuration, audience: models::Audience) -> Result<models::Audience, Error<PostMarketingAudiencesError>> {
1123 let p_audience = audience;
1125
1126 let uri_str = format!("{}/v1/marketing/audiences", configuration.base_path);
1127 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1128
1129 if let Some(ref user_agent) = configuration.user_agent {
1130 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1131 }
1132 if let Some(ref token) = configuration.bearer_access_token {
1133 req_builder = req_builder.bearer_auth(token.to_owned());
1134 };
1135 req_builder = req_builder.json(&p_audience);
1136
1137 let req = req_builder.build()?;
1138 let resp = configuration.client.execute(req).await?;
1139
1140 let status = resp.status();
1141 let content_type = resp
1142 .headers()
1143 .get("content-type")
1144 .and_then(|v| v.to_str().ok())
1145 .unwrap_or("application/octet-stream");
1146 let content_type = super::ContentType::from(content_type);
1147
1148 if !status.is_client_error() && !status.is_server_error() {
1149 let content = resp.text().await?;
1150 match content_type {
1151 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1152 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Audience`"))),
1153 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::Audience`")))),
1154 }
1155 } else {
1156 let content = resp.text().await?;
1157 let entity: Option<PostMarketingAudiencesError> = serde_json::from_str(&content).ok();
1158 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1159 }
1160}
1161
1162pub async fn post_marketing_calendar(configuration: &configuration::Configuration, calendar_post: models::CalendarPost) -> Result<models::CalendarPost, Error<PostMarketingCalendarError>> {
1164 let p_calendar_post = calendar_post;
1166
1167 let uri_str = format!("{}/v1/marketing/calendar", configuration.base_path);
1168 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1169
1170 if let Some(ref user_agent) = configuration.user_agent {
1171 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1172 }
1173 if let Some(ref token) = configuration.bearer_access_token {
1174 req_builder = req_builder.bearer_auth(token.to_owned());
1175 };
1176 req_builder = req_builder.json(&p_calendar_post);
1177
1178 let req = req_builder.build()?;
1179 let resp = configuration.client.execute(req).await?;
1180
1181 let status = resp.status();
1182 let content_type = resp
1183 .headers()
1184 .get("content-type")
1185 .and_then(|v| v.to_str().ok())
1186 .unwrap_or("application/octet-stream");
1187 let content_type = super::ContentType::from(content_type);
1188
1189 if !status.is_client_error() && !status.is_server_error() {
1190 let content = resp.text().await?;
1191 match content_type {
1192 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1193 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CalendarPost`"))),
1194 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::CalendarPost`")))),
1195 }
1196 } else {
1197 let content = resp.text().await?;
1198 let entity: Option<PostMarketingCalendarError> = serde_json::from_str(&content).ok();
1199 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1200 }
1201}
1202
1203pub async fn post_marketing_calendar_by_id_publish(configuration: &configuration::Configuration, id: &str) -> Result<models::CalendarPost, Error<PostMarketingCalendarByIdPublishError>> {
1205 let p_id = id;
1207
1208 let uri_str = format!("{}/v1/marketing/calendar/{id}/publish", configuration.base_path, id=crate::apis::urlencode(p_id));
1209 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1210
1211 if let Some(ref user_agent) = configuration.user_agent {
1212 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1213 }
1214 if let Some(ref token) = configuration.bearer_access_token {
1215 req_builder = req_builder.bearer_auth(token.to_owned());
1216 };
1217
1218 let req = req_builder.build()?;
1219 let resp = configuration.client.execute(req).await?;
1220
1221 let status = resp.status();
1222 let content_type = resp
1223 .headers()
1224 .get("content-type")
1225 .and_then(|v| v.to_str().ok())
1226 .unwrap_or("application/octet-stream");
1227 let content_type = super::ContentType::from(content_type);
1228
1229 if !status.is_client_error() && !status.is_server_error() {
1230 let content = resp.text().await?;
1231 match content_type {
1232 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1233 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CalendarPost`"))),
1234 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::CalendarPost`")))),
1235 }
1236 } else {
1237 let content = resp.text().await?;
1238 let entity: Option<PostMarketingCalendarByIdPublishError> = serde_json::from_str(&content).ok();
1239 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1240 }
1241}
1242
1243pub async fn post_marketing_campaigns(configuration: &configuration::Configuration, campaign: models::Campaign) -> Result<models::Campaign, Error<PostMarketingCampaignsError>> {
1245 let p_campaign = campaign;
1247
1248 let uri_str = format!("{}/v1/marketing/campaigns", configuration.base_path);
1249 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1250
1251 if let Some(ref user_agent) = configuration.user_agent {
1252 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1253 }
1254 if let Some(ref token) = configuration.bearer_access_token {
1255 req_builder = req_builder.bearer_auth(token.to_owned());
1256 };
1257 req_builder = req_builder.json(&p_campaign);
1258
1259 let req = req_builder.build()?;
1260 let resp = configuration.client.execute(req).await?;
1261
1262 let status = resp.status();
1263 let content_type = resp
1264 .headers()
1265 .get("content-type")
1266 .and_then(|v| v.to_str().ok())
1267 .unwrap_or("application/octet-stream");
1268 let content_type = super::ContentType::from(content_type);
1269
1270 if !status.is_client_error() && !status.is_server_error() {
1271 let content = resp.text().await?;
1272 match content_type {
1273 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1274 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Campaign`"))),
1275 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::Campaign`")))),
1276 }
1277 } else {
1278 let content = resp.text().await?;
1279 let entity: Option<PostMarketingCampaignsError> = serde_json::from_str(&content).ok();
1280 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1281 }
1282}
1283
1284pub async fn post_marketing_campaigns_by_id_schedule(configuration: &configuration::Configuration, id: &str, schedule_input: models::ScheduleInput) -> Result<models::Campaign, Error<PostMarketingCampaignsByIdScheduleError>> {
1286 let p_id = id;
1288 let p_schedule_input = schedule_input;
1289
1290 let uri_str = format!("{}/v1/marketing/campaigns/{id}/schedule", configuration.base_path, id=crate::apis::urlencode(p_id));
1291 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1292
1293 if let Some(ref user_agent) = configuration.user_agent {
1294 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1295 }
1296 if let Some(ref token) = configuration.bearer_access_token {
1297 req_builder = req_builder.bearer_auth(token.to_owned());
1298 };
1299 req_builder = req_builder.json(&p_schedule_input);
1300
1301 let req = req_builder.build()?;
1302 let resp = configuration.client.execute(req).await?;
1303
1304 let status = resp.status();
1305 let content_type = resp
1306 .headers()
1307 .get("content-type")
1308 .and_then(|v| v.to_str().ok())
1309 .unwrap_or("application/octet-stream");
1310 let content_type = super::ContentType::from(content_type);
1311
1312 if !status.is_client_error() && !status.is_server_error() {
1313 let content = resp.text().await?;
1314 match content_type {
1315 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1316 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Campaign`"))),
1317 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::Campaign`")))),
1318 }
1319 } else {
1320 let content = resp.text().await?;
1321 let entity: Option<PostMarketingCampaignsByIdScheduleError> = serde_json::from_str(&content).ok();
1322 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1323 }
1324}
1325
1326pub async fn post_marketing_promos_by_code_redeem(configuration: &configuration::Configuration, code: &str, redeem_input: models::RedeemInput) -> Result<models::RedeemResult, Error<PostMarketingPromosByCodeRedeemError>> {
1328 let p_code = code;
1330 let p_redeem_input = redeem_input;
1331
1332 let uri_str = format!("{}/v1/marketing/promos/{code}/redeem", configuration.base_path, code=crate::apis::urlencode(p_code));
1333 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1334
1335 if let Some(ref user_agent) = configuration.user_agent {
1336 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1337 }
1338 if let Some(ref token) = configuration.bearer_access_token {
1339 req_builder = req_builder.bearer_auth(token.to_owned());
1340 };
1341 req_builder = req_builder.json(&p_redeem_input);
1342
1343 let req = req_builder.build()?;
1344 let resp = configuration.client.execute(req).await?;
1345
1346 let status = resp.status();
1347 let content_type = resp
1348 .headers()
1349 .get("content-type")
1350 .and_then(|v| v.to_str().ok())
1351 .unwrap_or("application/octet-stream");
1352 let content_type = super::ContentType::from(content_type);
1353
1354 if !status.is_client_error() && !status.is_server_error() {
1355 let content = resp.text().await?;
1356 match content_type {
1357 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1358 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RedeemResult`"))),
1359 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::RedeemResult`")))),
1360 }
1361 } else {
1362 let content = resp.text().await?;
1363 let entity: Option<PostMarketingPromosByCodeRedeemError> = serde_json::from_str(&content).ok();
1364 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1365 }
1366}
1367
1368pub async fn post_marketing_sequences(configuration: &configuration::Configuration, sequence: models::Sequence) -> Result<models::Sequence, Error<PostMarketingSequencesError>> {
1370 let p_sequence = sequence;
1372
1373 let uri_str = format!("{}/v1/marketing/sequences", configuration.base_path);
1374 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1375
1376 if let Some(ref user_agent) = configuration.user_agent {
1377 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1378 }
1379 if let Some(ref token) = configuration.bearer_access_token {
1380 req_builder = req_builder.bearer_auth(token.to_owned());
1381 };
1382 req_builder = req_builder.json(&p_sequence);
1383
1384 let req = req_builder.build()?;
1385 let resp = configuration.client.execute(req).await?;
1386
1387 let status = resp.status();
1388 let content_type = resp
1389 .headers()
1390 .get("content-type")
1391 .and_then(|v| v.to_str().ok())
1392 .unwrap_or("application/octet-stream");
1393 let content_type = super::ContentType::from(content_type);
1394
1395 if !status.is_client_error() && !status.is_server_error() {
1396 let content = resp.text().await?;
1397 match content_type {
1398 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1399 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Sequence`"))),
1400 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::Sequence`")))),
1401 }
1402 } else {
1403 let content = resp.text().await?;
1404 let entity: Option<PostMarketingSequencesError> = serde_json::from_str(&content).ok();
1405 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1406 }
1407}
1408
1409pub async fn post_marketing_sequences_by_id_enroll(configuration: &configuration::Configuration, id: &str, enroll_input: models::EnrollInput) -> Result<models::EnrollResult, Error<PostMarketingSequencesByIdEnrollError>> {
1411 let p_id = id;
1413 let p_enroll_input = enroll_input;
1414
1415 let uri_str = format!("{}/v1/marketing/sequences/{id}/enroll", configuration.base_path, id=crate::apis::urlencode(p_id));
1416 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1417
1418 if let Some(ref user_agent) = configuration.user_agent {
1419 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1420 }
1421 if let Some(ref token) = configuration.bearer_access_token {
1422 req_builder = req_builder.bearer_auth(token.to_owned());
1423 };
1424 req_builder = req_builder.json(&p_enroll_input);
1425
1426 let req = req_builder.build()?;
1427 let resp = configuration.client.execute(req).await?;
1428
1429 let status = resp.status();
1430 let content_type = resp
1431 .headers()
1432 .get("content-type")
1433 .and_then(|v| v.to_str().ok())
1434 .unwrap_or("application/octet-stream");
1435 let content_type = super::ContentType::from(content_type);
1436
1437 if !status.is_client_error() && !status.is_server_error() {
1438 let content = resp.text().await?;
1439 match content_type {
1440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EnrollResult`"))),
1442 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::EnrollResult`")))),
1443 }
1444 } else {
1445 let content = resp.text().await?;
1446 let entity: Option<PostMarketingSequencesByIdEnrollError> = serde_json::from_str(&content).ok();
1447 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1448 }
1449}
1450
1451pub async fn post_marketing_sequences_by_id_enrollments_by_eid_cancel(configuration: &configuration::Configuration, id: &str, eid: &str) -> Result<(), Error<PostMarketingSequencesByIdEnrollmentsByEidCancelError>> {
1453 let p_id = id;
1455 let p_eid = eid;
1456
1457 let uri_str = format!("{}/v1/marketing/sequences/{id}/enrollments/{eid}/cancel", configuration.base_path, id=crate::apis::urlencode(p_id), eid=crate::apis::urlencode(p_eid));
1458 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1459
1460 if let Some(ref user_agent) = configuration.user_agent {
1461 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1462 }
1463 if let Some(ref token) = configuration.bearer_access_token {
1464 req_builder = req_builder.bearer_auth(token.to_owned());
1465 };
1466
1467 let req = req_builder.build()?;
1468 let resp = configuration.client.execute(req).await?;
1469
1470 let status = resp.status();
1471
1472 if !status.is_client_error() && !status.is_server_error() {
1473 Ok(())
1474 } else {
1475 let content = resp.text().await?;
1476 let entity: Option<PostMarketingSequencesByIdEnrollmentsByEidCancelError> = serde_json::from_str(&content).ok();
1477 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1478 }
1479}
1480
1481pub async fn post_marketing_sequences_by_id_status(configuration: &configuration::Configuration, id: &str, sequence_status: models::SequenceStatus) -> Result<models::SequenceStatus, Error<PostMarketingSequencesByIdStatusError>> {
1483 let p_id = id;
1485 let p_sequence_status = sequence_status;
1486
1487 let uri_str = format!("{}/v1/marketing/sequences/{id}/status", configuration.base_path, id=crate::apis::urlencode(p_id));
1488 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1489
1490 if let Some(ref user_agent) = configuration.user_agent {
1491 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1492 }
1493 if let Some(ref token) = configuration.bearer_access_token {
1494 req_builder = req_builder.bearer_auth(token.to_owned());
1495 };
1496 req_builder = req_builder.json(&p_sequence_status);
1497
1498 let req = req_builder.build()?;
1499 let resp = configuration.client.execute(req).await?;
1500
1501 let status = resp.status();
1502 let content_type = resp
1503 .headers()
1504 .get("content-type")
1505 .and_then(|v| v.to_str().ok())
1506 .unwrap_or("application/octet-stream");
1507 let content_type = super::ContentType::from(content_type);
1508
1509 if !status.is_client_error() && !status.is_server_error() {
1510 let content = resp.text().await?;
1511 match content_type {
1512 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1513 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SequenceStatus`"))),
1514 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::SequenceStatus`")))),
1515 }
1516 } else {
1517 let content = resp.text().await?;
1518 let entity: Option<PostMarketingSequencesByIdStatusError> = serde_json::from_str(&content).ok();
1519 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1520 }
1521}
1522
1523pub async fn post_marketing_sequences_by_id_steps(configuration: &configuration::Configuration, id: &str, step_input: models::StepInput) -> Result<models::Step, Error<PostMarketingSequencesByIdStepsError>> {
1525 let p_id = id;
1527 let p_step_input = step_input;
1528
1529 let uri_str = format!("{}/v1/marketing/sequences/{id}/steps", configuration.base_path, id=crate::apis::urlencode(p_id));
1530 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1531
1532 if let Some(ref user_agent) = configuration.user_agent {
1533 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1534 }
1535 if let Some(ref token) = configuration.bearer_access_token {
1536 req_builder = req_builder.bearer_auth(token.to_owned());
1537 };
1538 req_builder = req_builder.json(&p_step_input);
1539
1540 let req = req_builder.build()?;
1541 let resp = configuration.client.execute(req).await?;
1542
1543 let status = resp.status();
1544 let content_type = resp
1545 .headers()
1546 .get("content-type")
1547 .and_then(|v| v.to_str().ok())
1548 .unwrap_or("application/octet-stream");
1549 let content_type = super::ContentType::from(content_type);
1550
1551 if !status.is_client_error() && !status.is_server_error() {
1552 let content = resp.text().await?;
1553 match content_type {
1554 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1555 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Step`"))),
1556 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::Step`")))),
1557 }
1558 } else {
1559 let content = resp.text().await?;
1560 let entity: Option<PostMarketingSequencesByIdStepsError> = serde_json::from_str(&content).ok();
1561 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1562 }
1563}
1564
1565pub async fn post_marketing_suppressions(configuration: &configuration::Configuration, suppression: models::Suppression) -> Result<models::Suppression, Error<PostMarketingSuppressionsError>> {
1567 let p_suppression = suppression;
1569
1570 let uri_str = format!("{}/v1/marketing/suppressions", configuration.base_path);
1571 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1572
1573 if let Some(ref user_agent) = configuration.user_agent {
1574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1575 }
1576 if let Some(ref token) = configuration.bearer_access_token {
1577 req_builder = req_builder.bearer_auth(token.to_owned());
1578 };
1579 req_builder = req_builder.json(&p_suppression);
1580
1581 let req = req_builder.build()?;
1582 let resp = configuration.client.execute(req).await?;
1583
1584 let status = resp.status();
1585 let content_type = resp
1586 .headers()
1587 .get("content-type")
1588 .and_then(|v| v.to_str().ok())
1589 .unwrap_or("application/octet-stream");
1590 let content_type = super::ContentType::from(content_type);
1591
1592 if !status.is_client_error() && !status.is_server_error() {
1593 let content = resp.text().await?;
1594 match content_type {
1595 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1596 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Suppression`"))),
1597 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::Suppression`")))),
1598 }
1599 } else {
1600 let content = resp.text().await?;
1601 let entity: Option<PostMarketingSuppressionsError> = serde_json::from_str(&content).ok();
1602 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1603 }
1604}
1605
1606pub async fn put_marketing_calendar_by_id(configuration: &configuration::Configuration, id: &str, calendar_post: models::CalendarPost) -> Result<models::CalendarPost, Error<PutMarketingCalendarByIdError>> {
1608 let p_id = id;
1610 let p_calendar_post = calendar_post;
1611
1612 let uri_str = format!("{}/v1/marketing/calendar/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1613 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1614
1615 if let Some(ref user_agent) = configuration.user_agent {
1616 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1617 }
1618 if let Some(ref token) = configuration.bearer_access_token {
1619 req_builder = req_builder.bearer_auth(token.to_owned());
1620 };
1621 req_builder = req_builder.json(&p_calendar_post);
1622
1623 let req = req_builder.build()?;
1624 let resp = configuration.client.execute(req).await?;
1625
1626 let status = resp.status();
1627 let content_type = resp
1628 .headers()
1629 .get("content-type")
1630 .and_then(|v| v.to_str().ok())
1631 .unwrap_or("application/octet-stream");
1632 let content_type = super::ContentType::from(content_type);
1633
1634 if !status.is_client_error() && !status.is_server_error() {
1635 let content = resp.text().await?;
1636 match content_type {
1637 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1638 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CalendarPost`"))),
1639 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::CalendarPost`")))),
1640 }
1641 } else {
1642 let content = resp.text().await?;
1643 let entity: Option<PutMarketingCalendarByIdError> = serde_json::from_str(&content).ok();
1644 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1645 }
1646}
1647
1648pub async fn put_marketing_campaigns_by_id(configuration: &configuration::Configuration, id: &str, campaign: models::Campaign) -> Result<models::Campaign, Error<PutMarketingCampaignsByIdError>> {
1650 let p_id = id;
1652 let p_campaign = campaign;
1653
1654 let uri_str = format!("{}/v1/marketing/campaigns/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1655 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1656
1657 if let Some(ref user_agent) = configuration.user_agent {
1658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1659 }
1660 if let Some(ref token) = configuration.bearer_access_token {
1661 req_builder = req_builder.bearer_auth(token.to_owned());
1662 };
1663 req_builder = req_builder.json(&p_campaign);
1664
1665 let req = req_builder.build()?;
1666 let resp = configuration.client.execute(req).await?;
1667
1668 let status = resp.status();
1669 let content_type = resp
1670 .headers()
1671 .get("content-type")
1672 .and_then(|v| v.to_str().ok())
1673 .unwrap_or("application/octet-stream");
1674 let content_type = super::ContentType::from(content_type);
1675
1676 if !status.is_client_error() && !status.is_server_error() {
1677 let content = resp.text().await?;
1678 match content_type {
1679 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1680 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Campaign`"))),
1681 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::Campaign`")))),
1682 }
1683 } else {
1684 let content = resp.text().await?;
1685 let entity: Option<PutMarketingCampaignsByIdError> = serde_json::from_str(&content).ok();
1686 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1687 }
1688}
1689