@@ -2,7 +2,7 @@ use super::ListOptions;
2
2
use crate :: { apis:: message_attempt_api, error:: Result , models:: * , Configuration } ;
3
3
4
4
#[ derive( Default ) ]
5
- pub struct MessageAttemptListOptions {
5
+ pub struct MessageAttemptListByEndpointOptions {
6
6
/// Limit the number of returned items
7
7
pub limit : Option < i32 > ,
8
8
@@ -22,9 +22,6 @@ pub struct MessageAttemptListOptions {
22
22
/// Filter response based on the tag
23
23
pub tag : Option < String > ,
24
24
25
- /// Filter the attempts based on the attempted endpoint
26
- pub endpoint_id : Option < String > ,
27
-
28
25
/// Only include items created before a certain date
29
26
///
30
27
/// RFC3339 date string.
@@ -38,12 +35,15 @@ pub struct MessageAttemptListOptions {
38
35
/// When `true` attempt content is included in the response
39
36
pub with_content : Option < bool > ,
40
37
38
+ /// When `true`, the message information is included in the response
39
+ pub with_msg : Option < bool > ,
40
+
41
41
/// Filter response based on the event type
42
42
pub event_types : Option < Vec < String > > ,
43
43
}
44
44
45
45
#[ derive( Default ) ]
46
- pub struct MessageAttemptListByEndpointOptions {
46
+ pub struct MessageAttemptListOptions {
47
47
/// Limit the number of returned items
48
48
pub limit : Option < i32 > ,
49
49
@@ -63,6 +63,9 @@ pub struct MessageAttemptListByEndpointOptions {
63
63
/// Filter response based on the tag
64
64
pub tag : Option < String > ,
65
65
66
+ /// Filter the attempts based on the attempted endpoint
67
+ pub endpoint_id : Option < String > ,
68
+
66
69
/// Only include items created before a certain date
67
70
///
68
71
/// RFC3339 date string.
@@ -76,8 +79,40 @@ pub struct MessageAttemptListByEndpointOptions {
76
79
/// When `true` attempt content is included in the response
77
80
pub with_content : Option < bool > ,
78
81
79
- /// When `true`, the message information is included in the response
80
- pub with_msg : Option < bool > ,
82
+ /// Filter response based on the event type
83
+ pub event_types : Option < Vec < String > > ,
84
+ }
85
+
86
+ #[ derive( Default ) ]
87
+ pub struct MessageAttemptListAttemptedMessagesOptions {
88
+ /// Limit the number of returned items
89
+ pub limit : Option < i32 > ,
90
+
91
+ /// The iterator returned from a prior invocation
92
+ pub iterator : Option < String > ,
93
+
94
+ /// Filter response based on the channel
95
+ pub channel : Option < String > ,
96
+
97
+ /// Filter response based on the message tags
98
+ pub tag : Option < String > ,
99
+
100
+ /// Filter response based on the status of the attempt: Success (0), Pending
101
+ /// (1), Failed (2), or Sending (3)
102
+ pub status : Option < MessageStatus > ,
103
+
104
+ /// Only include items created before a certain date
105
+ ///
106
+ /// RFC3339 date string.
107
+ pub before : Option < String > ,
108
+
109
+ /// Only include items created after a certain date
110
+ ///
111
+ /// RFC3339 date string.
112
+ pub after : Option < String > ,
113
+
114
+ /// When `true` message payloads are included in the response
115
+ pub with_content : Option < bool > ,
81
116
82
117
/// Filter response based on the event type
83
118
pub event_types : Option < Vec < String > > ,
@@ -92,96 +127,96 @@ impl<'a> MessageAttempt<'a> {
92
127
Self { cfg }
93
128
}
94
129
95
- /// List attempts by message id
130
+ /// List attempts by endpoint id
96
131
///
97
132
/// Note that by default this endpoint is limited to retrieving 90 days'
98
133
/// worth of data relative to now or, if an iterator is provided, 90
99
134
/// days before/after the time indicated by the iterator ID. If you
100
135
/// require data beyond those time ranges, you will need to explicitly
101
136
/// set the `before` or `after` parameter as appropriate.
102
- pub async fn list_by_msg (
137
+ pub async fn list_by_endpoint (
103
138
& self ,
104
139
app_id : String ,
105
- msg_id : String ,
106
- options : Option < MessageAttemptListOptions > ,
140
+ endpoint_id : String ,
141
+ options : Option < MessageAttemptListByEndpointOptions > ,
107
142
) -> Result < ListResponseMessageAttemptOut > {
108
- let MessageAttemptListOptions {
143
+ let MessageAttemptListByEndpointOptions {
109
144
limit,
110
145
iterator,
111
146
status,
112
147
status_code_class,
113
148
channel,
114
149
tag,
115
- endpoint_id,
116
150
before,
117
151
after,
118
152
with_content,
153
+ with_msg,
119
154
event_types,
120
155
} = options. unwrap_or_default ( ) ;
121
156
122
- message_attempt_api:: v1_period_message_attempt_period_list_by_msg (
157
+ message_attempt_api:: v1_period_message_attempt_period_list_by_endpoint (
123
158
self . cfg ,
124
- message_attempt_api:: V1PeriodMessageAttemptPeriodListByMsgParams {
159
+ message_attempt_api:: V1PeriodMessageAttemptPeriodListByEndpointParams {
125
160
app_id,
126
- msg_id ,
161
+ endpoint_id ,
127
162
limit,
128
163
iterator,
129
164
status,
130
165
status_code_class,
131
166
channel,
132
167
tag,
133
- endpoint_id,
134
168
before,
135
169
after,
136
170
with_content,
171
+ with_msg,
137
172
event_types,
138
173
} ,
139
174
)
140
175
. await
141
176
}
142
177
143
- /// List attempts by endpoint id
178
+ /// List attempts by message id
144
179
///
145
180
/// Note that by default this endpoint is limited to retrieving 90 days'
146
181
/// worth of data relative to now or, if an iterator is provided, 90
147
182
/// days before/after the time indicated by the iterator ID. If you
148
183
/// require data beyond those time ranges, you will need to explicitly
149
184
/// set the `before` or `after` parameter as appropriate.
150
- pub async fn list_by_endpoint (
185
+ pub async fn list_by_msg (
151
186
& self ,
152
187
app_id : String ,
153
- endpoint_id : String ,
154
- options : Option < MessageAttemptListByEndpointOptions > ,
188
+ msg_id : String ,
189
+ options : Option < MessageAttemptListOptions > ,
155
190
) -> Result < ListResponseMessageAttemptOut > {
156
- let MessageAttemptListByEndpointOptions {
191
+ let MessageAttemptListOptions {
157
192
limit,
158
193
iterator,
159
194
status,
160
195
status_code_class,
161
196
channel,
162
197
tag,
198
+ endpoint_id,
163
199
before,
164
200
after,
165
201
with_content,
166
- with_msg,
167
202
event_types,
168
203
} = options. unwrap_or_default ( ) ;
169
204
170
- message_attempt_api:: v1_period_message_attempt_period_list_by_endpoint (
205
+ message_attempt_api:: v1_period_message_attempt_period_list_by_msg (
171
206
self . cfg ,
172
- message_attempt_api:: V1PeriodMessageAttemptPeriodListByEndpointParams {
207
+ message_attempt_api:: V1PeriodMessageAttemptPeriodListByMsgParams {
173
208
app_id,
174
- endpoint_id ,
209
+ msg_id ,
175
210
limit,
176
211
iterator,
177
212
status,
178
213
status_code_class,
179
214
channel,
180
215
tag,
216
+ endpoint_id,
181
217
before,
182
218
after,
183
219
with_content,
184
- with_msg,
185
220
event_types,
186
221
} ,
187
222
)
@@ -203,20 +238,18 @@ impl<'a> MessageAttempt<'a> {
203
238
& self ,
204
239
app_id : String ,
205
240
endpoint_id : String ,
206
- options : Option < MessageAttemptListOptions > ,
241
+ options : Option < MessageAttemptListAttemptedMessagesOptions > ,
207
242
) -> Result < ListResponseEndpointMessageOut > {
208
- let MessageAttemptListOptions {
209
- iterator,
243
+ let MessageAttemptListAttemptedMessagesOptions {
210
244
limit,
211
- event_types,
212
- before,
213
- after,
245
+ iterator,
214
246
channel,
215
247
tag,
216
248
status,
217
- status_code_class : _,
249
+ before,
250
+ after,
218
251
with_content,
219
- endpoint_id : _ ,
252
+ event_types ,
220
253
} = options. unwrap_or_default ( ) ;
221
254
222
255
message_attempt_api:: v1_period_message_attempt_period_list_attempted_messages (
@@ -260,6 +293,7 @@ impl<'a> MessageAttempt<'a> {
260
293
. await
261
294
}
262
295
296
+ #[ deprecated = "Use `list_by_msg` instead, setting the `endpoint_id` in `options`." ]
263
297
pub async fn list_attempts_for_endpoint (
264
298
& self ,
265
299
app_id : String ,
@@ -317,20 +351,6 @@ impl<'a> MessageAttempt<'a> {
317
351
. await
318
352
}
319
353
320
- /// Resend a message to the specified endpoint.
321
- pub async fn resend ( & self , app_id : String , msg_id : String , endpoint_id : String ) -> Result < ( ) > {
322
- message_attempt_api:: v1_period_message_attempt_period_resend (
323
- self . cfg ,
324
- message_attempt_api:: V1PeriodMessageAttemptPeriodResendParams {
325
- app_id,
326
- msg_id,
327
- endpoint_id,
328
- idempotency_key : None ,
329
- } ,
330
- )
331
- . await
332
- }
333
-
334
354
/// Deletes the given attempt's response body. Useful when an endpoint
335
355
/// accidentally returned sensitive content.
336
356
pub async fn expunge_content (
@@ -349,4 +369,18 @@ impl<'a> MessageAttempt<'a> {
349
369
)
350
370
. await
351
371
}
372
+
373
+ /// Resend a message to the specified endpoint.
374
+ pub async fn resend ( & self , app_id : String , msg_id : String , endpoint_id : String ) -> Result < ( ) > {
375
+ message_attempt_api:: v1_period_message_attempt_period_resend (
376
+ self . cfg ,
377
+ message_attempt_api:: V1PeriodMessageAttemptPeriodResendParams {
378
+ app_id,
379
+ msg_id,
380
+ endpoint_id,
381
+ idempotency_key : None ,
382
+ } ,
383
+ )
384
+ . await
385
+ }
352
386
}
0 commit comments