messaging_api_line/models/narrowcast_progress_response.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 crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct NarrowcastProgressResponse {
16 /// The current status. One of: `waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure.
17 #[serde(rename = "phase")]
18 pub phase: Phase,
19 /// The number of users who successfully received the message.
20 #[serde(rename = "successCount", skip_serializing_if = "Option::is_none")]
21 pub success_count: Option<i64>,
22 /// The number of users who failed to send the message.
23 #[serde(rename = "failureCount", skip_serializing_if = "Option::is_none")]
24 pub failure_count: Option<i64>,
25 /// The number of intended recipients of the message.
26 #[serde(rename = "targetCount", skip_serializing_if = "Option::is_none")]
27 pub target_count: Option<i64>,
28 /// The reason the message failed to be sent. This is only included with a `phase` property value of `failed`.
29 #[serde(rename = "failedDescription", skip_serializing_if = "Option::is_none")]
30 pub failed_description: Option<String>,
31 /// Error summary. This is only included with a phase property value of failed. One of: `1`: An internal error occurred. `2`: An error occurred because there weren't enough recipients. `3`: A conflict error of requests occurs because a request that has already been accepted is retried. `4`: An audience of less than 50 recipients is included as a condition of sending.
32 #[serde(rename = "errorCode", skip_serializing_if = "Option::is_none")]
33 pub error_code: Option<i64>,
34 /// Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC
35 #[serde(rename = "acceptedTime")]
36 pub accepted_time: String,
37 /// Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC
38 #[serde(rename = "completedTime", skip_serializing_if = "Option::is_none")]
39 pub completed_time: Option<String>,
40}
41
42impl NarrowcastProgressResponse {
43 pub fn new(phase: Phase, accepted_time: String) -> NarrowcastProgressResponse {
44 NarrowcastProgressResponse {
45 phase,
46 success_count: None,
47 failure_count: None,
48 target_count: None,
49 failed_description: None,
50 error_code: None,
51 accepted_time,
52 completed_time: None,
53 }
54 }
55}
56/// The current status. One of: `waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure.
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Phase {
59 #[serde(rename = "waiting")]
60 Waiting,
61 #[serde(rename = "sending")]
62 Sending,
63 #[serde(rename = "succeeded")]
64 Succeeded,
65 #[serde(rename = "failed")]
66 Failed,
67}
68
69impl Default for Phase {
70 fn default() -> Phase {
71 Self::Waiting
72 }
73}
74