Skip to main content

line_bot_sdk_messaging_api/apis/
messaging_api_api.rs

1/*
2 * LINE Messaging API
3 *
4 * This document describes LINE Messaging API.
5 *
6 * The version of the OpenAPI document: 0.0.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`broadcast`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum BroadcastError {
20    Status400(models::ErrorResponse),
21    Status403(models::ErrorResponse),
22    Status409(models::ErrorResponse),
23    Status429(models::ErrorResponse),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`cancel_default_rich_menu`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum CancelDefaultRichMenuError {
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`close_coupon`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum CloseCouponError {
38    Status400(models::ErrorResponse),
39    Status404(models::ErrorResponse),
40    Status410(models::ErrorResponse),
41    UnknownValue(serde_json::Value),
42}
43
44/// struct for typed errors of method [`create_coupon`]
45#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum CreateCouponError {
48    Status400(models::ErrorResponse),
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`create_rich_menu`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum CreateRichMenuError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`create_rich_menu_alias`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum CreateRichMenuAliasError {
63    Status400(models::ErrorResponse),
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`delete_rich_menu`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteRichMenuError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`delete_rich_menu_alias`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum DeleteRichMenuAliasError {
78    Status400(models::ErrorResponse),
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`get_aggregation_unit_name_list`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetAggregationUnitNameListError {
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`get_aggregation_unit_usage`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum GetAggregationUnitUsageError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`get_bot_info`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum GetBotInfoError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`get_coupon_detail`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum GetCouponDetailError {
107    Status400(models::ErrorResponse),
108    Status404(models::ErrorResponse),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`get_default_rich_menu_id`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum GetDefaultRichMenuIdError {
116    UnknownValue(serde_json::Value),
117}
118
119/// struct for typed errors of method [`get_followers`]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum GetFollowersError {
123    UnknownValue(serde_json::Value),
124}
125
126/// struct for typed errors of method [`get_group_member_count`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum GetGroupMemberCountError {
130    UnknownValue(serde_json::Value),
131}
132
133/// struct for typed errors of method [`get_group_member_profile`]
134#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum GetGroupMemberProfileError {
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`get_group_members_ids`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum GetGroupMembersIdsError {
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`get_group_summary`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum GetGroupSummaryError {
151    UnknownValue(serde_json::Value),
152}
153
154/// struct for typed errors of method [`get_joined_membership_users`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum GetJoinedMembershipUsersError {
158    Status400(models::ErrorResponse),
159    Status404(models::ErrorResponse),
160    UnknownValue(serde_json::Value),
161}
162
163/// struct for typed errors of method [`get_membership_list`]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum GetMembershipListError {
167    Status404(models::ErrorResponse),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`get_membership_subscription`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum GetMembershipSubscriptionError {
175    Status400(models::ErrorResponse),
176    Status404(models::ErrorResponse),
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`get_message_quota`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum GetMessageQuotaError {
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`get_message_quota_consumption`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetMessageQuotaConsumptionError {
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`get_narrowcast_progress`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum GetNarrowcastProgressError {
198    UnknownValue(serde_json::Value),
199}
200
201/// struct for typed errors of method [`get_number_of_sent_broadcast_messages`]
202#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum GetNumberOfSentBroadcastMessagesError {
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`get_number_of_sent_multicast_messages`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum GetNumberOfSentMulticastMessagesError {
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`get_number_of_sent_push_messages`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum GetNumberOfSentPushMessagesError {
219    UnknownValue(serde_json::Value),
220}
221
222/// struct for typed errors of method [`get_number_of_sent_reply_messages`]
223#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum GetNumberOfSentReplyMessagesError {
226    UnknownValue(serde_json::Value),
227}
228
229/// struct for typed errors of method [`get_pnp_message_statistics`]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum GetPnpMessageStatisticsError {
233    UnknownValue(serde_json::Value),
234}
235
236/// struct for typed errors of method [`get_profile`]
237#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum GetProfileError {
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`get_rich_menu`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum GetRichMenuError {
247    UnknownValue(serde_json::Value),
248}
249
250/// struct for typed errors of method [`get_rich_menu_alias`]
251#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum GetRichMenuAliasError {
254    UnknownValue(serde_json::Value),
255}
256
257/// struct for typed errors of method [`get_rich_menu_alias_list`]
258#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum GetRichMenuAliasListError {
261    UnknownValue(serde_json::Value),
262}
263
264/// struct for typed errors of method [`get_rich_menu_batch_progress`]
265#[derive(Debug, Clone, Serialize, Deserialize)]
266#[serde(untagged)]
267pub enum GetRichMenuBatchProgressError {
268    UnknownValue(serde_json::Value),
269}
270
271/// struct for typed errors of method [`get_rich_menu_id_of_user`]
272#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum GetRichMenuIdOfUserError {
275    UnknownValue(serde_json::Value),
276}
277
278/// struct for typed errors of method [`get_rich_menu_list`]
279#[derive(Debug, Clone, Serialize, Deserialize)]
280#[serde(untagged)]
281pub enum GetRichMenuListError {
282    UnknownValue(serde_json::Value),
283}
284
285/// struct for typed errors of method [`get_room_member_count`]
286#[derive(Debug, Clone, Serialize, Deserialize)]
287#[serde(untagged)]
288pub enum GetRoomMemberCountError {
289    UnknownValue(serde_json::Value),
290}
291
292/// struct for typed errors of method [`get_room_member_profile`]
293#[derive(Debug, Clone, Serialize, Deserialize)]
294#[serde(untagged)]
295pub enum GetRoomMemberProfileError {
296    UnknownValue(serde_json::Value),
297}
298
299/// struct for typed errors of method [`get_room_members_ids`]
300#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum GetRoomMembersIdsError {
303    UnknownValue(serde_json::Value),
304}
305
306/// struct for typed errors of method [`get_webhook_endpoint`]
307#[derive(Debug, Clone, Serialize, Deserialize)]
308#[serde(untagged)]
309pub enum GetWebhookEndpointError {
310    UnknownValue(serde_json::Value),
311}
312
313/// struct for typed errors of method [`issue_link_token`]
314#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum IssueLinkTokenError {
317    UnknownValue(serde_json::Value),
318}
319
320/// struct for typed errors of method [`leave_group`]
321#[derive(Debug, Clone, Serialize, Deserialize)]
322#[serde(untagged)]
323pub enum LeaveGroupError {
324    Status400(models::ErrorResponse),
325    Status404(models::ErrorResponse),
326    UnknownValue(serde_json::Value),
327}
328
329/// struct for typed errors of method [`leave_room`]
330#[derive(Debug, Clone, Serialize, Deserialize)]
331#[serde(untagged)]
332pub enum LeaveRoomError {
333    UnknownValue(serde_json::Value),
334}
335
336/// struct for typed errors of method [`link_rich_menu_id_to_user`]
337#[derive(Debug, Clone, Serialize, Deserialize)]
338#[serde(untagged)]
339pub enum LinkRichMenuIdToUserError {
340    UnknownValue(serde_json::Value),
341}
342
343/// struct for typed errors of method [`link_rich_menu_id_to_users`]
344#[derive(Debug, Clone, Serialize, Deserialize)]
345#[serde(untagged)]
346pub enum LinkRichMenuIdToUsersError {
347    UnknownValue(serde_json::Value),
348}
349
350/// struct for typed errors of method [`list_coupon`]
351#[derive(Debug, Clone, Serialize, Deserialize)]
352#[serde(untagged)]
353pub enum ListCouponError {
354    Status400(models::ErrorResponse),
355    UnknownValue(serde_json::Value),
356}
357
358/// struct for typed errors of method [`mark_messages_as_read`]
359#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum MarkMessagesAsReadError {
362    UnknownValue(serde_json::Value),
363}
364
365/// struct for typed errors of method [`mark_messages_as_read_by_token`]
366#[derive(Debug, Clone, Serialize, Deserialize)]
367#[serde(untagged)]
368pub enum MarkMessagesAsReadByTokenError {
369    Status400(models::ErrorResponse),
370    UnknownValue(serde_json::Value),
371}
372
373/// struct for typed errors of method [`multicast`]
374#[derive(Debug, Clone, Serialize, Deserialize)]
375#[serde(untagged)]
376pub enum MulticastError {
377    Status400(models::ErrorResponse),
378    Status403(models::ErrorResponse),
379    Status409(models::ErrorResponse),
380    Status429(models::ErrorResponse),
381    UnknownValue(serde_json::Value),
382}
383
384/// struct for typed errors of method [`narrowcast`]
385#[derive(Debug, Clone, Serialize, Deserialize)]
386#[serde(untagged)]
387pub enum NarrowcastError {
388    Status400(models::ErrorResponse),
389    Status403(models::ErrorResponse),
390    Status409(models::ErrorResponse),
391    Status429(models::ErrorResponse),
392    UnknownValue(serde_json::Value),
393}
394
395/// struct for typed errors of method [`push_message`]
396#[derive(Debug, Clone, Serialize, Deserialize)]
397#[serde(untagged)]
398pub enum PushMessageError {
399    Status400(models::ErrorResponse),
400    Status403(models::ErrorResponse),
401    Status409(models::ErrorResponse),
402    Status429(models::ErrorResponse),
403    UnknownValue(serde_json::Value),
404}
405
406/// struct for typed errors of method [`push_messages_by_phone`]
407#[derive(Debug, Clone, Serialize, Deserialize)]
408#[serde(untagged)]
409pub enum PushMessagesByPhoneError {
410    Status422(models::ErrorResponse),
411    UnknownValue(serde_json::Value),
412}
413
414/// struct for typed errors of method [`reply_message`]
415#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum ReplyMessageError {
418    Status400(models::ErrorResponse),
419    Status429(models::ErrorResponse),
420    UnknownValue(serde_json::Value),
421}
422
423/// struct for typed errors of method [`rich_menu_batch`]
424#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum RichMenuBatchError {
427    UnknownValue(serde_json::Value),
428}
429
430/// struct for typed errors of method [`set_default_rich_menu`]
431#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum SetDefaultRichMenuError {
434    UnknownValue(serde_json::Value),
435}
436
437/// struct for typed errors of method [`set_webhook_endpoint`]
438#[derive(Debug, Clone, Serialize, Deserialize)]
439#[serde(untagged)]
440pub enum SetWebhookEndpointError {
441    UnknownValue(serde_json::Value),
442}
443
444/// struct for typed errors of method [`show_loading_animation`]
445#[derive(Debug, Clone, Serialize, Deserialize)]
446#[serde(untagged)]
447pub enum ShowLoadingAnimationError {
448    Status400(models::ErrorResponse),
449    UnknownValue(serde_json::Value),
450}
451
452/// struct for typed errors of method [`test_webhook_endpoint`]
453#[derive(Debug, Clone, Serialize, Deserialize)]
454#[serde(untagged)]
455pub enum TestWebhookEndpointError {
456    UnknownValue(serde_json::Value),
457}
458
459/// struct for typed errors of method [`unlink_rich_menu_id_from_user`]
460#[derive(Debug, Clone, Serialize, Deserialize)]
461#[serde(untagged)]
462pub enum UnlinkRichMenuIdFromUserError {
463    UnknownValue(serde_json::Value),
464}
465
466/// struct for typed errors of method [`unlink_rich_menu_id_from_users`]
467#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum UnlinkRichMenuIdFromUsersError {
470    UnknownValue(serde_json::Value),
471}
472
473/// struct for typed errors of method [`update_rich_menu_alias`]
474#[derive(Debug, Clone, Serialize, Deserialize)]
475#[serde(untagged)]
476pub enum UpdateRichMenuAliasError {
477    Status400(models::ErrorResponse),
478    UnknownValue(serde_json::Value),
479}
480
481/// struct for typed errors of method [`validate_broadcast`]
482#[derive(Debug, Clone, Serialize, Deserialize)]
483#[serde(untagged)]
484pub enum ValidateBroadcastError {
485    UnknownValue(serde_json::Value),
486}
487
488/// struct for typed errors of method [`validate_multicast`]
489#[derive(Debug, Clone, Serialize, Deserialize)]
490#[serde(untagged)]
491pub enum ValidateMulticastError {
492    UnknownValue(serde_json::Value),
493}
494
495/// struct for typed errors of method [`validate_narrowcast`]
496#[derive(Debug, Clone, Serialize, Deserialize)]
497#[serde(untagged)]
498pub enum ValidateNarrowcastError {
499    UnknownValue(serde_json::Value),
500}
501
502/// struct for typed errors of method [`validate_push`]
503#[derive(Debug, Clone, Serialize, Deserialize)]
504#[serde(untagged)]
505pub enum ValidatePushError {
506    UnknownValue(serde_json::Value),
507}
508
509/// struct for typed errors of method [`validate_reply`]
510#[derive(Debug, Clone, Serialize, Deserialize)]
511#[serde(untagged)]
512pub enum ValidateReplyError {
513    UnknownValue(serde_json::Value),
514}
515
516/// struct for typed errors of method [`validate_rich_menu_batch_request`]
517#[derive(Debug, Clone, Serialize, Deserialize)]
518#[serde(untagged)]
519pub enum ValidateRichMenuBatchRequestError {
520    UnknownValue(serde_json::Value),
521}
522
523/// struct for typed errors of method [`validate_rich_menu_object`]
524#[derive(Debug, Clone, Serialize, Deserialize)]
525#[serde(untagged)]
526pub enum ValidateRichMenuObjectError {
527    UnknownValue(serde_json::Value),
528}
529
530/// Sends a message to multiple users at any time.
531pub async fn broadcast(
532    configuration: &configuration::Configuration,
533    broadcast_request: models::BroadcastRequest,
534    x_line_retry_key: Option<&str>,
535) -> Result<serde_json::Value, Error<BroadcastError>> {
536    // add a prefix to parameters to efficiently prevent name collisions
537    let p_body_broadcast_request = broadcast_request;
538    let p_header_x_line_retry_key = x_line_retry_key;
539
540    let uri_str = format!("{}/v2/bot/message/broadcast", configuration.base_path);
541    let mut req_builder = configuration
542        .client
543        .request(reqwest::Method::POST, &uri_str);
544
545    if let Some(ref user_agent) = configuration.user_agent {
546        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
547    }
548    if let Some(param_value) = p_header_x_line_retry_key {
549        req_builder = req_builder.header("X-Line-Retry-Key", param_value.to_string());
550    }
551    if let Some(ref token) = configuration.bearer_access_token {
552        req_builder = req_builder.bearer_auth(token.to_owned());
553    };
554    req_builder = req_builder.json(&p_body_broadcast_request);
555
556    let req = req_builder.build()?;
557    let resp = configuration.client.execute(req).await?;
558
559    let status = resp.status();
560    let content_type = resp
561        .headers()
562        .get("content-type")
563        .and_then(|v| v.to_str().ok())
564        .unwrap_or("application/octet-stream");
565    let content_type = super::ContentType::from(content_type);
566
567    if !status.is_client_error() && !status.is_server_error() {
568        let content = resp.text().await?;
569        match content_type {
570            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
571            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
572            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
573        }
574    } else {
575        let content = resp.text().await?;
576        let entity: Option<BroadcastError> = serde_json::from_str(&content).ok();
577        Err(Error::ResponseError(ResponseContent {
578            status,
579            content,
580            entity,
581        }))
582    }
583}
584
585/// Cancel default rich menu
586pub async fn cancel_default_rich_menu(
587    configuration: &configuration::Configuration,
588) -> Result<(), Error<CancelDefaultRichMenuError>> {
589    let uri_str = format!("{}/v2/bot/user/all/richmenu", configuration.base_path);
590    let mut req_builder = configuration
591        .client
592        .request(reqwest::Method::DELETE, &uri_str);
593
594    if let Some(ref user_agent) = configuration.user_agent {
595        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
596    }
597    if let Some(ref token) = configuration.bearer_access_token {
598        req_builder = req_builder.bearer_auth(token.to_owned());
599    };
600
601    let req = req_builder.build()?;
602    let resp = configuration.client.execute(req).await?;
603
604    let status = resp.status();
605
606    if !status.is_client_error() && !status.is_server_error() {
607        Ok(())
608    } else {
609        let content = resp.text().await?;
610        let entity: Option<CancelDefaultRichMenuError> = serde_json::from_str(&content).ok();
611        Err(Error::ResponseError(ResponseContent {
612            status,
613            content,
614            entity,
615        }))
616    }
617}
618
619/// Close coupon
620pub async fn close_coupon(
621    configuration: &configuration::Configuration,
622    coupon_id: &str,
623) -> Result<(), Error<CloseCouponError>> {
624    // add a prefix to parameters to efficiently prevent name collisions
625    let p_path_coupon_id = coupon_id;
626
627    let uri_str = format!(
628        "{}/v2/bot/coupon/{couponId}/close",
629        configuration.base_path,
630        couponId = crate::apis::urlencode(p_path_coupon_id)
631    );
632    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
633
634    if let Some(ref user_agent) = configuration.user_agent {
635        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
636    }
637    if let Some(ref token) = configuration.bearer_access_token {
638        req_builder = req_builder.bearer_auth(token.to_owned());
639    };
640
641    let req = req_builder.build()?;
642    let resp = configuration.client.execute(req).await?;
643
644    let status = resp.status();
645
646    if !status.is_client_error() && !status.is_server_error() {
647        Ok(())
648    } else {
649        let content = resp.text().await?;
650        let entity: Option<CloseCouponError> = serde_json::from_str(&content).ok();
651        Err(Error::ResponseError(ResponseContent {
652            status,
653            content,
654            entity,
655        }))
656    }
657}
658
659/// Create a new coupon. Define coupon details such as type, title, and validity period.
660pub async fn create_coupon(
661    configuration: &configuration::Configuration,
662    coupon_create_request: Option<models::CouponCreateRequest>,
663) -> Result<models::CouponCreateResponse, Error<CreateCouponError>> {
664    // add a prefix to parameters to efficiently prevent name collisions
665    let p_body_coupon_create_request = coupon_create_request;
666
667    let uri_str = format!("{}/v2/bot/coupon", configuration.base_path);
668    let mut req_builder = configuration
669        .client
670        .request(reqwest::Method::POST, &uri_str);
671
672    if let Some(ref user_agent) = configuration.user_agent {
673        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
674    }
675    if let Some(ref token) = configuration.bearer_access_token {
676        req_builder = req_builder.bearer_auth(token.to_owned());
677    };
678    req_builder = req_builder.json(&p_body_coupon_create_request);
679
680    let req = req_builder.build()?;
681    let resp = configuration.client.execute(req).await?;
682
683    let status = resp.status();
684    let content_type = resp
685        .headers()
686        .get("content-type")
687        .and_then(|v| v.to_str().ok())
688        .unwrap_or("application/octet-stream");
689    let content_type = super::ContentType::from(content_type);
690
691    if !status.is_client_error() && !status.is_server_error() {
692        let content = resp.text().await?;
693        match content_type {
694            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
695            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CouponCreateResponse`"))),
696            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::CouponCreateResponse`")))),
697        }
698    } else {
699        let content = resp.text().await?;
700        let entity: Option<CreateCouponError> = serde_json::from_str(&content).ok();
701        Err(Error::ResponseError(ResponseContent {
702            status,
703            content,
704            entity,
705        }))
706    }
707}
708
709/// Create rich menu
710pub async fn create_rich_menu(
711    configuration: &configuration::Configuration,
712    rich_menu_request: models::RichMenuRequest,
713) -> Result<models::RichMenuIdResponse, Error<CreateRichMenuError>> {
714    // add a prefix to parameters to efficiently prevent name collisions
715    let p_body_rich_menu_request = rich_menu_request;
716
717    let uri_str = format!("{}/v2/bot/richmenu", configuration.base_path);
718    let mut req_builder = configuration
719        .client
720        .request(reqwest::Method::POST, &uri_str);
721
722    if let Some(ref user_agent) = configuration.user_agent {
723        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
724    }
725    if let Some(ref token) = configuration.bearer_access_token {
726        req_builder = req_builder.bearer_auth(token.to_owned());
727    };
728    req_builder = req_builder.json(&p_body_rich_menu_request);
729
730    let req = req_builder.build()?;
731    let resp = configuration.client.execute(req).await?;
732
733    let status = resp.status();
734    let content_type = resp
735        .headers()
736        .get("content-type")
737        .and_then(|v| v.to_str().ok())
738        .unwrap_or("application/octet-stream");
739    let content_type = super::ContentType::from(content_type);
740
741    if !status.is_client_error() && !status.is_server_error() {
742        let content = resp.text().await?;
743        match content_type {
744            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
745            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuIdResponse`"))),
746            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::RichMenuIdResponse`")))),
747        }
748    } else {
749        let content = resp.text().await?;
750        let entity: Option<CreateRichMenuError> = serde_json::from_str(&content).ok();
751        Err(Error::ResponseError(ResponseContent {
752            status,
753            content,
754            entity,
755        }))
756    }
757}
758
759/// Create rich menu alias
760pub async fn create_rich_menu_alias(
761    configuration: &configuration::Configuration,
762    create_rich_menu_alias_request: models::CreateRichMenuAliasRequest,
763) -> Result<(), Error<CreateRichMenuAliasError>> {
764    // add a prefix to parameters to efficiently prevent name collisions
765    let p_body_create_rich_menu_alias_request = create_rich_menu_alias_request;
766
767    let uri_str = format!("{}/v2/bot/richmenu/alias", configuration.base_path);
768    let mut req_builder = configuration
769        .client
770        .request(reqwest::Method::POST, &uri_str);
771
772    if let Some(ref user_agent) = configuration.user_agent {
773        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
774    }
775    if let Some(ref token) = configuration.bearer_access_token {
776        req_builder = req_builder.bearer_auth(token.to_owned());
777    };
778    req_builder = req_builder.json(&p_body_create_rich_menu_alias_request);
779
780    let req = req_builder.build()?;
781    let resp = configuration.client.execute(req).await?;
782
783    let status = resp.status();
784
785    if !status.is_client_error() && !status.is_server_error() {
786        Ok(())
787    } else {
788        let content = resp.text().await?;
789        let entity: Option<CreateRichMenuAliasError> = serde_json::from_str(&content).ok();
790        Err(Error::ResponseError(ResponseContent {
791            status,
792            content,
793            entity,
794        }))
795    }
796}
797
798/// Deletes a rich menu.
799pub async fn delete_rich_menu(
800    configuration: &configuration::Configuration,
801    rich_menu_id: &str,
802) -> Result<(), Error<DeleteRichMenuError>> {
803    // add a prefix to parameters to efficiently prevent name collisions
804    let p_path_rich_menu_id = rich_menu_id;
805
806    let uri_str = format!(
807        "{}/v2/bot/richmenu/{richMenuId}",
808        configuration.base_path,
809        richMenuId = crate::apis::urlencode(p_path_rich_menu_id)
810    );
811    let mut req_builder = configuration
812        .client
813        .request(reqwest::Method::DELETE, &uri_str);
814
815    if let Some(ref user_agent) = configuration.user_agent {
816        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
817    }
818    if let Some(ref token) = configuration.bearer_access_token {
819        req_builder = req_builder.bearer_auth(token.to_owned());
820    };
821
822    let req = req_builder.build()?;
823    let resp = configuration.client.execute(req).await?;
824
825    let status = resp.status();
826
827    if !status.is_client_error() && !status.is_server_error() {
828        Ok(())
829    } else {
830        let content = resp.text().await?;
831        let entity: Option<DeleteRichMenuError> = serde_json::from_str(&content).ok();
832        Err(Error::ResponseError(ResponseContent {
833            status,
834            content,
835            entity,
836        }))
837    }
838}
839
840/// Delete rich menu alias
841pub async fn delete_rich_menu_alias(
842    configuration: &configuration::Configuration,
843    rich_menu_alias_id: &str,
844) -> Result<(), Error<DeleteRichMenuAliasError>> {
845    // add a prefix to parameters to efficiently prevent name collisions
846    let p_path_rich_menu_alias_id = rich_menu_alias_id;
847
848    let uri_str = format!(
849        "{}/v2/bot/richmenu/alias/{richMenuAliasId}",
850        configuration.base_path,
851        richMenuAliasId = crate::apis::urlencode(p_path_rich_menu_alias_id)
852    );
853    let mut req_builder = configuration
854        .client
855        .request(reqwest::Method::DELETE, &uri_str);
856
857    if let Some(ref user_agent) = configuration.user_agent {
858        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
859    }
860    if let Some(ref token) = configuration.bearer_access_token {
861        req_builder = req_builder.bearer_auth(token.to_owned());
862    };
863
864    let req = req_builder.build()?;
865    let resp = configuration.client.execute(req).await?;
866
867    let status = resp.status();
868
869    if !status.is_client_error() && !status.is_server_error() {
870        Ok(())
871    } else {
872        let content = resp.text().await?;
873        let entity: Option<DeleteRichMenuAliasError> = serde_json::from_str(&content).ok();
874        Err(Error::ResponseError(ResponseContent {
875            status,
876            content,
877            entity,
878        }))
879    }
880}
881
882/// Get name list of units used this month
883pub async fn get_aggregation_unit_name_list(
884    configuration: &configuration::Configuration,
885    limit: Option<&str>,
886    start: Option<&str>,
887) -> Result<models::GetAggregationUnitNameListResponse, Error<GetAggregationUnitNameListError>> {
888    // add a prefix to parameters to efficiently prevent name collisions
889    let p_query_limit = limit;
890    let p_query_start = start;
891
892    let uri_str = format!(
893        "{}/v2/bot/message/aggregation/list",
894        configuration.base_path
895    );
896    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
897
898    if let Some(ref param_value) = p_query_limit {
899        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
900    }
901    if let Some(ref param_value) = p_query_start {
902        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
903    }
904    if let Some(ref user_agent) = configuration.user_agent {
905        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
906    }
907    if let Some(ref token) = configuration.bearer_access_token {
908        req_builder = req_builder.bearer_auth(token.to_owned());
909    };
910
911    let req = req_builder.build()?;
912    let resp = configuration.client.execute(req).await?;
913
914    let status = resp.status();
915    let content_type = resp
916        .headers()
917        .get("content-type")
918        .and_then(|v| v.to_str().ok())
919        .unwrap_or("application/octet-stream");
920    let content_type = super::ContentType::from(content_type);
921
922    if !status.is_client_error() && !status.is_server_error() {
923        let content = resp.text().await?;
924        match content_type {
925            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
926            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAggregationUnitNameListResponse`"))),
927            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::GetAggregationUnitNameListResponse`")))),
928        }
929    } else {
930        let content = resp.text().await?;
931        let entity: Option<GetAggregationUnitNameListError> = serde_json::from_str(&content).ok();
932        Err(Error::ResponseError(ResponseContent {
933            status,
934            content,
935            entity,
936        }))
937    }
938}
939
940/// Get number of units used this month
941pub async fn get_aggregation_unit_usage(
942    configuration: &configuration::Configuration,
943) -> Result<models::GetAggregationUnitUsageResponse, Error<GetAggregationUnitUsageError>> {
944    let uri_str = format!(
945        "{}/v2/bot/message/aggregation/info",
946        configuration.base_path
947    );
948    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
949
950    if let Some(ref user_agent) = configuration.user_agent {
951        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
952    }
953    if let Some(ref token) = configuration.bearer_access_token {
954        req_builder = req_builder.bearer_auth(token.to_owned());
955    };
956
957    let req = req_builder.build()?;
958    let resp = configuration.client.execute(req).await?;
959
960    let status = resp.status();
961    let content_type = resp
962        .headers()
963        .get("content-type")
964        .and_then(|v| v.to_str().ok())
965        .unwrap_or("application/octet-stream");
966    let content_type = super::ContentType::from(content_type);
967
968    if !status.is_client_error() && !status.is_server_error() {
969        let content = resp.text().await?;
970        match content_type {
971            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
972            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAggregationUnitUsageResponse`"))),
973            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::GetAggregationUnitUsageResponse`")))),
974        }
975    } else {
976        let content = resp.text().await?;
977        let entity: Option<GetAggregationUnitUsageError> = serde_json::from_str(&content).ok();
978        Err(Error::ResponseError(ResponseContent {
979            status,
980            content,
981            entity,
982        }))
983    }
984}
985
986/// Get bot info
987pub async fn get_bot_info(
988    configuration: &configuration::Configuration,
989) -> Result<models::BotInfoResponse, Error<GetBotInfoError>> {
990    let uri_str = format!("{}/v2/bot/info", configuration.base_path);
991    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
992
993    if let Some(ref user_agent) = configuration.user_agent {
994        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
995    }
996    if let Some(ref token) = configuration.bearer_access_token {
997        req_builder = req_builder.bearer_auth(token.to_owned());
998    };
999
1000    let req = req_builder.build()?;
1001    let resp = configuration.client.execute(req).await?;
1002
1003    let status = resp.status();
1004    let content_type = resp
1005        .headers()
1006        .get("content-type")
1007        .and_then(|v| v.to_str().ok())
1008        .unwrap_or("application/octet-stream");
1009    let content_type = super::ContentType::from(content_type);
1010
1011    if !status.is_client_error() && !status.is_server_error() {
1012        let content = resp.text().await?;
1013        match content_type {
1014            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1015            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BotInfoResponse`"))),
1016            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::BotInfoResponse`")))),
1017        }
1018    } else {
1019        let content = resp.text().await?;
1020        let entity: Option<GetBotInfoError> = serde_json::from_str(&content).ok();
1021        Err(Error::ResponseError(ResponseContent {
1022            status,
1023            content,
1024            entity,
1025        }))
1026    }
1027}
1028
1029/// Get coupon detail
1030pub async fn get_coupon_detail(
1031    configuration: &configuration::Configuration,
1032    coupon_id: &str,
1033) -> Result<models::CouponResponse, Error<GetCouponDetailError>> {
1034    // add a prefix to parameters to efficiently prevent name collisions
1035    let p_path_coupon_id = coupon_id;
1036
1037    let uri_str = format!(
1038        "{}/v2/bot/coupon/{couponId}",
1039        configuration.base_path,
1040        couponId = crate::apis::urlencode(p_path_coupon_id)
1041    );
1042    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1043
1044    if let Some(ref user_agent) = configuration.user_agent {
1045        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1046    }
1047    if let Some(ref token) = configuration.bearer_access_token {
1048        req_builder = req_builder.bearer_auth(token.to_owned());
1049    };
1050
1051    let req = req_builder.build()?;
1052    let resp = configuration.client.execute(req).await?;
1053
1054    let status = resp.status();
1055    let content_type = resp
1056        .headers()
1057        .get("content-type")
1058        .and_then(|v| v.to_str().ok())
1059        .unwrap_or("application/octet-stream");
1060    let content_type = super::ContentType::from(content_type);
1061
1062    if !status.is_client_error() && !status.is_server_error() {
1063        let content = resp.text().await?;
1064        match content_type {
1065            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1066            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CouponResponse`"))),
1067            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::CouponResponse`")))),
1068        }
1069    } else {
1070        let content = resp.text().await?;
1071        let entity: Option<GetCouponDetailError> = serde_json::from_str(&content).ok();
1072        Err(Error::ResponseError(ResponseContent {
1073            status,
1074            content,
1075            entity,
1076        }))
1077    }
1078}
1079
1080/// Gets the ID of the default rich menu set with the Messaging API.
1081pub async fn get_default_rich_menu_id(
1082    configuration: &configuration::Configuration,
1083) -> Result<models::RichMenuIdResponse, Error<GetDefaultRichMenuIdError>> {
1084    let uri_str = format!("{}/v2/bot/user/all/richmenu", configuration.base_path);
1085    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1086
1087    if let Some(ref user_agent) = configuration.user_agent {
1088        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1089    }
1090    if let Some(ref token) = configuration.bearer_access_token {
1091        req_builder = req_builder.bearer_auth(token.to_owned());
1092    };
1093
1094    let req = req_builder.build()?;
1095    let resp = configuration.client.execute(req).await?;
1096
1097    let status = resp.status();
1098    let content_type = resp
1099        .headers()
1100        .get("content-type")
1101        .and_then(|v| v.to_str().ok())
1102        .unwrap_or("application/octet-stream");
1103    let content_type = super::ContentType::from(content_type);
1104
1105    if !status.is_client_error() && !status.is_server_error() {
1106        let content = resp.text().await?;
1107        match content_type {
1108            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1109            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuIdResponse`"))),
1110            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::RichMenuIdResponse`")))),
1111        }
1112    } else {
1113        let content = resp.text().await?;
1114        let entity: Option<GetDefaultRichMenuIdError> = serde_json::from_str(&content).ok();
1115        Err(Error::ResponseError(ResponseContent {
1116            status,
1117            content,
1118            entity,
1119        }))
1120    }
1121}
1122
1123/// Get a list of users who added your LINE Official Account as a friend
1124pub async fn get_followers(
1125    configuration: &configuration::Configuration,
1126    start: Option<&str>,
1127    limit: Option<i32>,
1128) -> Result<models::GetFollowersResponse, Error<GetFollowersError>> {
1129    // add a prefix to parameters to efficiently prevent name collisions
1130    let p_query_start = start;
1131    let p_query_limit = limit;
1132
1133    let uri_str = format!("{}/v2/bot/followers/ids", configuration.base_path);
1134    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1135
1136    if let Some(ref param_value) = p_query_start {
1137        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
1138    }
1139    if let Some(ref param_value) = p_query_limit {
1140        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1141    }
1142    if let Some(ref user_agent) = configuration.user_agent {
1143        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1144    }
1145    if let Some(ref token) = configuration.bearer_access_token {
1146        req_builder = req_builder.bearer_auth(token.to_owned());
1147    };
1148
1149    let req = req_builder.build()?;
1150    let resp = configuration.client.execute(req).await?;
1151
1152    let status = resp.status();
1153    let content_type = resp
1154        .headers()
1155        .get("content-type")
1156        .and_then(|v| v.to_str().ok())
1157        .unwrap_or("application/octet-stream");
1158    let content_type = super::ContentType::from(content_type);
1159
1160    if !status.is_client_error() && !status.is_server_error() {
1161        let content = resp.text().await?;
1162        match content_type {
1163            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1164            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetFollowersResponse`"))),
1165            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::GetFollowersResponse`")))),
1166        }
1167    } else {
1168        let content = resp.text().await?;
1169        let entity: Option<GetFollowersError> = serde_json::from_str(&content).ok();
1170        Err(Error::ResponseError(ResponseContent {
1171            status,
1172            content,
1173            entity,
1174        }))
1175    }
1176}
1177
1178/// Get number of users in a group chat
1179pub async fn get_group_member_count(
1180    configuration: &configuration::Configuration,
1181    group_id: &str,
1182) -> Result<models::GroupMemberCountResponse, Error<GetGroupMemberCountError>> {
1183    // add a prefix to parameters to efficiently prevent name collisions
1184    let p_path_group_id = group_id;
1185
1186    let uri_str = format!(
1187        "{}/v2/bot/group/{groupId}/members/count",
1188        configuration.base_path,
1189        groupId = crate::apis::urlencode(p_path_group_id)
1190    );
1191    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1192
1193    if let Some(ref user_agent) = configuration.user_agent {
1194        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1195    }
1196    if let Some(ref token) = configuration.bearer_access_token {
1197        req_builder = req_builder.bearer_auth(token.to_owned());
1198    };
1199
1200    let req = req_builder.build()?;
1201    let resp = configuration.client.execute(req).await?;
1202
1203    let status = resp.status();
1204    let content_type = resp
1205        .headers()
1206        .get("content-type")
1207        .and_then(|v| v.to_str().ok())
1208        .unwrap_or("application/octet-stream");
1209    let content_type = super::ContentType::from(content_type);
1210
1211    if !status.is_client_error() && !status.is_server_error() {
1212        let content = resp.text().await?;
1213        match content_type {
1214            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1215            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupMemberCountResponse`"))),
1216            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::GroupMemberCountResponse`")))),
1217        }
1218    } else {
1219        let content = resp.text().await?;
1220        let entity: Option<GetGroupMemberCountError> = serde_json::from_str(&content).ok();
1221        Err(Error::ResponseError(ResponseContent {
1222            status,
1223            content,
1224            entity,
1225        }))
1226    }
1227}
1228
1229/// Get group chat member profile
1230pub async fn get_group_member_profile(
1231    configuration: &configuration::Configuration,
1232    group_id: &str,
1233    user_id: &str,
1234) -> Result<models::GroupUserProfileResponse, Error<GetGroupMemberProfileError>> {
1235    // add a prefix to parameters to efficiently prevent name collisions
1236    let p_path_group_id = group_id;
1237    let p_path_user_id = user_id;
1238
1239    let uri_str = format!(
1240        "{}/v2/bot/group/{groupId}/member/{userId}",
1241        configuration.base_path,
1242        groupId = crate::apis::urlencode(p_path_group_id),
1243        userId = crate::apis::urlencode(p_path_user_id)
1244    );
1245    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1246
1247    if let Some(ref user_agent) = configuration.user_agent {
1248        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1249    }
1250    if let Some(ref token) = configuration.bearer_access_token {
1251        req_builder = req_builder.bearer_auth(token.to_owned());
1252    };
1253
1254    let req = req_builder.build()?;
1255    let resp = configuration.client.execute(req).await?;
1256
1257    let status = resp.status();
1258    let content_type = resp
1259        .headers()
1260        .get("content-type")
1261        .and_then(|v| v.to_str().ok())
1262        .unwrap_or("application/octet-stream");
1263    let content_type = super::ContentType::from(content_type);
1264
1265    if !status.is_client_error() && !status.is_server_error() {
1266        let content = resp.text().await?;
1267        match content_type {
1268            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1269            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupUserProfileResponse`"))),
1270            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::GroupUserProfileResponse`")))),
1271        }
1272    } else {
1273        let content = resp.text().await?;
1274        let entity: Option<GetGroupMemberProfileError> = serde_json::from_str(&content).ok();
1275        Err(Error::ResponseError(ResponseContent {
1276            status,
1277            content,
1278            entity,
1279        }))
1280    }
1281}
1282
1283/// Get group chat member user IDs
1284pub async fn get_group_members_ids(
1285    configuration: &configuration::Configuration,
1286    group_id: &str,
1287    start: Option<&str>,
1288) -> Result<models::MembersIdsResponse, Error<GetGroupMembersIdsError>> {
1289    // add a prefix to parameters to efficiently prevent name collisions
1290    let p_path_group_id = group_id;
1291    let p_query_start = start;
1292
1293    let uri_str = format!(
1294        "{}/v2/bot/group/{groupId}/members/ids",
1295        configuration.base_path,
1296        groupId = crate::apis::urlencode(p_path_group_id)
1297    );
1298    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1299
1300    if let Some(ref param_value) = p_query_start {
1301        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
1302    }
1303    if let Some(ref user_agent) = configuration.user_agent {
1304        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1305    }
1306    if let Some(ref token) = configuration.bearer_access_token {
1307        req_builder = req_builder.bearer_auth(token.to_owned());
1308    };
1309
1310    let req = req_builder.build()?;
1311    let resp = configuration.client.execute(req).await?;
1312
1313    let status = resp.status();
1314    let content_type = resp
1315        .headers()
1316        .get("content-type")
1317        .and_then(|v| v.to_str().ok())
1318        .unwrap_or("application/octet-stream");
1319    let content_type = super::ContentType::from(content_type);
1320
1321    if !status.is_client_error() && !status.is_server_error() {
1322        let content = resp.text().await?;
1323        match content_type {
1324            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1325            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembersIdsResponse`"))),
1326            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::MembersIdsResponse`")))),
1327        }
1328    } else {
1329        let content = resp.text().await?;
1330        let entity: Option<GetGroupMembersIdsError> = serde_json::from_str(&content).ok();
1331        Err(Error::ResponseError(ResponseContent {
1332            status,
1333            content,
1334            entity,
1335        }))
1336    }
1337}
1338
1339/// Get group chat summary
1340pub async fn get_group_summary(
1341    configuration: &configuration::Configuration,
1342    group_id: &str,
1343) -> Result<models::GroupSummaryResponse, Error<GetGroupSummaryError>> {
1344    // add a prefix to parameters to efficiently prevent name collisions
1345    let p_path_group_id = group_id;
1346
1347    let uri_str = format!(
1348        "{}/v2/bot/group/{groupId}/summary",
1349        configuration.base_path,
1350        groupId = crate::apis::urlencode(p_path_group_id)
1351    );
1352    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1353
1354    if let Some(ref user_agent) = configuration.user_agent {
1355        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1356    }
1357    if let Some(ref token) = configuration.bearer_access_token {
1358        req_builder = req_builder.bearer_auth(token.to_owned());
1359    };
1360
1361    let req = req_builder.build()?;
1362    let resp = configuration.client.execute(req).await?;
1363
1364    let status = resp.status();
1365    let content_type = resp
1366        .headers()
1367        .get("content-type")
1368        .and_then(|v| v.to_str().ok())
1369        .unwrap_or("application/octet-stream");
1370    let content_type = super::ContentType::from(content_type);
1371
1372    if !status.is_client_error() && !status.is_server_error() {
1373        let content = resp.text().await?;
1374        match content_type {
1375            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1376            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GroupSummaryResponse`"))),
1377            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::GroupSummaryResponse`")))),
1378        }
1379    } else {
1380        let content = resp.text().await?;
1381        let entity: Option<GetGroupSummaryError> = serde_json::from_str(&content).ok();
1382        Err(Error::ResponseError(ResponseContent {
1383            status,
1384            content,
1385            entity,
1386        }))
1387    }
1388}
1389
1390/// Get a list of user IDs who joined the membership.
1391pub async fn get_joined_membership_users(
1392    configuration: &configuration::Configuration,
1393    membership_id: i32,
1394    start: Option<&str>,
1395    limit: Option<i32>,
1396) -> Result<models::GetJoinedMembershipUsersResponse, Error<GetJoinedMembershipUsersError>> {
1397    // add a prefix to parameters to efficiently prevent name collisions
1398    let p_path_membership_id = membership_id;
1399    let p_query_start = start;
1400    let p_query_limit = limit;
1401
1402    let uri_str = format!(
1403        "{}/v2/bot/membership/{membershipId}/users/ids",
1404        configuration.base_path,
1405        membershipId = p_path_membership_id
1406    );
1407    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1408
1409    if let Some(ref param_value) = p_query_start {
1410        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
1411    }
1412    if let Some(ref param_value) = p_query_limit {
1413        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1414    }
1415    if let Some(ref user_agent) = configuration.user_agent {
1416        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1417    }
1418    if let Some(ref token) = configuration.bearer_access_token {
1419        req_builder = req_builder.bearer_auth(token.to_owned());
1420    };
1421
1422    let req = req_builder.build()?;
1423    let resp = configuration.client.execute(req).await?;
1424
1425    let status = resp.status();
1426    let content_type = resp
1427        .headers()
1428        .get("content-type")
1429        .and_then(|v| v.to_str().ok())
1430        .unwrap_or("application/octet-stream");
1431    let content_type = super::ContentType::from(content_type);
1432
1433    if !status.is_client_error() && !status.is_server_error() {
1434        let content = resp.text().await?;
1435        match content_type {
1436            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1437            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetJoinedMembershipUsersResponse`"))),
1438            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::GetJoinedMembershipUsersResponse`")))),
1439        }
1440    } else {
1441        let content = resp.text().await?;
1442        let entity: Option<GetJoinedMembershipUsersError> = serde_json::from_str(&content).ok();
1443        Err(Error::ResponseError(ResponseContent {
1444            status,
1445            content,
1446            entity,
1447        }))
1448    }
1449}
1450
1451/// Get a list of memberships.
1452pub async fn get_membership_list(
1453    configuration: &configuration::Configuration,
1454) -> Result<models::MembershipListResponse, Error<GetMembershipListError>> {
1455    let uri_str = format!("{}/v2/bot/membership/list", configuration.base_path);
1456    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1457
1458    if let Some(ref user_agent) = configuration.user_agent {
1459        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1460    }
1461    if let Some(ref token) = configuration.bearer_access_token {
1462        req_builder = req_builder.bearer_auth(token.to_owned());
1463    };
1464
1465    let req = req_builder.build()?;
1466    let resp = configuration.client.execute(req).await?;
1467
1468    let status = resp.status();
1469    let content_type = resp
1470        .headers()
1471        .get("content-type")
1472        .and_then(|v| v.to_str().ok())
1473        .unwrap_or("application/octet-stream");
1474    let content_type = super::ContentType::from(content_type);
1475
1476    if !status.is_client_error() && !status.is_server_error() {
1477        let content = resp.text().await?;
1478        match content_type {
1479            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1480            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipListResponse`"))),
1481            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::MembershipListResponse`")))),
1482        }
1483    } else {
1484        let content = resp.text().await?;
1485        let entity: Option<GetMembershipListError> = serde_json::from_str(&content).ok();
1486        Err(Error::ResponseError(ResponseContent {
1487            status,
1488            content,
1489            entity,
1490        }))
1491    }
1492}
1493
1494/// Get a user's membership subscription.
1495pub async fn get_membership_subscription(
1496    configuration: &configuration::Configuration,
1497    user_id: &str,
1498) -> Result<models::GetMembershipSubscriptionResponse, Error<GetMembershipSubscriptionError>> {
1499    // add a prefix to parameters to efficiently prevent name collisions
1500    let p_path_user_id = user_id;
1501
1502    let uri_str = format!(
1503        "{}/v2/bot/membership/subscription/{userId}",
1504        configuration.base_path,
1505        userId = crate::apis::urlencode(p_path_user_id)
1506    );
1507    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1508
1509    if let Some(ref user_agent) = configuration.user_agent {
1510        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1511    }
1512    if let Some(ref token) = configuration.bearer_access_token {
1513        req_builder = req_builder.bearer_auth(token.to_owned());
1514    };
1515
1516    let req = req_builder.build()?;
1517    let resp = configuration.client.execute(req).await?;
1518
1519    let status = resp.status();
1520    let content_type = resp
1521        .headers()
1522        .get("content-type")
1523        .and_then(|v| v.to_str().ok())
1524        .unwrap_or("application/octet-stream");
1525    let content_type = super::ContentType::from(content_type);
1526
1527    if !status.is_client_error() && !status.is_server_error() {
1528        let content = resp.text().await?;
1529        match content_type {
1530            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1531            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMembershipSubscriptionResponse`"))),
1532            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::GetMembershipSubscriptionResponse`")))),
1533        }
1534    } else {
1535        let content = resp.text().await?;
1536        let entity: Option<GetMembershipSubscriptionError> = serde_json::from_str(&content).ok();
1537        Err(Error::ResponseError(ResponseContent {
1538            status,
1539            content,
1540            entity,
1541        }))
1542    }
1543}
1544
1545/// Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned.
1546pub async fn get_message_quota(
1547    configuration: &configuration::Configuration,
1548) -> Result<models::MessageQuotaResponse, Error<GetMessageQuotaError>> {
1549    let uri_str = format!("{}/v2/bot/message/quota", configuration.base_path);
1550    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1551
1552    if let Some(ref user_agent) = configuration.user_agent {
1553        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1554    }
1555    if let Some(ref token) = configuration.bearer_access_token {
1556        req_builder = req_builder.bearer_auth(token.to_owned());
1557    };
1558
1559    let req = req_builder.build()?;
1560    let resp = configuration.client.execute(req).await?;
1561
1562    let status = resp.status();
1563    let content_type = resp
1564        .headers()
1565        .get("content-type")
1566        .and_then(|v| v.to_str().ok())
1567        .unwrap_or("application/octet-stream");
1568    let content_type = super::ContentType::from(content_type);
1569
1570    if !status.is_client_error() && !status.is_server_error() {
1571        let content = resp.text().await?;
1572        match content_type {
1573            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1574            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MessageQuotaResponse`"))),
1575            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::MessageQuotaResponse`")))),
1576        }
1577    } else {
1578        let content = resp.text().await?;
1579        let entity: Option<GetMessageQuotaError> = serde_json::from_str(&content).ok();
1580        Err(Error::ResponseError(ResponseContent {
1581            status,
1582            content,
1583            entity,
1584        }))
1585    }
1586}
1587
1588/// Gets the number of messages sent in the current month.
1589pub async fn get_message_quota_consumption(
1590    configuration: &configuration::Configuration,
1591) -> Result<models::QuotaConsumptionResponse, Error<GetMessageQuotaConsumptionError>> {
1592    let uri_str = format!(
1593        "{}/v2/bot/message/quota/consumption",
1594        configuration.base_path
1595    );
1596    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1597
1598    if let Some(ref user_agent) = configuration.user_agent {
1599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1600    }
1601    if let Some(ref token) = configuration.bearer_access_token {
1602        req_builder = req_builder.bearer_auth(token.to_owned());
1603    };
1604
1605    let req = req_builder.build()?;
1606    let resp = configuration.client.execute(req).await?;
1607
1608    let status = resp.status();
1609    let content_type = resp
1610        .headers()
1611        .get("content-type")
1612        .and_then(|v| v.to_str().ok())
1613        .unwrap_or("application/octet-stream");
1614    let content_type = super::ContentType::from(content_type);
1615
1616    if !status.is_client_error() && !status.is_server_error() {
1617        let content = resp.text().await?;
1618        match content_type {
1619            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1620            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QuotaConsumptionResponse`"))),
1621            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::QuotaConsumptionResponse`")))),
1622        }
1623    } else {
1624        let content = resp.text().await?;
1625        let entity: Option<GetMessageQuotaConsumptionError> = serde_json::from_str(&content).ok();
1626        Err(Error::ResponseError(ResponseContent {
1627            status,
1628            content,
1629            entity,
1630        }))
1631    }
1632}
1633
1634/// Gets the status of a narrowcast message.
1635pub async fn get_narrowcast_progress(
1636    configuration: &configuration::Configuration,
1637    request_id: &str,
1638) -> Result<models::NarrowcastProgressResponse, Error<GetNarrowcastProgressError>> {
1639    // add a prefix to parameters to efficiently prevent name collisions
1640    let p_query_request_id = request_id;
1641
1642    let uri_str = format!(
1643        "{}/v2/bot/message/progress/narrowcast",
1644        configuration.base_path
1645    );
1646    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1647
1648    req_builder = req_builder.query(&[("requestId", &p_query_request_id.to_string())]);
1649    if let Some(ref user_agent) = configuration.user_agent {
1650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1651    }
1652    if let Some(ref token) = configuration.bearer_access_token {
1653        req_builder = req_builder.bearer_auth(token.to_owned());
1654    };
1655
1656    let req = req_builder.build()?;
1657    let resp = configuration.client.execute(req).await?;
1658
1659    let status = resp.status();
1660    let content_type = resp
1661        .headers()
1662        .get("content-type")
1663        .and_then(|v| v.to_str().ok())
1664        .unwrap_or("application/octet-stream");
1665    let content_type = super::ContentType::from(content_type);
1666
1667    if !status.is_client_error() && !status.is_server_error() {
1668        let content = resp.text().await?;
1669        match content_type {
1670            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1671            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NarrowcastProgressResponse`"))),
1672            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::NarrowcastProgressResponse`")))),
1673        }
1674    } else {
1675        let content = resp.text().await?;
1676        let entity: Option<GetNarrowcastProgressError> = serde_json::from_str(&content).ok();
1677        Err(Error::ResponseError(ResponseContent {
1678            status,
1679            content,
1680            entity,
1681        }))
1682    }
1683}
1684
1685/// Get number of sent broadcast messages
1686pub async fn get_number_of_sent_broadcast_messages(
1687    configuration: &configuration::Configuration,
1688    date: &str,
1689) -> Result<models::NumberOfMessagesResponse, Error<GetNumberOfSentBroadcastMessagesError>> {
1690    // add a prefix to parameters to efficiently prevent name collisions
1691    let p_query_date = date;
1692
1693    let uri_str = format!(
1694        "{}/v2/bot/message/delivery/broadcast",
1695        configuration.base_path
1696    );
1697    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1698
1699    req_builder = req_builder.query(&[("date", &p_query_date.to_string())]);
1700    if let Some(ref user_agent) = configuration.user_agent {
1701        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1702    }
1703    if let Some(ref token) = configuration.bearer_access_token {
1704        req_builder = req_builder.bearer_auth(token.to_owned());
1705    };
1706
1707    let req = req_builder.build()?;
1708    let resp = configuration.client.execute(req).await?;
1709
1710    let status = resp.status();
1711    let content_type = resp
1712        .headers()
1713        .get("content-type")
1714        .and_then(|v| v.to_str().ok())
1715        .unwrap_or("application/octet-stream");
1716    let content_type = super::ContentType::from(content_type);
1717
1718    if !status.is_client_error() && !status.is_server_error() {
1719        let content = resp.text().await?;
1720        match content_type {
1721            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1722            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NumberOfMessagesResponse`"))),
1723            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::NumberOfMessagesResponse`")))),
1724        }
1725    } else {
1726        let content = resp.text().await?;
1727        let entity: Option<GetNumberOfSentBroadcastMessagesError> =
1728            serde_json::from_str(&content).ok();
1729        Err(Error::ResponseError(ResponseContent {
1730            status,
1731            content,
1732            entity,
1733        }))
1734    }
1735}
1736
1737/// Get number of sent multicast messages
1738pub async fn get_number_of_sent_multicast_messages(
1739    configuration: &configuration::Configuration,
1740    date: &str,
1741) -> Result<models::NumberOfMessagesResponse, Error<GetNumberOfSentMulticastMessagesError>> {
1742    // add a prefix to parameters to efficiently prevent name collisions
1743    let p_query_date = date;
1744
1745    let uri_str = format!(
1746        "{}/v2/bot/message/delivery/multicast",
1747        configuration.base_path
1748    );
1749    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1750
1751    req_builder = req_builder.query(&[("date", &p_query_date.to_string())]);
1752    if let Some(ref user_agent) = configuration.user_agent {
1753        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1754    }
1755    if let Some(ref token) = configuration.bearer_access_token {
1756        req_builder = req_builder.bearer_auth(token.to_owned());
1757    };
1758
1759    let req = req_builder.build()?;
1760    let resp = configuration.client.execute(req).await?;
1761
1762    let status = resp.status();
1763    let content_type = resp
1764        .headers()
1765        .get("content-type")
1766        .and_then(|v| v.to_str().ok())
1767        .unwrap_or("application/octet-stream");
1768    let content_type = super::ContentType::from(content_type);
1769
1770    if !status.is_client_error() && !status.is_server_error() {
1771        let content = resp.text().await?;
1772        match content_type {
1773            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1774            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NumberOfMessagesResponse`"))),
1775            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::NumberOfMessagesResponse`")))),
1776        }
1777    } else {
1778        let content = resp.text().await?;
1779        let entity: Option<GetNumberOfSentMulticastMessagesError> =
1780            serde_json::from_str(&content).ok();
1781        Err(Error::ResponseError(ResponseContent {
1782            status,
1783            content,
1784            entity,
1785        }))
1786    }
1787}
1788
1789/// Get number of sent push messages
1790pub async fn get_number_of_sent_push_messages(
1791    configuration: &configuration::Configuration,
1792    date: &str,
1793) -> Result<models::NumberOfMessagesResponse, Error<GetNumberOfSentPushMessagesError>> {
1794    // add a prefix to parameters to efficiently prevent name collisions
1795    let p_query_date = date;
1796
1797    let uri_str = format!("{}/v2/bot/message/delivery/push", configuration.base_path);
1798    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1799
1800    req_builder = req_builder.query(&[("date", &p_query_date.to_string())]);
1801    if let Some(ref user_agent) = configuration.user_agent {
1802        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1803    }
1804    if let Some(ref token) = configuration.bearer_access_token {
1805        req_builder = req_builder.bearer_auth(token.to_owned());
1806    };
1807
1808    let req = req_builder.build()?;
1809    let resp = configuration.client.execute(req).await?;
1810
1811    let status = resp.status();
1812    let content_type = resp
1813        .headers()
1814        .get("content-type")
1815        .and_then(|v| v.to_str().ok())
1816        .unwrap_or("application/octet-stream");
1817    let content_type = super::ContentType::from(content_type);
1818
1819    if !status.is_client_error() && !status.is_server_error() {
1820        let content = resp.text().await?;
1821        match content_type {
1822            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1823            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NumberOfMessagesResponse`"))),
1824            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::NumberOfMessagesResponse`")))),
1825        }
1826    } else {
1827        let content = resp.text().await?;
1828        let entity: Option<GetNumberOfSentPushMessagesError> = serde_json::from_str(&content).ok();
1829        Err(Error::ResponseError(ResponseContent {
1830            status,
1831            content,
1832            entity,
1833        }))
1834    }
1835}
1836
1837/// Get number of sent reply messages
1838pub async fn get_number_of_sent_reply_messages(
1839    configuration: &configuration::Configuration,
1840    date: &str,
1841) -> Result<models::NumberOfMessagesResponse, Error<GetNumberOfSentReplyMessagesError>> {
1842    // add a prefix to parameters to efficiently prevent name collisions
1843    let p_query_date = date;
1844
1845    let uri_str = format!("{}/v2/bot/message/delivery/reply", configuration.base_path);
1846    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1847
1848    req_builder = req_builder.query(&[("date", &p_query_date.to_string())]);
1849    if let Some(ref user_agent) = configuration.user_agent {
1850        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1851    }
1852    if let Some(ref token) = configuration.bearer_access_token {
1853        req_builder = req_builder.bearer_auth(token.to_owned());
1854    };
1855
1856    let req = req_builder.build()?;
1857    let resp = configuration.client.execute(req).await?;
1858
1859    let status = resp.status();
1860    let content_type = resp
1861        .headers()
1862        .get("content-type")
1863        .and_then(|v| v.to_str().ok())
1864        .unwrap_or("application/octet-stream");
1865    let content_type = super::ContentType::from(content_type);
1866
1867    if !status.is_client_error() && !status.is_server_error() {
1868        let content = resp.text().await?;
1869        match content_type {
1870            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1871            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NumberOfMessagesResponse`"))),
1872            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::NumberOfMessagesResponse`")))),
1873        }
1874    } else {
1875        let content = resp.text().await?;
1876        let entity: Option<GetNumberOfSentReplyMessagesError> = serde_json::from_str(&content).ok();
1877        Err(Error::ResponseError(ResponseContent {
1878            status,
1879            content,
1880            entity,
1881        }))
1882    }
1883}
1884
1885/// Get number of sent LINE notification messages
1886pub async fn get_pnp_message_statistics(
1887    configuration: &configuration::Configuration,
1888    date: &str,
1889) -> Result<models::NumberOfMessagesResponse, Error<GetPnpMessageStatisticsError>> {
1890    // add a prefix to parameters to efficiently prevent name collisions
1891    let p_query_date = date;
1892
1893    let uri_str = format!("{}/v2/bot/message/delivery/pnp", configuration.base_path);
1894    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1895
1896    req_builder = req_builder.query(&[("date", &p_query_date.to_string())]);
1897    if let Some(ref user_agent) = configuration.user_agent {
1898        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1899    }
1900    if let Some(ref token) = configuration.bearer_access_token {
1901        req_builder = req_builder.bearer_auth(token.to_owned());
1902    };
1903
1904    let req = req_builder.build()?;
1905    let resp = configuration.client.execute(req).await?;
1906
1907    let status = resp.status();
1908    let content_type = resp
1909        .headers()
1910        .get("content-type")
1911        .and_then(|v| v.to_str().ok())
1912        .unwrap_or("application/octet-stream");
1913    let content_type = super::ContentType::from(content_type);
1914
1915    if !status.is_client_error() && !status.is_server_error() {
1916        let content = resp.text().await?;
1917        match content_type {
1918            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1919            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NumberOfMessagesResponse`"))),
1920            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::NumberOfMessagesResponse`")))),
1921        }
1922    } else {
1923        let content = resp.text().await?;
1924        let entity: Option<GetPnpMessageStatisticsError> = serde_json::from_str(&content).ok();
1925        Err(Error::ResponseError(ResponseContent {
1926            status,
1927            content,
1928            entity,
1929        }))
1930    }
1931}
1932
1933/// Get profile
1934pub async fn get_profile(
1935    configuration: &configuration::Configuration,
1936    user_id: &str,
1937) -> Result<models::UserProfileResponse, Error<GetProfileError>> {
1938    // add a prefix to parameters to efficiently prevent name collisions
1939    let p_path_user_id = user_id;
1940
1941    let uri_str = format!(
1942        "{}/v2/bot/profile/{userId}",
1943        configuration.base_path,
1944        userId = crate::apis::urlencode(p_path_user_id)
1945    );
1946    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1947
1948    if let Some(ref user_agent) = configuration.user_agent {
1949        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1950    }
1951    if let Some(ref token) = configuration.bearer_access_token {
1952        req_builder = req_builder.bearer_auth(token.to_owned());
1953    };
1954
1955    let req = req_builder.build()?;
1956    let resp = configuration.client.execute(req).await?;
1957
1958    let status = resp.status();
1959    let content_type = resp
1960        .headers()
1961        .get("content-type")
1962        .and_then(|v| v.to_str().ok())
1963        .unwrap_or("application/octet-stream");
1964    let content_type = super::ContentType::from(content_type);
1965
1966    if !status.is_client_error() && !status.is_server_error() {
1967        let content = resp.text().await?;
1968        match content_type {
1969            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1970            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserProfileResponse`"))),
1971            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::UserProfileResponse`")))),
1972        }
1973    } else {
1974        let content = resp.text().await?;
1975        let entity: Option<GetProfileError> = serde_json::from_str(&content).ok();
1976        Err(Error::ResponseError(ResponseContent {
1977            status,
1978            content,
1979            entity,
1980        }))
1981    }
1982}
1983
1984/// Gets a rich menu via a rich menu ID.
1985pub async fn get_rich_menu(
1986    configuration: &configuration::Configuration,
1987    rich_menu_id: &str,
1988) -> Result<models::RichMenuResponse, Error<GetRichMenuError>> {
1989    // add a prefix to parameters to efficiently prevent name collisions
1990    let p_path_rich_menu_id = rich_menu_id;
1991
1992    let uri_str = format!(
1993        "{}/v2/bot/richmenu/{richMenuId}",
1994        configuration.base_path,
1995        richMenuId = crate::apis::urlencode(p_path_rich_menu_id)
1996    );
1997    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1998
1999    if let Some(ref user_agent) = configuration.user_agent {
2000        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2001    }
2002    if let Some(ref token) = configuration.bearer_access_token {
2003        req_builder = req_builder.bearer_auth(token.to_owned());
2004    };
2005
2006    let req = req_builder.build()?;
2007    let resp = configuration.client.execute(req).await?;
2008
2009    let status = resp.status();
2010    let content_type = resp
2011        .headers()
2012        .get("content-type")
2013        .and_then(|v| v.to_str().ok())
2014        .unwrap_or("application/octet-stream");
2015    let content_type = super::ContentType::from(content_type);
2016
2017    if !status.is_client_error() && !status.is_server_error() {
2018        let content = resp.text().await?;
2019        match content_type {
2020            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2021            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuResponse`"))),
2022            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::RichMenuResponse`")))),
2023        }
2024    } else {
2025        let content = resp.text().await?;
2026        let entity: Option<GetRichMenuError> = serde_json::from_str(&content).ok();
2027        Err(Error::ResponseError(ResponseContent {
2028            status,
2029            content,
2030            entity,
2031        }))
2032    }
2033}
2034
2035/// Get rich menu alias information
2036pub async fn get_rich_menu_alias(
2037    configuration: &configuration::Configuration,
2038    rich_menu_alias_id: &str,
2039) -> Result<models::RichMenuAliasResponse, Error<GetRichMenuAliasError>> {
2040    // add a prefix to parameters to efficiently prevent name collisions
2041    let p_path_rich_menu_alias_id = rich_menu_alias_id;
2042
2043    let uri_str = format!(
2044        "{}/v2/bot/richmenu/alias/{richMenuAliasId}",
2045        configuration.base_path,
2046        richMenuAliasId = crate::apis::urlencode(p_path_rich_menu_alias_id)
2047    );
2048    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2049
2050    if let Some(ref user_agent) = configuration.user_agent {
2051        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2052    }
2053    if let Some(ref token) = configuration.bearer_access_token {
2054        req_builder = req_builder.bearer_auth(token.to_owned());
2055    };
2056
2057    let req = req_builder.build()?;
2058    let resp = configuration.client.execute(req).await?;
2059
2060    let status = resp.status();
2061    let content_type = resp
2062        .headers()
2063        .get("content-type")
2064        .and_then(|v| v.to_str().ok())
2065        .unwrap_or("application/octet-stream");
2066    let content_type = super::ContentType::from(content_type);
2067
2068    if !status.is_client_error() && !status.is_server_error() {
2069        let content = resp.text().await?;
2070        match content_type {
2071            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2072            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuAliasResponse`"))),
2073            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::RichMenuAliasResponse`")))),
2074        }
2075    } else {
2076        let content = resp.text().await?;
2077        let entity: Option<GetRichMenuAliasError> = serde_json::from_str(&content).ok();
2078        Err(Error::ResponseError(ResponseContent {
2079            status,
2080            content,
2081            entity,
2082        }))
2083    }
2084}
2085
2086/// Get list of rich menu alias
2087pub async fn get_rich_menu_alias_list(
2088    configuration: &configuration::Configuration,
2089) -> Result<models::RichMenuAliasListResponse, Error<GetRichMenuAliasListError>> {
2090    let uri_str = format!("{}/v2/bot/richmenu/alias/list", configuration.base_path);
2091    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2092
2093    if let Some(ref user_agent) = configuration.user_agent {
2094        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2095    }
2096    if let Some(ref token) = configuration.bearer_access_token {
2097        req_builder = req_builder.bearer_auth(token.to_owned());
2098    };
2099
2100    let req = req_builder.build()?;
2101    let resp = configuration.client.execute(req).await?;
2102
2103    let status = resp.status();
2104    let content_type = resp
2105        .headers()
2106        .get("content-type")
2107        .and_then(|v| v.to_str().ok())
2108        .unwrap_or("application/octet-stream");
2109    let content_type = super::ContentType::from(content_type);
2110
2111    if !status.is_client_error() && !status.is_server_error() {
2112        let content = resp.text().await?;
2113        match content_type {
2114            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2115            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuAliasListResponse`"))),
2116            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::RichMenuAliasListResponse`")))),
2117        }
2118    } else {
2119        let content = resp.text().await?;
2120        let entity: Option<GetRichMenuAliasListError> = serde_json::from_str(&content).ok();
2121        Err(Error::ResponseError(ResponseContent {
2122            status,
2123            content,
2124            entity,
2125        }))
2126    }
2127}
2128
2129/// Get the status of Replace or unlink a linked rich menus in batches.
2130pub async fn get_rich_menu_batch_progress(
2131    configuration: &configuration::Configuration,
2132    request_id: &str,
2133) -> Result<models::RichMenuBatchProgressResponse, Error<GetRichMenuBatchProgressError>> {
2134    // add a prefix to parameters to efficiently prevent name collisions
2135    let p_query_request_id = request_id;
2136
2137    let uri_str = format!("{}/v2/bot/richmenu/progress/batch", configuration.base_path);
2138    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2139
2140    req_builder = req_builder.query(&[("requestId", &p_query_request_id.to_string())]);
2141    if let Some(ref user_agent) = configuration.user_agent {
2142        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2143    }
2144    if let Some(ref token) = configuration.bearer_access_token {
2145        req_builder = req_builder.bearer_auth(token.to_owned());
2146    };
2147
2148    let req = req_builder.build()?;
2149    let resp = configuration.client.execute(req).await?;
2150
2151    let status = resp.status();
2152    let content_type = resp
2153        .headers()
2154        .get("content-type")
2155        .and_then(|v| v.to_str().ok())
2156        .unwrap_or("application/octet-stream");
2157    let content_type = super::ContentType::from(content_type);
2158
2159    if !status.is_client_error() && !status.is_server_error() {
2160        let content = resp.text().await?;
2161        match content_type {
2162            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2163            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuBatchProgressResponse`"))),
2164            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::RichMenuBatchProgressResponse`")))),
2165        }
2166    } else {
2167        let content = resp.text().await?;
2168        let entity: Option<GetRichMenuBatchProgressError> = serde_json::from_str(&content).ok();
2169        Err(Error::ResponseError(ResponseContent {
2170            status,
2171            content,
2172            entity,
2173        }))
2174    }
2175}
2176
2177/// Get rich menu ID of user
2178pub async fn get_rich_menu_id_of_user(
2179    configuration: &configuration::Configuration,
2180    user_id: &str,
2181) -> Result<models::RichMenuIdResponse, Error<GetRichMenuIdOfUserError>> {
2182    // add a prefix to parameters to efficiently prevent name collisions
2183    let p_path_user_id = user_id;
2184
2185    let uri_str = format!(
2186        "{}/v2/bot/user/{userId}/richmenu",
2187        configuration.base_path,
2188        userId = crate::apis::urlencode(p_path_user_id)
2189    );
2190    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2191
2192    if let Some(ref user_agent) = configuration.user_agent {
2193        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2194    }
2195    if let Some(ref token) = configuration.bearer_access_token {
2196        req_builder = req_builder.bearer_auth(token.to_owned());
2197    };
2198
2199    let req = req_builder.build()?;
2200    let resp = configuration.client.execute(req).await?;
2201
2202    let status = resp.status();
2203    let content_type = resp
2204        .headers()
2205        .get("content-type")
2206        .and_then(|v| v.to_str().ok())
2207        .unwrap_or("application/octet-stream");
2208    let content_type = super::ContentType::from(content_type);
2209
2210    if !status.is_client_error() && !status.is_server_error() {
2211        let content = resp.text().await?;
2212        match content_type {
2213            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2214            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuIdResponse`"))),
2215            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::RichMenuIdResponse`")))),
2216        }
2217    } else {
2218        let content = resp.text().await?;
2219        let entity: Option<GetRichMenuIdOfUserError> = serde_json::from_str(&content).ok();
2220        Err(Error::ResponseError(ResponseContent {
2221            status,
2222            content,
2223            entity,
2224        }))
2225    }
2226}
2227
2228/// Get rich menu list
2229pub async fn get_rich_menu_list(
2230    configuration: &configuration::Configuration,
2231) -> Result<models::RichMenuListResponse, Error<GetRichMenuListError>> {
2232    let uri_str = format!("{}/v2/bot/richmenu/list", configuration.base_path);
2233    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2234
2235    if let Some(ref user_agent) = configuration.user_agent {
2236        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2237    }
2238    if let Some(ref token) = configuration.bearer_access_token {
2239        req_builder = req_builder.bearer_auth(token.to_owned());
2240    };
2241
2242    let req = req_builder.build()?;
2243    let resp = configuration.client.execute(req).await?;
2244
2245    let status = resp.status();
2246    let content_type = resp
2247        .headers()
2248        .get("content-type")
2249        .and_then(|v| v.to_str().ok())
2250        .unwrap_or("application/octet-stream");
2251    let content_type = super::ContentType::from(content_type);
2252
2253    if !status.is_client_error() && !status.is_server_error() {
2254        let content = resp.text().await?;
2255        match content_type {
2256            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2257            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RichMenuListResponse`"))),
2258            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::RichMenuListResponse`")))),
2259        }
2260    } else {
2261        let content = resp.text().await?;
2262        let entity: Option<GetRichMenuListError> = serde_json::from_str(&content).ok();
2263        Err(Error::ResponseError(ResponseContent {
2264            status,
2265            content,
2266            entity,
2267        }))
2268    }
2269}
2270
2271/// Get number of users in a multi-person chat
2272pub async fn get_room_member_count(
2273    configuration: &configuration::Configuration,
2274    room_id: &str,
2275) -> Result<models::RoomMemberCountResponse, Error<GetRoomMemberCountError>> {
2276    // add a prefix to parameters to efficiently prevent name collisions
2277    let p_path_room_id = room_id;
2278
2279    let uri_str = format!(
2280        "{}/v2/bot/room/{roomId}/members/count",
2281        configuration.base_path,
2282        roomId = crate::apis::urlencode(p_path_room_id)
2283    );
2284    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2285
2286    if let Some(ref user_agent) = configuration.user_agent {
2287        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2288    }
2289    if let Some(ref token) = configuration.bearer_access_token {
2290        req_builder = req_builder.bearer_auth(token.to_owned());
2291    };
2292
2293    let req = req_builder.build()?;
2294    let resp = configuration.client.execute(req).await?;
2295
2296    let status = resp.status();
2297    let content_type = resp
2298        .headers()
2299        .get("content-type")
2300        .and_then(|v| v.to_str().ok())
2301        .unwrap_or("application/octet-stream");
2302    let content_type = super::ContentType::from(content_type);
2303
2304    if !status.is_client_error() && !status.is_server_error() {
2305        let content = resp.text().await?;
2306        match content_type {
2307            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2308            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoomMemberCountResponse`"))),
2309            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::RoomMemberCountResponse`")))),
2310        }
2311    } else {
2312        let content = resp.text().await?;
2313        let entity: Option<GetRoomMemberCountError> = serde_json::from_str(&content).ok();
2314        Err(Error::ResponseError(ResponseContent {
2315            status,
2316            content,
2317            entity,
2318        }))
2319    }
2320}
2321
2322/// Get multi-person chat member profile
2323pub async fn get_room_member_profile(
2324    configuration: &configuration::Configuration,
2325    room_id: &str,
2326    user_id: &str,
2327) -> Result<models::RoomUserProfileResponse, Error<GetRoomMemberProfileError>> {
2328    // add a prefix to parameters to efficiently prevent name collisions
2329    let p_path_room_id = room_id;
2330    let p_path_user_id = user_id;
2331
2332    let uri_str = format!(
2333        "{}/v2/bot/room/{roomId}/member/{userId}",
2334        configuration.base_path,
2335        roomId = crate::apis::urlencode(p_path_room_id),
2336        userId = crate::apis::urlencode(p_path_user_id)
2337    );
2338    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2339
2340    if let Some(ref user_agent) = configuration.user_agent {
2341        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2342    }
2343    if let Some(ref token) = configuration.bearer_access_token {
2344        req_builder = req_builder.bearer_auth(token.to_owned());
2345    };
2346
2347    let req = req_builder.build()?;
2348    let resp = configuration.client.execute(req).await?;
2349
2350    let status = resp.status();
2351    let content_type = resp
2352        .headers()
2353        .get("content-type")
2354        .and_then(|v| v.to_str().ok())
2355        .unwrap_or("application/octet-stream");
2356    let content_type = super::ContentType::from(content_type);
2357
2358    if !status.is_client_error() && !status.is_server_error() {
2359        let content = resp.text().await?;
2360        match content_type {
2361            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2362            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoomUserProfileResponse`"))),
2363            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::RoomUserProfileResponse`")))),
2364        }
2365    } else {
2366        let content = resp.text().await?;
2367        let entity: Option<GetRoomMemberProfileError> = serde_json::from_str(&content).ok();
2368        Err(Error::ResponseError(ResponseContent {
2369            status,
2370            content,
2371            entity,
2372        }))
2373    }
2374}
2375
2376/// Get multi-person chat member user IDs
2377pub async fn get_room_members_ids(
2378    configuration: &configuration::Configuration,
2379    room_id: &str,
2380    start: Option<&str>,
2381) -> Result<models::MembersIdsResponse, Error<GetRoomMembersIdsError>> {
2382    // add a prefix to parameters to efficiently prevent name collisions
2383    let p_path_room_id = room_id;
2384    let p_query_start = start;
2385
2386    let uri_str = format!(
2387        "{}/v2/bot/room/{roomId}/members/ids",
2388        configuration.base_path,
2389        roomId = crate::apis::urlencode(p_path_room_id)
2390    );
2391    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2392
2393    if let Some(ref param_value) = p_query_start {
2394        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
2395    }
2396    if let Some(ref user_agent) = configuration.user_agent {
2397        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2398    }
2399    if let Some(ref token) = configuration.bearer_access_token {
2400        req_builder = req_builder.bearer_auth(token.to_owned());
2401    };
2402
2403    let req = req_builder.build()?;
2404    let resp = configuration.client.execute(req).await?;
2405
2406    let status = resp.status();
2407    let content_type = resp
2408        .headers()
2409        .get("content-type")
2410        .and_then(|v| v.to_str().ok())
2411        .unwrap_or("application/octet-stream");
2412    let content_type = super::ContentType::from(content_type);
2413
2414    if !status.is_client_error() && !status.is_server_error() {
2415        let content = resp.text().await?;
2416        match content_type {
2417            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2418            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembersIdsResponse`"))),
2419            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::MembersIdsResponse`")))),
2420        }
2421    } else {
2422        let content = resp.text().await?;
2423        let entity: Option<GetRoomMembersIdsError> = serde_json::from_str(&content).ok();
2424        Err(Error::ResponseError(ResponseContent {
2425            status,
2426            content,
2427            entity,
2428        }))
2429    }
2430}
2431
2432/// Get webhook endpoint information
2433pub async fn get_webhook_endpoint(
2434    configuration: &configuration::Configuration,
2435) -> Result<models::GetWebhookEndpointResponse, Error<GetWebhookEndpointError>> {
2436    let uri_str = format!(
2437        "{}/v2/bot/channel/webhook/endpoint",
2438        configuration.base_path
2439    );
2440    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2441
2442    if let Some(ref user_agent) = configuration.user_agent {
2443        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2444    }
2445    if let Some(ref token) = configuration.bearer_access_token {
2446        req_builder = req_builder.bearer_auth(token.to_owned());
2447    };
2448
2449    let req = req_builder.build()?;
2450    let resp = configuration.client.execute(req).await?;
2451
2452    let status = resp.status();
2453    let content_type = resp
2454        .headers()
2455        .get("content-type")
2456        .and_then(|v| v.to_str().ok())
2457        .unwrap_or("application/octet-stream");
2458    let content_type = super::ContentType::from(content_type);
2459
2460    if !status.is_client_error() && !status.is_server_error() {
2461        let content = resp.text().await?;
2462        match content_type {
2463            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2464            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetWebhookEndpointResponse`"))),
2465            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::GetWebhookEndpointResponse`")))),
2466        }
2467    } else {
2468        let content = resp.text().await?;
2469        let entity: Option<GetWebhookEndpointError> = serde_json::from_str(&content).ok();
2470        Err(Error::ResponseError(ResponseContent {
2471            status,
2472            content,
2473            entity,
2474        }))
2475    }
2476}
2477
2478/// Issue link token
2479pub async fn issue_link_token(
2480    configuration: &configuration::Configuration,
2481    user_id: &str,
2482) -> Result<models::IssueLinkTokenResponse, Error<IssueLinkTokenError>> {
2483    // add a prefix to parameters to efficiently prevent name collisions
2484    let p_path_user_id = user_id;
2485
2486    let uri_str = format!(
2487        "{}/v2/bot/user/{userId}/linkToken",
2488        configuration.base_path,
2489        userId = crate::apis::urlencode(p_path_user_id)
2490    );
2491    let mut req_builder = configuration
2492        .client
2493        .request(reqwest::Method::POST, &uri_str);
2494
2495    if let Some(ref user_agent) = configuration.user_agent {
2496        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2497    }
2498    if let Some(ref token) = configuration.bearer_access_token {
2499        req_builder = req_builder.bearer_auth(token.to_owned());
2500    };
2501
2502    let req = req_builder.build()?;
2503    let resp = configuration.client.execute(req).await?;
2504
2505    let status = resp.status();
2506    let content_type = resp
2507        .headers()
2508        .get("content-type")
2509        .and_then(|v| v.to_str().ok())
2510        .unwrap_or("application/octet-stream");
2511    let content_type = super::ContentType::from(content_type);
2512
2513    if !status.is_client_error() && !status.is_server_error() {
2514        let content = resp.text().await?;
2515        match content_type {
2516            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2517            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueLinkTokenResponse`"))),
2518            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::IssueLinkTokenResponse`")))),
2519        }
2520    } else {
2521        let content = resp.text().await?;
2522        let entity: Option<IssueLinkTokenError> = serde_json::from_str(&content).ok();
2523        Err(Error::ResponseError(ResponseContent {
2524            status,
2525            content,
2526            entity,
2527        }))
2528    }
2529}
2530
2531/// Leave group chat
2532pub async fn leave_group(
2533    configuration: &configuration::Configuration,
2534    group_id: &str,
2535) -> Result<(), Error<LeaveGroupError>> {
2536    // add a prefix to parameters to efficiently prevent name collisions
2537    let p_path_group_id = group_id;
2538
2539    let uri_str = format!(
2540        "{}/v2/bot/group/{groupId}/leave",
2541        configuration.base_path,
2542        groupId = crate::apis::urlencode(p_path_group_id)
2543    );
2544    let mut req_builder = configuration
2545        .client
2546        .request(reqwest::Method::POST, &uri_str);
2547
2548    if let Some(ref user_agent) = configuration.user_agent {
2549        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2550    }
2551    if let Some(ref token) = configuration.bearer_access_token {
2552        req_builder = req_builder.bearer_auth(token.to_owned());
2553    };
2554
2555    let req = req_builder.build()?;
2556    let resp = configuration.client.execute(req).await?;
2557
2558    let status = resp.status();
2559
2560    if !status.is_client_error() && !status.is_server_error() {
2561        Ok(())
2562    } else {
2563        let content = resp.text().await?;
2564        let entity: Option<LeaveGroupError> = serde_json::from_str(&content).ok();
2565        Err(Error::ResponseError(ResponseContent {
2566            status,
2567            content,
2568            entity,
2569        }))
2570    }
2571}
2572
2573/// Leave multi-person chat
2574pub async fn leave_room(
2575    configuration: &configuration::Configuration,
2576    room_id: &str,
2577) -> Result<(), Error<LeaveRoomError>> {
2578    // add a prefix to parameters to efficiently prevent name collisions
2579    let p_path_room_id = room_id;
2580
2581    let uri_str = format!(
2582        "{}/v2/bot/room/{roomId}/leave",
2583        configuration.base_path,
2584        roomId = crate::apis::urlencode(p_path_room_id)
2585    );
2586    let mut req_builder = configuration
2587        .client
2588        .request(reqwest::Method::POST, &uri_str);
2589
2590    if let Some(ref user_agent) = configuration.user_agent {
2591        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2592    }
2593    if let Some(ref token) = configuration.bearer_access_token {
2594        req_builder = req_builder.bearer_auth(token.to_owned());
2595    };
2596
2597    let req = req_builder.build()?;
2598    let resp = configuration.client.execute(req).await?;
2599
2600    let status = resp.status();
2601
2602    if !status.is_client_error() && !status.is_server_error() {
2603        Ok(())
2604    } else {
2605        let content = resp.text().await?;
2606        let entity: Option<LeaveRoomError> = serde_json::from_str(&content).ok();
2607        Err(Error::ResponseError(ResponseContent {
2608            status,
2609            content,
2610            entity,
2611        }))
2612    }
2613}
2614
2615/// Link rich menu to user.
2616pub async fn link_rich_menu_id_to_user(
2617    configuration: &configuration::Configuration,
2618    user_id: &str,
2619    rich_menu_id: &str,
2620) -> Result<(), Error<LinkRichMenuIdToUserError>> {
2621    // add a prefix to parameters to efficiently prevent name collisions
2622    let p_path_user_id = user_id;
2623    let p_path_rich_menu_id = rich_menu_id;
2624
2625    let uri_str = format!(
2626        "{}/v2/bot/user/{userId}/richmenu/{richMenuId}",
2627        configuration.base_path,
2628        userId = crate::apis::urlencode(p_path_user_id),
2629        richMenuId = crate::apis::urlencode(p_path_rich_menu_id)
2630    );
2631    let mut req_builder = configuration
2632        .client
2633        .request(reqwest::Method::POST, &uri_str);
2634
2635    if let Some(ref user_agent) = configuration.user_agent {
2636        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2637    }
2638    if let Some(ref token) = configuration.bearer_access_token {
2639        req_builder = req_builder.bearer_auth(token.to_owned());
2640    };
2641
2642    let req = req_builder.build()?;
2643    let resp = configuration.client.execute(req).await?;
2644
2645    let status = resp.status();
2646
2647    if !status.is_client_error() && !status.is_server_error() {
2648        Ok(())
2649    } else {
2650        let content = resp.text().await?;
2651        let entity: Option<LinkRichMenuIdToUserError> = serde_json::from_str(&content).ok();
2652        Err(Error::ResponseError(ResponseContent {
2653            status,
2654            content,
2655            entity,
2656        }))
2657    }
2658}
2659
2660/// Link rich menu to multiple users
2661pub async fn link_rich_menu_id_to_users(
2662    configuration: &configuration::Configuration,
2663    rich_menu_bulk_link_request: models::RichMenuBulkLinkRequest,
2664) -> Result<(), Error<LinkRichMenuIdToUsersError>> {
2665    // add a prefix to parameters to efficiently prevent name collisions
2666    let p_body_rich_menu_bulk_link_request = rich_menu_bulk_link_request;
2667
2668    let uri_str = format!("{}/v2/bot/richmenu/bulk/link", configuration.base_path);
2669    let mut req_builder = configuration
2670        .client
2671        .request(reqwest::Method::POST, &uri_str);
2672
2673    if let Some(ref user_agent) = configuration.user_agent {
2674        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2675    }
2676    if let Some(ref token) = configuration.bearer_access_token {
2677        req_builder = req_builder.bearer_auth(token.to_owned());
2678    };
2679    req_builder = req_builder.json(&p_body_rich_menu_bulk_link_request);
2680
2681    let req = req_builder.build()?;
2682    let resp = configuration.client.execute(req).await?;
2683
2684    let status = resp.status();
2685
2686    if !status.is_client_error() && !status.is_server_error() {
2687        Ok(())
2688    } else {
2689        let content = resp.text().await?;
2690        let entity: Option<LinkRichMenuIdToUsersError> = serde_json::from_str(&content).ok();
2691        Err(Error::ResponseError(ResponseContent {
2692            status,
2693            content,
2694            entity,
2695        }))
2696    }
2697}
2698
2699/// Get a paginated list of coupons.
2700pub async fn list_coupon(
2701    configuration: &configuration::Configuration,
2702    status: Option<Vec<String>>,
2703    start: Option<&str>,
2704    limit: Option<i32>,
2705) -> Result<models::MessagingApiPagerCouponListResponse, Error<ListCouponError>> {
2706    // add a prefix to parameters to efficiently prevent name collisions
2707    let p_query_status = status;
2708    let p_query_start = start;
2709    let p_query_limit = limit;
2710
2711    let uri_str = format!("{}/v2/bot/coupon", configuration.base_path);
2712    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2713
2714    if let Some(ref param_value) = p_query_status {
2715        req_builder = match "multi" {
2716            "multi" => req_builder.query(
2717                &param_value
2718                    .into_iter()
2719                    .map(|p| ("status".to_owned(), p.to_string()))
2720                    .collect::<Vec<(std::string::String, std::string::String)>>(),
2721            ),
2722            _ => req_builder.query(&[(
2723                "status",
2724                &param_value
2725                    .into_iter()
2726                    .map(|p| p.to_string())
2727                    .collect::<Vec<String>>()
2728                    .join(",")
2729                    .to_string(),
2730            )]),
2731        };
2732    }
2733    if let Some(ref param_value) = p_query_start {
2734        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
2735    }
2736    if let Some(ref param_value) = p_query_limit {
2737        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2738    }
2739    if let Some(ref user_agent) = configuration.user_agent {
2740        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2741    }
2742    if let Some(ref token) = configuration.bearer_access_token {
2743        req_builder = req_builder.bearer_auth(token.to_owned());
2744    };
2745
2746    let req = req_builder.build()?;
2747    let resp = configuration.client.execute(req).await?;
2748
2749    let status = resp.status();
2750    let content_type = resp
2751        .headers()
2752        .get("content-type")
2753        .and_then(|v| v.to_str().ok())
2754        .unwrap_or("application/octet-stream");
2755    let content_type = super::ContentType::from(content_type);
2756
2757    if !status.is_client_error() && !status.is_server_error() {
2758        let content = resp.text().await?;
2759        match content_type {
2760            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2761            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MessagingApiPagerCouponListResponse`"))),
2762            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::MessagingApiPagerCouponListResponse`")))),
2763        }
2764    } else {
2765        let content = resp.text().await?;
2766        let entity: Option<ListCouponError> = serde_json::from_str(&content).ok();
2767        Err(Error::ResponseError(ResponseContent {
2768            status,
2769            content,
2770            entity,
2771        }))
2772    }
2773}
2774
2775/// Mark messages from users as read
2776pub async fn mark_messages_as_read(
2777    configuration: &configuration::Configuration,
2778    mark_messages_as_read_request: models::MarkMessagesAsReadRequest,
2779) -> Result<(), Error<MarkMessagesAsReadError>> {
2780    // add a prefix to parameters to efficiently prevent name collisions
2781    let p_body_mark_messages_as_read_request = mark_messages_as_read_request;
2782
2783    let uri_str = format!("{}/v2/bot/message/markAsRead", configuration.base_path);
2784    let mut req_builder = configuration
2785        .client
2786        .request(reqwest::Method::POST, &uri_str);
2787
2788    if let Some(ref user_agent) = configuration.user_agent {
2789        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2790    }
2791    if let Some(ref token) = configuration.bearer_access_token {
2792        req_builder = req_builder.bearer_auth(token.to_owned());
2793    };
2794    req_builder = req_builder.json(&p_body_mark_messages_as_read_request);
2795
2796    let req = req_builder.build()?;
2797    let resp = configuration.client.execute(req).await?;
2798
2799    let status = resp.status();
2800
2801    if !status.is_client_error() && !status.is_server_error() {
2802        Ok(())
2803    } else {
2804        let content = resp.text().await?;
2805        let entity: Option<MarkMessagesAsReadError> = serde_json::from_str(&content).ok();
2806        Err(Error::ResponseError(ResponseContent {
2807            status,
2808            content,
2809            entity,
2810        }))
2811    }
2812}
2813
2814/// Mark messages from users as read by token
2815pub async fn mark_messages_as_read_by_token(
2816    configuration: &configuration::Configuration,
2817    mark_messages_as_read_by_token_request: models::MarkMessagesAsReadByTokenRequest,
2818) -> Result<(), Error<MarkMessagesAsReadByTokenError>> {
2819    // add a prefix to parameters to efficiently prevent name collisions
2820    let p_body_mark_messages_as_read_by_token_request = mark_messages_as_read_by_token_request;
2821
2822    let uri_str = format!("{}/v2/bot/chat/markAsRead", configuration.base_path);
2823    let mut req_builder = configuration
2824        .client
2825        .request(reqwest::Method::POST, &uri_str);
2826
2827    if let Some(ref user_agent) = configuration.user_agent {
2828        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2829    }
2830    if let Some(ref token) = configuration.bearer_access_token {
2831        req_builder = req_builder.bearer_auth(token.to_owned());
2832    };
2833    req_builder = req_builder.json(&p_body_mark_messages_as_read_by_token_request);
2834
2835    let req = req_builder.build()?;
2836    let resp = configuration.client.execute(req).await?;
2837
2838    let status = resp.status();
2839
2840    if !status.is_client_error() && !status.is_server_error() {
2841        Ok(())
2842    } else {
2843        let content = resp.text().await?;
2844        let entity: Option<MarkMessagesAsReadByTokenError> = serde_json::from_str(&content).ok();
2845        Err(Error::ResponseError(ResponseContent {
2846            status,
2847            content,
2848            entity,
2849        }))
2850    }
2851}
2852
2853/// An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats.
2854pub async fn multicast(
2855    configuration: &configuration::Configuration,
2856    multicast_request: models::MulticastRequest,
2857    x_line_retry_key: Option<&str>,
2858) -> Result<serde_json::Value, Error<MulticastError>> {
2859    // add a prefix to parameters to efficiently prevent name collisions
2860    let p_body_multicast_request = multicast_request;
2861    let p_header_x_line_retry_key = x_line_retry_key;
2862
2863    let uri_str = format!("{}/v2/bot/message/multicast", configuration.base_path);
2864    let mut req_builder = configuration
2865        .client
2866        .request(reqwest::Method::POST, &uri_str);
2867
2868    if let Some(ref user_agent) = configuration.user_agent {
2869        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2870    }
2871    if let Some(param_value) = p_header_x_line_retry_key {
2872        req_builder = req_builder.header("X-Line-Retry-Key", param_value.to_string());
2873    }
2874    if let Some(ref token) = configuration.bearer_access_token {
2875        req_builder = req_builder.bearer_auth(token.to_owned());
2876    };
2877    req_builder = req_builder.json(&p_body_multicast_request);
2878
2879    let req = req_builder.build()?;
2880    let resp = configuration.client.execute(req).await?;
2881
2882    let status = resp.status();
2883    let content_type = resp
2884        .headers()
2885        .get("content-type")
2886        .and_then(|v| v.to_str().ok())
2887        .unwrap_or("application/octet-stream");
2888    let content_type = super::ContentType::from(content_type);
2889
2890    if !status.is_client_error() && !status.is_server_error() {
2891        let content = resp.text().await?;
2892        match content_type {
2893            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2894            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2895            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2896        }
2897    } else {
2898        let content = resp.text().await?;
2899        let entity: Option<MulticastError> = serde_json::from_str(&content).ok();
2900        Err(Error::ResponseError(ResponseContent {
2901            status,
2902            content,
2903            entity,
2904        }))
2905    }
2906}
2907
2908/// Send narrowcast message
2909pub async fn narrowcast(
2910    configuration: &configuration::Configuration,
2911    narrowcast_request: models::NarrowcastRequest,
2912    x_line_retry_key: Option<&str>,
2913) -> Result<serde_json::Value, Error<NarrowcastError>> {
2914    // add a prefix to parameters to efficiently prevent name collisions
2915    let p_body_narrowcast_request = narrowcast_request;
2916    let p_header_x_line_retry_key = x_line_retry_key;
2917
2918    let uri_str = format!("{}/v2/bot/message/narrowcast", configuration.base_path);
2919    let mut req_builder = configuration
2920        .client
2921        .request(reqwest::Method::POST, &uri_str);
2922
2923    if let Some(ref user_agent) = configuration.user_agent {
2924        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2925    }
2926    if let Some(param_value) = p_header_x_line_retry_key {
2927        req_builder = req_builder.header("X-Line-Retry-Key", param_value.to_string());
2928    }
2929    if let Some(ref token) = configuration.bearer_access_token {
2930        req_builder = req_builder.bearer_auth(token.to_owned());
2931    };
2932    req_builder = req_builder.json(&p_body_narrowcast_request);
2933
2934    let req = req_builder.build()?;
2935    let resp = configuration.client.execute(req).await?;
2936
2937    let status = resp.status();
2938    let content_type = resp
2939        .headers()
2940        .get("content-type")
2941        .and_then(|v| v.to_str().ok())
2942        .unwrap_or("application/octet-stream");
2943    let content_type = super::ContentType::from(content_type);
2944
2945    if !status.is_client_error() && !status.is_server_error() {
2946        let content = resp.text().await?;
2947        match content_type {
2948            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2949            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2950            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2951        }
2952    } else {
2953        let content = resp.text().await?;
2954        let entity: Option<NarrowcastError> = serde_json::from_str(&content).ok();
2955        Err(Error::ResponseError(ResponseContent {
2956            status,
2957            content,
2958            entity,
2959        }))
2960    }
2961}
2962
2963/// Sends a message to a user, group chat, or multi-person chat at any time.
2964pub async fn push_message(
2965    configuration: &configuration::Configuration,
2966    push_message_request: models::PushMessageRequest,
2967    x_line_retry_key: Option<&str>,
2968) -> Result<models::PushMessageResponse, Error<PushMessageError>> {
2969    // add a prefix to parameters to efficiently prevent name collisions
2970    let p_body_push_message_request = push_message_request;
2971    let p_header_x_line_retry_key = x_line_retry_key;
2972
2973    let uri_str = format!("{}/v2/bot/message/push", configuration.base_path);
2974    let mut req_builder = configuration
2975        .client
2976        .request(reqwest::Method::POST, &uri_str);
2977
2978    if let Some(ref user_agent) = configuration.user_agent {
2979        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2980    }
2981    if let Some(param_value) = p_header_x_line_retry_key {
2982        req_builder = req_builder.header("X-Line-Retry-Key", param_value.to_string());
2983    }
2984    if let Some(ref token) = configuration.bearer_access_token {
2985        req_builder = req_builder.bearer_auth(token.to_owned());
2986    };
2987    req_builder = req_builder.json(&p_body_push_message_request);
2988
2989    let req = req_builder.build()?;
2990    let resp = configuration.client.execute(req).await?;
2991
2992    let status = resp.status();
2993    let content_type = resp
2994        .headers()
2995        .get("content-type")
2996        .and_then(|v| v.to_str().ok())
2997        .unwrap_or("application/octet-stream");
2998    let content_type = super::ContentType::from(content_type);
2999
3000    if !status.is_client_error() && !status.is_server_error() {
3001        let content = resp.text().await?;
3002        match content_type {
3003            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3004            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PushMessageResponse`"))),
3005            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::PushMessageResponse`")))),
3006        }
3007    } else {
3008        let content = resp.text().await?;
3009        let entity: Option<PushMessageError> = serde_json::from_str(&content).ok();
3010        Err(Error::ResponseError(ResponseContent {
3011            status,
3012            content,
3013            entity,
3014        }))
3015    }
3016}
3017
3018/// Send LINE notification message
3019pub async fn push_messages_by_phone(
3020    configuration: &configuration::Configuration,
3021    pnp_messages_request: models::PnpMessagesRequest,
3022    x_line_delivery_tag: Option<&str>,
3023) -> Result<(), Error<PushMessagesByPhoneError>> {
3024    // add a prefix to parameters to efficiently prevent name collisions
3025    let p_body_pnp_messages_request = pnp_messages_request;
3026    let p_header_x_line_delivery_tag = x_line_delivery_tag;
3027
3028    let uri_str = format!("{}/bot/pnp/push", configuration.base_path);
3029    let mut req_builder = configuration
3030        .client
3031        .request(reqwest::Method::POST, &uri_str);
3032
3033    if let Some(ref user_agent) = configuration.user_agent {
3034        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3035    }
3036    if let Some(param_value) = p_header_x_line_delivery_tag {
3037        req_builder = req_builder.header("X-Line-Delivery-Tag", param_value.to_string());
3038    }
3039    if let Some(ref token) = configuration.bearer_access_token {
3040        req_builder = req_builder.bearer_auth(token.to_owned());
3041    };
3042    req_builder = req_builder.json(&p_body_pnp_messages_request);
3043
3044    let req = req_builder.build()?;
3045    let resp = configuration.client.execute(req).await?;
3046
3047    let status = resp.status();
3048
3049    if !status.is_client_error() && !status.is_server_error() {
3050        Ok(())
3051    } else {
3052        let content = resp.text().await?;
3053        let entity: Option<PushMessagesByPhoneError> = serde_json::from_str(&content).ok();
3054        Err(Error::ResponseError(ResponseContent {
3055            status,
3056            content,
3057            entity,
3058        }))
3059    }
3060}
3061
3062/// Send reply message
3063pub async fn reply_message(
3064    configuration: &configuration::Configuration,
3065    reply_message_request: models::ReplyMessageRequest,
3066) -> Result<models::ReplyMessageResponse, Error<ReplyMessageError>> {
3067    // add a prefix to parameters to efficiently prevent name collisions
3068    let p_body_reply_message_request = reply_message_request;
3069
3070    let uri_str = format!("{}/v2/bot/message/reply", configuration.base_path);
3071    let mut req_builder = configuration
3072        .client
3073        .request(reqwest::Method::POST, &uri_str);
3074
3075    if let Some(ref user_agent) = configuration.user_agent {
3076        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3077    }
3078    if let Some(ref token) = configuration.bearer_access_token {
3079        req_builder = req_builder.bearer_auth(token.to_owned());
3080    };
3081    req_builder = req_builder.json(&p_body_reply_message_request);
3082
3083    let req = req_builder.build()?;
3084    let resp = configuration.client.execute(req).await?;
3085
3086    let status = resp.status();
3087    let content_type = resp
3088        .headers()
3089        .get("content-type")
3090        .and_then(|v| v.to_str().ok())
3091        .unwrap_or("application/octet-stream");
3092    let content_type = super::ContentType::from(content_type);
3093
3094    if !status.is_client_error() && !status.is_server_error() {
3095        let content = resp.text().await?;
3096        match content_type {
3097            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3098            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplyMessageResponse`"))),
3099            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::ReplyMessageResponse`")))),
3100        }
3101    } else {
3102        let content = resp.text().await?;
3103        let entity: Option<ReplyMessageError> = serde_json::from_str(&content).ok();
3104        Err(Error::ResponseError(ResponseContent {
3105            status,
3106            content,
3107            entity,
3108        }))
3109    }
3110}
3111
3112/// You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available:  1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu
3113pub async fn rich_menu_batch(
3114    configuration: &configuration::Configuration,
3115    rich_menu_batch_request: models::RichMenuBatchRequest,
3116) -> Result<(), Error<RichMenuBatchError>> {
3117    // add a prefix to parameters to efficiently prevent name collisions
3118    let p_body_rich_menu_batch_request = rich_menu_batch_request;
3119
3120    let uri_str = format!("{}/v2/bot/richmenu/batch", configuration.base_path);
3121    let mut req_builder = configuration
3122        .client
3123        .request(reqwest::Method::POST, &uri_str);
3124
3125    if let Some(ref user_agent) = configuration.user_agent {
3126        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3127    }
3128    if let Some(ref token) = configuration.bearer_access_token {
3129        req_builder = req_builder.bearer_auth(token.to_owned());
3130    };
3131    req_builder = req_builder.json(&p_body_rich_menu_batch_request);
3132
3133    let req = req_builder.build()?;
3134    let resp = configuration.client.execute(req).await?;
3135
3136    let status = resp.status();
3137
3138    if !status.is_client_error() && !status.is_server_error() {
3139        Ok(())
3140    } else {
3141        let content = resp.text().await?;
3142        let entity: Option<RichMenuBatchError> = serde_json::from_str(&content).ok();
3143        Err(Error::ResponseError(ResponseContent {
3144            status,
3145            content,
3146            entity,
3147        }))
3148    }
3149}
3150
3151/// Set default rich menu
3152pub async fn set_default_rich_menu(
3153    configuration: &configuration::Configuration,
3154    rich_menu_id: &str,
3155) -> Result<(), Error<SetDefaultRichMenuError>> {
3156    // add a prefix to parameters to efficiently prevent name collisions
3157    let p_path_rich_menu_id = rich_menu_id;
3158
3159    let uri_str = format!(
3160        "{}/v2/bot/user/all/richmenu/{richMenuId}",
3161        configuration.base_path,
3162        richMenuId = crate::apis::urlencode(p_path_rich_menu_id)
3163    );
3164    let mut req_builder = configuration
3165        .client
3166        .request(reqwest::Method::POST, &uri_str);
3167
3168    if let Some(ref user_agent) = configuration.user_agent {
3169        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3170    }
3171    if let Some(ref token) = configuration.bearer_access_token {
3172        req_builder = req_builder.bearer_auth(token.to_owned());
3173    };
3174
3175    let req = req_builder.build()?;
3176    let resp = configuration.client.execute(req).await?;
3177
3178    let status = resp.status();
3179
3180    if !status.is_client_error() && !status.is_server_error() {
3181        Ok(())
3182    } else {
3183        let content = resp.text().await?;
3184        let entity: Option<SetDefaultRichMenuError> = serde_json::from_str(&content).ok();
3185        Err(Error::ResponseError(ResponseContent {
3186            status,
3187            content,
3188            entity,
3189        }))
3190    }
3191}
3192
3193/// Set webhook endpoint URL
3194pub async fn set_webhook_endpoint(
3195    configuration: &configuration::Configuration,
3196    set_webhook_endpoint_request: models::SetWebhookEndpointRequest,
3197) -> Result<(), Error<SetWebhookEndpointError>> {
3198    // add a prefix to parameters to efficiently prevent name collisions
3199    let p_body_set_webhook_endpoint_request = set_webhook_endpoint_request;
3200
3201    let uri_str = format!(
3202        "{}/v2/bot/channel/webhook/endpoint",
3203        configuration.base_path
3204    );
3205    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3206
3207    if let Some(ref user_agent) = configuration.user_agent {
3208        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3209    }
3210    if let Some(ref token) = configuration.bearer_access_token {
3211        req_builder = req_builder.bearer_auth(token.to_owned());
3212    };
3213    req_builder = req_builder.json(&p_body_set_webhook_endpoint_request);
3214
3215    let req = req_builder.build()?;
3216    let resp = configuration.client.execute(req).await?;
3217
3218    let status = resp.status();
3219
3220    if !status.is_client_error() && !status.is_server_error() {
3221        Ok(())
3222    } else {
3223        let content = resp.text().await?;
3224        let entity: Option<SetWebhookEndpointError> = serde_json::from_str(&content).ok();
3225        Err(Error::ResponseError(ResponseContent {
3226            status,
3227            content,
3228            entity,
3229        }))
3230    }
3231}
3232
3233/// Display a loading animation in one-on-one chats between users and LINE Official Accounts.
3234pub async fn show_loading_animation(
3235    configuration: &configuration::Configuration,
3236    show_loading_animation_request: models::ShowLoadingAnimationRequest,
3237) -> Result<serde_json::Value, Error<ShowLoadingAnimationError>> {
3238    // add a prefix to parameters to efficiently prevent name collisions
3239    let p_body_show_loading_animation_request = show_loading_animation_request;
3240
3241    let uri_str = format!("{}/v2/bot/chat/loading/start", configuration.base_path);
3242    let mut req_builder = configuration
3243        .client
3244        .request(reqwest::Method::POST, &uri_str);
3245
3246    if let Some(ref user_agent) = configuration.user_agent {
3247        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3248    }
3249    if let Some(ref token) = configuration.bearer_access_token {
3250        req_builder = req_builder.bearer_auth(token.to_owned());
3251    };
3252    req_builder = req_builder.json(&p_body_show_loading_animation_request);
3253
3254    let req = req_builder.build()?;
3255    let resp = configuration.client.execute(req).await?;
3256
3257    let status = resp.status();
3258    let content_type = resp
3259        .headers()
3260        .get("content-type")
3261        .and_then(|v| v.to_str().ok())
3262        .unwrap_or("application/octet-stream");
3263    let content_type = super::ContentType::from(content_type);
3264
3265    if !status.is_client_error() && !status.is_server_error() {
3266        let content = resp.text().await?;
3267        match content_type {
3268            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3269            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
3270            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
3271        }
3272    } else {
3273        let content = resp.text().await?;
3274        let entity: Option<ShowLoadingAnimationError> = serde_json::from_str(&content).ok();
3275        Err(Error::ResponseError(ResponseContent {
3276            status,
3277            content,
3278            entity,
3279        }))
3280    }
3281}
3282
3283/// Test webhook endpoint
3284pub async fn test_webhook_endpoint(
3285    configuration: &configuration::Configuration,
3286    test_webhook_endpoint_request: Option<models::TestWebhookEndpointRequest>,
3287) -> Result<models::TestWebhookEndpointResponse, Error<TestWebhookEndpointError>> {
3288    // add a prefix to parameters to efficiently prevent name collisions
3289    let p_body_test_webhook_endpoint_request = test_webhook_endpoint_request;
3290
3291    let uri_str = format!("{}/v2/bot/channel/webhook/test", configuration.base_path);
3292    let mut req_builder = configuration
3293        .client
3294        .request(reqwest::Method::POST, &uri_str);
3295
3296    if let Some(ref user_agent) = configuration.user_agent {
3297        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3298    }
3299    if let Some(ref token) = configuration.bearer_access_token {
3300        req_builder = req_builder.bearer_auth(token.to_owned());
3301    };
3302    req_builder = req_builder.json(&p_body_test_webhook_endpoint_request);
3303
3304    let req = req_builder.build()?;
3305    let resp = configuration.client.execute(req).await?;
3306
3307    let status = resp.status();
3308    let content_type = resp
3309        .headers()
3310        .get("content-type")
3311        .and_then(|v| v.to_str().ok())
3312        .unwrap_or("application/octet-stream");
3313    let content_type = super::ContentType::from(content_type);
3314
3315    if !status.is_client_error() && !status.is_server_error() {
3316        let content = resp.text().await?;
3317        match content_type {
3318            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3319            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TestWebhookEndpointResponse`"))),
3320            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::TestWebhookEndpointResponse`")))),
3321        }
3322    } else {
3323        let content = resp.text().await?;
3324        let entity: Option<TestWebhookEndpointError> = serde_json::from_str(&content).ok();
3325        Err(Error::ResponseError(ResponseContent {
3326            status,
3327            content,
3328            entity,
3329        }))
3330    }
3331}
3332
3333/// Unlink rich menu from user
3334pub async fn unlink_rich_menu_id_from_user(
3335    configuration: &configuration::Configuration,
3336    user_id: &str,
3337) -> Result<(), Error<UnlinkRichMenuIdFromUserError>> {
3338    // add a prefix to parameters to efficiently prevent name collisions
3339    let p_path_user_id = user_id;
3340
3341    let uri_str = format!(
3342        "{}/v2/bot/user/{userId}/richmenu",
3343        configuration.base_path,
3344        userId = crate::apis::urlencode(p_path_user_id)
3345    );
3346    let mut req_builder = configuration
3347        .client
3348        .request(reqwest::Method::DELETE, &uri_str);
3349
3350    if let Some(ref user_agent) = configuration.user_agent {
3351        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3352    }
3353    if let Some(ref token) = configuration.bearer_access_token {
3354        req_builder = req_builder.bearer_auth(token.to_owned());
3355    };
3356
3357    let req = req_builder.build()?;
3358    let resp = configuration.client.execute(req).await?;
3359
3360    let status = resp.status();
3361
3362    if !status.is_client_error() && !status.is_server_error() {
3363        Ok(())
3364    } else {
3365        let content = resp.text().await?;
3366        let entity: Option<UnlinkRichMenuIdFromUserError> = serde_json::from_str(&content).ok();
3367        Err(Error::ResponseError(ResponseContent {
3368            status,
3369            content,
3370            entity,
3371        }))
3372    }
3373}
3374
3375/// Unlink rich menus from multiple users
3376pub async fn unlink_rich_menu_id_from_users(
3377    configuration: &configuration::Configuration,
3378    rich_menu_bulk_unlink_request: models::RichMenuBulkUnlinkRequest,
3379) -> Result<(), Error<UnlinkRichMenuIdFromUsersError>> {
3380    // add a prefix to parameters to efficiently prevent name collisions
3381    let p_body_rich_menu_bulk_unlink_request = rich_menu_bulk_unlink_request;
3382
3383    let uri_str = format!("{}/v2/bot/richmenu/bulk/unlink", configuration.base_path);
3384    let mut req_builder = configuration
3385        .client
3386        .request(reqwest::Method::POST, &uri_str);
3387
3388    if let Some(ref user_agent) = configuration.user_agent {
3389        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3390    }
3391    if let Some(ref token) = configuration.bearer_access_token {
3392        req_builder = req_builder.bearer_auth(token.to_owned());
3393    };
3394    req_builder = req_builder.json(&p_body_rich_menu_bulk_unlink_request);
3395
3396    let req = req_builder.build()?;
3397    let resp = configuration.client.execute(req).await?;
3398
3399    let status = resp.status();
3400
3401    if !status.is_client_error() && !status.is_server_error() {
3402        Ok(())
3403    } else {
3404        let content = resp.text().await?;
3405        let entity: Option<UnlinkRichMenuIdFromUsersError> = serde_json::from_str(&content).ok();
3406        Err(Error::ResponseError(ResponseContent {
3407            status,
3408            content,
3409            entity,
3410        }))
3411    }
3412}
3413
3414/// Update rich menu alias
3415pub async fn update_rich_menu_alias(
3416    configuration: &configuration::Configuration,
3417    rich_menu_alias_id: &str,
3418    update_rich_menu_alias_request: models::UpdateRichMenuAliasRequest,
3419) -> Result<(), Error<UpdateRichMenuAliasError>> {
3420    // add a prefix to parameters to efficiently prevent name collisions
3421    let p_path_rich_menu_alias_id = rich_menu_alias_id;
3422    let p_body_update_rich_menu_alias_request = update_rich_menu_alias_request;
3423
3424    let uri_str = format!(
3425        "{}/v2/bot/richmenu/alias/{richMenuAliasId}",
3426        configuration.base_path,
3427        richMenuAliasId = crate::apis::urlencode(p_path_rich_menu_alias_id)
3428    );
3429    let mut req_builder = configuration
3430        .client
3431        .request(reqwest::Method::POST, &uri_str);
3432
3433    if let Some(ref user_agent) = configuration.user_agent {
3434        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3435    }
3436    if let Some(ref token) = configuration.bearer_access_token {
3437        req_builder = req_builder.bearer_auth(token.to_owned());
3438    };
3439    req_builder = req_builder.json(&p_body_update_rich_menu_alias_request);
3440
3441    let req = req_builder.build()?;
3442    let resp = configuration.client.execute(req).await?;
3443
3444    let status = resp.status();
3445
3446    if !status.is_client_error() && !status.is_server_error() {
3447        Ok(())
3448    } else {
3449        let content = resp.text().await?;
3450        let entity: Option<UpdateRichMenuAliasError> = serde_json::from_str(&content).ok();
3451        Err(Error::ResponseError(ResponseContent {
3452            status,
3453            content,
3454            entity,
3455        }))
3456    }
3457}
3458
3459/// Validate message objects of a broadcast message
3460pub async fn validate_broadcast(
3461    configuration: &configuration::Configuration,
3462    validate_message_request: models::ValidateMessageRequest,
3463) -> Result<(), Error<ValidateBroadcastError>> {
3464    // add a prefix to parameters to efficiently prevent name collisions
3465    let p_body_validate_message_request = validate_message_request;
3466
3467    let uri_str = format!(
3468        "{}/v2/bot/message/validate/broadcast",
3469        configuration.base_path
3470    );
3471    let mut req_builder = configuration
3472        .client
3473        .request(reqwest::Method::POST, &uri_str);
3474
3475    if let Some(ref user_agent) = configuration.user_agent {
3476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3477    }
3478    if let Some(ref token) = configuration.bearer_access_token {
3479        req_builder = req_builder.bearer_auth(token.to_owned());
3480    };
3481    req_builder = req_builder.json(&p_body_validate_message_request);
3482
3483    let req = req_builder.build()?;
3484    let resp = configuration.client.execute(req).await?;
3485
3486    let status = resp.status();
3487
3488    if !status.is_client_error() && !status.is_server_error() {
3489        Ok(())
3490    } else {
3491        let content = resp.text().await?;
3492        let entity: Option<ValidateBroadcastError> = serde_json::from_str(&content).ok();
3493        Err(Error::ResponseError(ResponseContent {
3494            status,
3495            content,
3496            entity,
3497        }))
3498    }
3499}
3500
3501/// Validate message objects of a multicast message
3502pub async fn validate_multicast(
3503    configuration: &configuration::Configuration,
3504    validate_message_request: models::ValidateMessageRequest,
3505) -> Result<(), Error<ValidateMulticastError>> {
3506    // add a prefix to parameters to efficiently prevent name collisions
3507    let p_body_validate_message_request = validate_message_request;
3508
3509    let uri_str = format!(
3510        "{}/v2/bot/message/validate/multicast",
3511        configuration.base_path
3512    );
3513    let mut req_builder = configuration
3514        .client
3515        .request(reqwest::Method::POST, &uri_str);
3516
3517    if let Some(ref user_agent) = configuration.user_agent {
3518        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3519    }
3520    if let Some(ref token) = configuration.bearer_access_token {
3521        req_builder = req_builder.bearer_auth(token.to_owned());
3522    };
3523    req_builder = req_builder.json(&p_body_validate_message_request);
3524
3525    let req = req_builder.build()?;
3526    let resp = configuration.client.execute(req).await?;
3527
3528    let status = resp.status();
3529
3530    if !status.is_client_error() && !status.is_server_error() {
3531        Ok(())
3532    } else {
3533        let content = resp.text().await?;
3534        let entity: Option<ValidateMulticastError> = serde_json::from_str(&content).ok();
3535        Err(Error::ResponseError(ResponseContent {
3536            status,
3537            content,
3538            entity,
3539        }))
3540    }
3541}
3542
3543/// Validate message objects of a narrowcast message
3544pub async fn validate_narrowcast(
3545    configuration: &configuration::Configuration,
3546    validate_message_request: models::ValidateMessageRequest,
3547) -> Result<(), Error<ValidateNarrowcastError>> {
3548    // add a prefix to parameters to efficiently prevent name collisions
3549    let p_body_validate_message_request = validate_message_request;
3550
3551    let uri_str = format!(
3552        "{}/v2/bot/message/validate/narrowcast",
3553        configuration.base_path
3554    );
3555    let mut req_builder = configuration
3556        .client
3557        .request(reqwest::Method::POST, &uri_str);
3558
3559    if let Some(ref user_agent) = configuration.user_agent {
3560        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3561    }
3562    if let Some(ref token) = configuration.bearer_access_token {
3563        req_builder = req_builder.bearer_auth(token.to_owned());
3564    };
3565    req_builder = req_builder.json(&p_body_validate_message_request);
3566
3567    let req = req_builder.build()?;
3568    let resp = configuration.client.execute(req).await?;
3569
3570    let status = resp.status();
3571
3572    if !status.is_client_error() && !status.is_server_error() {
3573        Ok(())
3574    } else {
3575        let content = resp.text().await?;
3576        let entity: Option<ValidateNarrowcastError> = serde_json::from_str(&content).ok();
3577        Err(Error::ResponseError(ResponseContent {
3578            status,
3579            content,
3580            entity,
3581        }))
3582    }
3583}
3584
3585/// Validate message objects of a push message
3586pub async fn validate_push(
3587    configuration: &configuration::Configuration,
3588    validate_message_request: models::ValidateMessageRequest,
3589) -> Result<(), Error<ValidatePushError>> {
3590    // add a prefix to parameters to efficiently prevent name collisions
3591    let p_body_validate_message_request = validate_message_request;
3592
3593    let uri_str = format!("{}/v2/bot/message/validate/push", configuration.base_path);
3594    let mut req_builder = configuration
3595        .client
3596        .request(reqwest::Method::POST, &uri_str);
3597
3598    if let Some(ref user_agent) = configuration.user_agent {
3599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3600    }
3601    if let Some(ref token) = configuration.bearer_access_token {
3602        req_builder = req_builder.bearer_auth(token.to_owned());
3603    };
3604    req_builder = req_builder.json(&p_body_validate_message_request);
3605
3606    let req = req_builder.build()?;
3607    let resp = configuration.client.execute(req).await?;
3608
3609    let status = resp.status();
3610
3611    if !status.is_client_error() && !status.is_server_error() {
3612        Ok(())
3613    } else {
3614        let content = resp.text().await?;
3615        let entity: Option<ValidatePushError> = serde_json::from_str(&content).ok();
3616        Err(Error::ResponseError(ResponseContent {
3617            status,
3618            content,
3619            entity,
3620        }))
3621    }
3622}
3623
3624/// Validate message objects of a reply message
3625pub async fn validate_reply(
3626    configuration: &configuration::Configuration,
3627    validate_message_request: models::ValidateMessageRequest,
3628) -> Result<(), Error<ValidateReplyError>> {
3629    // add a prefix to parameters to efficiently prevent name collisions
3630    let p_body_validate_message_request = validate_message_request;
3631
3632    let uri_str = format!("{}/v2/bot/message/validate/reply", configuration.base_path);
3633    let mut req_builder = configuration
3634        .client
3635        .request(reqwest::Method::POST, &uri_str);
3636
3637    if let Some(ref user_agent) = configuration.user_agent {
3638        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3639    }
3640    if let Some(ref token) = configuration.bearer_access_token {
3641        req_builder = req_builder.bearer_auth(token.to_owned());
3642    };
3643    req_builder = req_builder.json(&p_body_validate_message_request);
3644
3645    let req = req_builder.build()?;
3646    let resp = configuration.client.execute(req).await?;
3647
3648    let status = resp.status();
3649
3650    if !status.is_client_error() && !status.is_server_error() {
3651        Ok(())
3652    } else {
3653        let content = resp.text().await?;
3654        let entity: Option<ValidateReplyError> = serde_json::from_str(&content).ok();
3655        Err(Error::ResponseError(ResponseContent {
3656            status,
3657            content,
3658            entity,
3659        }))
3660    }
3661}
3662
3663/// Validate a request body of the Replace or unlink the linked rich menus in batches endpoint.
3664pub async fn validate_rich_menu_batch_request(
3665    configuration: &configuration::Configuration,
3666    rich_menu_batch_request: models::RichMenuBatchRequest,
3667) -> Result<(), Error<ValidateRichMenuBatchRequestError>> {
3668    // add a prefix to parameters to efficiently prevent name collisions
3669    let p_body_rich_menu_batch_request = rich_menu_batch_request;
3670
3671    let uri_str = format!("{}/v2/bot/richmenu/validate/batch", configuration.base_path);
3672    let mut req_builder = configuration
3673        .client
3674        .request(reqwest::Method::POST, &uri_str);
3675
3676    if let Some(ref user_agent) = configuration.user_agent {
3677        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3678    }
3679    if let Some(ref token) = configuration.bearer_access_token {
3680        req_builder = req_builder.bearer_auth(token.to_owned());
3681    };
3682    req_builder = req_builder.json(&p_body_rich_menu_batch_request);
3683
3684    let req = req_builder.build()?;
3685    let resp = configuration.client.execute(req).await?;
3686
3687    let status = resp.status();
3688
3689    if !status.is_client_error() && !status.is_server_error() {
3690        Ok(())
3691    } else {
3692        let content = resp.text().await?;
3693        let entity: Option<ValidateRichMenuBatchRequestError> = serde_json::from_str(&content).ok();
3694        Err(Error::ResponseError(ResponseContent {
3695            status,
3696            content,
3697            entity,
3698        }))
3699    }
3700}
3701
3702/// Validate rich menu object
3703pub async fn validate_rich_menu_object(
3704    configuration: &configuration::Configuration,
3705    rich_menu_request: models::RichMenuRequest,
3706) -> Result<(), Error<ValidateRichMenuObjectError>> {
3707    // add a prefix to parameters to efficiently prevent name collisions
3708    let p_body_rich_menu_request = rich_menu_request;
3709
3710    let uri_str = format!("{}/v2/bot/richmenu/validate", configuration.base_path);
3711    let mut req_builder = configuration
3712        .client
3713        .request(reqwest::Method::POST, &uri_str);
3714
3715    if let Some(ref user_agent) = configuration.user_agent {
3716        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3717    }
3718    if let Some(ref token) = configuration.bearer_access_token {
3719        req_builder = req_builder.bearer_auth(token.to_owned());
3720    };
3721    req_builder = req_builder.json(&p_body_rich_menu_request);
3722
3723    let req = req_builder.build()?;
3724    let resp = configuration.client.execute(req).await?;
3725
3726    let status = resp.status();
3727
3728    if !status.is_client_error() && !status.is_server_error() {
3729        Ok(())
3730    } else {
3731        let content = resp.text().await?;
3732        let entity: Option<ValidateRichMenuObjectError> = serde_json::from_str(&content).ok();
3733        Err(Error::ResponseError(ResponseContent {
3734            status,
3735            content,
3736            entity,
3737        }))
3738    }
3739}