webhooks 0.0.1

Rust library for interacting with the Svix API and verifying webhook signatures.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
/*
 * Svix API
 *
 * Welcome to the Svix API documentation!  Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/)  # Introduction  This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com).  ## Main concepts  In Svix you have four important entities you will be interacting with:  - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint.   ## Authentication  Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`.  <SecurityDefinitions />   ## Code samples  The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/).   ## Idempotency  Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response.  To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions.  Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result.  Please note that idempotency is only supported for `POST` requests.   ## Cross-Origin Resource Sharing  This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. 
 *
 * The version of the OpenAPI document: 1.4
 * 
 * Generated by: https://openapi-generator.tech
 */


use reqwest;

use crate::apis::ResponseContent;
use super::{Error, configuration};

/// struct for passing parameters to the method `get_attempt_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_get`
#[derive(Clone, Debug)]
pub struct GetAttemptApiV1AppAppIdMsgMsgIdAttemptAttemptIdGetParams {
    pub attempt_id: String,
    pub msg_id: String,
    pub app_id: String,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `get_attempt_headers_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_headers_get`
#[derive(Clone, Debug)]
pub struct GetAttemptHeadersApiV1AppAppIdMsgMsgIdAttemptAttemptIdHeadersGetParams {
    pub app_id: String,
    pub msg_id: String,
    pub attempt_id: String,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempted_destinations_api_v1_app_app_id_msg_msg_id_endpoint_get`
#[derive(Clone, Debug)]
pub struct ListAttemptedDestinationsApiV1AppAppIdMsgMsgIdEndpointGetParams {
    pub msg_id: String,
    pub app_id: String,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempted_messages_api_v1_app_app_id_endpoint_endpoint_id_msg_get`
#[derive(Clone, Debug)]
pub struct ListAttemptedMessagesApiV1AppAppIdEndpointEndpointIdMsgGetParams {
    pub endpoint_id: String,
    pub app_id: String,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    pub channel: Option<String>,
    pub status: Option<crate::models::MessageStatus>,
    pub before: Option<String>,
    pub after: Option<String>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempts_api_v1_app_app_id_msg_msg_id_attempt_get`
#[derive(Clone, Debug)]
pub struct ListAttemptsApiV1AppAppIdMsgMsgIdAttemptGetParams {
    pub app_id: String,
    pub msg_id: String,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    pub endpoint_id: Option<String>,
    pub event_types: Option<Vec<String>>,
    pub channel: Option<String>,
    pub status: Option<crate::models::MessageStatus>,
    pub before: Option<String>,
    pub after: Option<String>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempts_by_endpoint_api_v1_app_app_id_attempt_endpoint_endpoint_id_get`
#[derive(Clone, Debug)]
pub struct ListAttemptsByEndpointApiV1AppAppIdAttemptEndpointEndpointIdGetParams {
    pub app_id: String,
    pub endpoint_id: String,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    pub status: Option<crate::models::MessageStatus>,
    pub status_code_class: Option<crate::models::StatusCodeClass>,
    pub event_types: Option<Vec<String>>,
    pub channel: Option<String>,
    pub before: Option<String>,
    pub after: Option<String>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempts_by_msg_api_v1_app_app_id_attempt_msg_msg_id_get`
#[derive(Clone, Debug)]
pub struct ListAttemptsByMsgApiV1AppAppIdAttemptMsgMsgIdGetParams {
    pub app_id: String,
    pub msg_id: String,
    pub endpoint_id: Option<String>,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    pub status: Option<crate::models::MessageStatus>,
    pub status_code_class: Option<crate::models::StatusCodeClass>,
    pub event_types: Option<Vec<String>>,
    pub channel: Option<String>,
    pub before: Option<String>,
    pub after: Option<String>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `list_attempts_for_endpoint_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_attempt_get`
#[derive(Clone, Debug)]
pub struct ListAttemptsForEndpointApiV1AppAppIdMsgMsgIdEndpointEndpointIdAttemptGetParams {
    pub msg_id: String,
    pub app_id: String,
    pub endpoint_id: String,
    pub iterator: Option<String>,
    pub limit: Option<i32>,
    pub event_types: Option<Vec<String>>,
    pub channel: Option<String>,
    pub status: Option<crate::models::MessageStatus>,
    pub before: Option<String>,
    pub after: Option<String>,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}

/// struct for passing parameters to the method `resend_webhook_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_resend_post`
#[derive(Clone, Debug)]
pub struct ResendWebhookApiV1AppAppIdMsgMsgIdEndpointEndpointIdResendPostParams {
    pub endpoint_id: String,
    pub msg_id: String,
    pub app_id: String,
    /// The request's idempotency key
    pub idempotency_key: Option<String>
}


/// struct for typed errors of method `get_attempt_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAttemptApiV1AppAppIdMsgMsgIdAttemptAttemptIdGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `get_attempt_headers_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_headers_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAttemptHeadersApiV1AppAppIdMsgMsgIdAttemptAttemptIdHeadersGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempted_destinations_api_v1_app_app_id_msg_msg_id_endpoint_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptedDestinationsApiV1AppAppIdMsgMsgIdEndpointGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempted_messages_api_v1_app_app_id_endpoint_endpoint_id_msg_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptedMessagesApiV1AppAppIdEndpointEndpointIdMsgGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempts_api_v1_app_app_id_msg_msg_id_attempt_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptsApiV1AppAppIdMsgMsgIdAttemptGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempts_by_endpoint_api_v1_app_app_id_attempt_endpoint_endpoint_id_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptsByEndpointApiV1AppAppIdAttemptEndpointEndpointIdGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempts_by_msg_api_v1_app_app_id_attempt_msg_msg_id_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptsByMsgApiV1AppAppIdAttemptMsgMsgIdGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `list_attempts_for_endpoint_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_attempt_get`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAttemptsForEndpointApiV1AppAppIdMsgMsgIdEndpointEndpointIdAttemptGetError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method `resend_webhook_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_resend_post`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResendWebhookApiV1AppAppIdMsgMsgIdEndpointEndpointIdResendPostError {
    Status401(crate::models::HttpErrorOut),
    Status403(crate::models::HttpErrorOut),
    Status404(crate::models::HttpErrorOut),
    Status409(crate::models::HttpErrorOut),
    Status422(crate::models::HttpValidationError),
    Status429(crate::models::HttpErrorOut),
    UnknownValue(serde_json::Value),
}


/// `msg_id`: Use a message id or a message `eventId`
pub async fn get_attempt_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_get(configuration: &configuration::Configuration, params: GetAttemptApiV1AppAppIdMsgMsgIdAttemptAttemptIdGetParams) -> Result<crate::models::MessageAttemptOut, Error<GetAttemptApiV1AppAppIdMsgMsgIdAttemptAttemptIdGetError>> {
    // unbox the parameters
    let attempt_id = params.attempt_id;
    let msg_id = params.msg_id;
    let app_id = params.app_id;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/", configuration.base_path, attempt_id=crate::apis::urlencode(attempt_id), msg_id=crate::apis::urlencode(msg_id), app_id=crate::apis::urlencode(app_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetAttemptApiV1AppAppIdMsgMsgIdAttemptAttemptIdGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Calculate and return headers used on a given message attempt
pub async fn get_attempt_headers_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_headers_get(configuration: &configuration::Configuration, params: GetAttemptHeadersApiV1AppAppIdMsgMsgIdAttemptAttemptIdHeadersGetParams) -> Result<crate::models::MessageAttemptHeadersOut, Error<GetAttemptHeadersApiV1AppAppIdMsgMsgIdAttemptAttemptIdHeadersGetError>> {
    // unbox the parameters
    let app_id = params.app_id;
    let msg_id = params.msg_id;
    let attempt_id = params.attempt_id;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/headers/", configuration.base_path, app_id=crate::apis::urlencode(app_id), msg_id=crate::apis::urlencode(msg_id), attempt_id=crate::apis::urlencode(attempt_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetAttemptHeadersApiV1AppAppIdMsgMsgIdAttemptAttemptIdHeadersGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// `msg_id`: Use a message id or a message `eventId`
pub async fn list_attempted_destinations_api_v1_app_app_id_msg_msg_id_endpoint_get(configuration: &configuration::Configuration, params: ListAttemptedDestinationsApiV1AppAppIdMsgMsgIdEndpointGetParams) -> Result<crate::models::ListResponseMessageEndpointOut, Error<ListAttemptedDestinationsApiV1AppAppIdMsgMsgIdEndpointGetError>> {
    // unbox the parameters
    let msg_id = params.msg_id;
    let app_id = params.app_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/endpoint/", configuration.base_path, msg_id=crate::apis::urlencode(msg_id), app_id=crate::apis::urlencode(app_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptedDestinationsApiV1AppAppIdMsgMsgIdEndpointGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// List messages for a particular endpoint. Additionally includes metadata about the latest message attempt.  The `before` parameter lets you filter all items created before a certain date and is ignored if an iterator is passed.
pub async fn list_attempted_messages_api_v1_app_app_id_endpoint_endpoint_id_msg_get(configuration: &configuration::Configuration, params: ListAttemptedMessagesApiV1AppAppIdEndpointEndpointIdMsgGetParams) -> Result<crate::models::ListResponseEndpointMessageOut, Error<ListAttemptedMessagesApiV1AppAppIdEndpointEndpointIdMsgGetError>> {
    // unbox the parameters
    let endpoint_id = params.endpoint_id;
    let app_id = params.app_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let channel = params.channel;
    let status = params.status;
    let before = params.before;
    let after = params.after;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg/", configuration.base_path, endpoint_id=crate::apis::urlencode(endpoint_id), app_id=crate::apis::urlencode(app_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = channel {
        local_var_req_builder = local_var_req_builder.query(&[("channel", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status {
        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = before {
        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = after {
        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptedMessagesApiV1AppAppIdEndpointEndpointIdMsgGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Deprecated: Please use \"List Attempts by Endpoint\" and \"List Attempts by Msg\" instead.  `msg_id`: Use a message id or a message `eventId`
pub async fn list_attempts_api_v1_app_app_id_msg_msg_id_attempt_get(configuration: &configuration::Configuration, params: ListAttemptsApiV1AppAppIdMsgMsgIdAttemptGetParams) -> Result<crate::models::ListResponseMessageAttemptOut, Error<ListAttemptsApiV1AppAppIdMsgMsgIdAttemptGetError>> {
    // unbox the parameters
    let app_id = params.app_id;
    let msg_id = params.msg_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let endpoint_id = params.endpoint_id;
    let event_types = params.event_types;
    let channel = params.channel;
    let status = params.status;
    let before = params.before;
    let after = params.after;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/attempt/", configuration.base_path, app_id=crate::apis::urlencode(app_id), msg_id=crate::apis::urlencode(msg_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = endpoint_id {
        local_var_req_builder = local_var_req_builder.query(&[("endpoint_id", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = event_types {
        local_var_req_builder = local_var_req_builder.query(&[("event_types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
    }
    if let Some(ref local_var_str) = channel {
        local_var_req_builder = local_var_req_builder.query(&[("channel", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status {
        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = before {
        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = after {
        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptsApiV1AppAppIdMsgMsgIdAttemptGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// List attempts by endpoint id
pub async fn list_attempts_by_endpoint_api_v1_app_app_id_attempt_endpoint_endpoint_id_get(configuration: &configuration::Configuration, params: ListAttemptsByEndpointApiV1AppAppIdAttemptEndpointEndpointIdGetParams) -> Result<crate::models::ListResponseMessageAttemptOut, Error<ListAttemptsByEndpointApiV1AppAppIdAttemptEndpointEndpointIdGetError>> {
    // unbox the parameters
    let app_id = params.app_id;
    let endpoint_id = params.endpoint_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let status = params.status;
    let status_code_class = params.status_code_class;
    let event_types = params.event_types;
    let channel = params.channel;
    let before = params.before;
    let after = params.after;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}/", configuration.base_path, app_id=crate::apis::urlencode(app_id), endpoint_id=crate::apis::urlencode(endpoint_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status {
        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status_code_class {
        local_var_req_builder = local_var_req_builder.query(&[("status_code_class", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = event_types {
        local_var_req_builder = local_var_req_builder.query(&[("event_types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
    }
    if let Some(ref local_var_str) = channel {
        local_var_req_builder = local_var_req_builder.query(&[("channel", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = before {
        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = after {
        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptsByEndpointApiV1AppAppIdAttemptEndpointEndpointIdGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// List attempts by message id
pub async fn list_attempts_by_msg_api_v1_app_app_id_attempt_msg_msg_id_get(configuration: &configuration::Configuration, params: ListAttemptsByMsgApiV1AppAppIdAttemptMsgMsgIdGetParams) -> Result<crate::models::ListResponseMessageAttemptOut, Error<ListAttemptsByMsgApiV1AppAppIdAttemptMsgMsgIdGetError>> {
    // unbox the parameters
    let app_id = params.app_id;
    let msg_id = params.msg_id;
    let endpoint_id = params.endpoint_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let status = params.status;
    let status_code_class = params.status_code_class;
    let event_types = params.event_types;
    let channel = params.channel;
    let before = params.before;
    let after = params.after;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/attempt/msg/{msg_id}/", configuration.base_path, app_id=crate::apis::urlencode(app_id), msg_id=crate::apis::urlencode(msg_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = endpoint_id {
        local_var_req_builder = local_var_req_builder.query(&[("endpoint_id", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status {
        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status_code_class {
        local_var_req_builder = local_var_req_builder.query(&[("status_code_class", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = event_types {
        local_var_req_builder = local_var_req_builder.query(&[("event_types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
    }
    if let Some(ref local_var_str) = channel {
        local_var_req_builder = local_var_req_builder.query(&[("channel", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = before {
        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = after {
        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptsByMsgApiV1AppAppIdAttemptMsgMsgIdGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// DEPRECATED: please use list_attempts with endpoint_id as a query parameter instead.  List the message attempts for a particular endpoint.  Returning the endpoint.  The `before` parameter lets you filter all items created before a certain date and is ignored if an iterator is passed.
pub async fn list_attempts_for_endpoint_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_attempt_get(configuration: &configuration::Configuration, params: ListAttemptsForEndpointApiV1AppAppIdMsgMsgIdEndpointEndpointIdAttemptGetParams) -> Result<crate::models::ListResponseMessageAttemptEndpointOut, Error<ListAttemptsForEndpointApiV1AppAppIdMsgMsgIdEndpointEndpointIdAttemptGetError>> {
    // unbox the parameters
    let msg_id = params.msg_id;
    let app_id = params.app_id;
    let endpoint_id = params.endpoint_id;
    let iterator = params.iterator;
    let limit = params.limit;
    let event_types = params.event_types;
    let channel = params.channel;
    let status = params.status;
    let before = params.before;
    let after = params.after;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/attempt/", configuration.base_path, msg_id=crate::apis::urlencode(msg_id), app_id=crate::apis::urlencode(app_id), endpoint_id=crate::apis::urlencode(endpoint_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = iterator {
        local_var_req_builder = local_var_req_builder.query(&[("iterator", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = limit {
        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = event_types {
        local_var_req_builder = local_var_req_builder.query(&[("event_types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
    }
    if let Some(ref local_var_str) = channel {
        local_var_req_builder = local_var_req_builder.query(&[("channel", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = status {
        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = before {
        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = after {
        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListAttemptsForEndpointApiV1AppAppIdMsgMsgIdEndpointEndpointIdAttemptGetError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Resend a message to the specified endpoint.
pub async fn resend_webhook_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_resend_post(configuration: &configuration::Configuration, params: ResendWebhookApiV1AppAppIdMsgMsgIdEndpointEndpointIdResendPostParams) -> Result<(), Error<ResendWebhookApiV1AppAppIdMsgMsgIdEndpointEndpointIdResendPostError>> {
    // unbox the parameters
    let endpoint_id = params.endpoint_id;
    let msg_id = params.msg_id;
    let app_id = params.app_id;
    let idempotency_key = params.idempotency_key;


    let local_var_client = &configuration.client;

    let local_var_uri_str = format!("{}/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend/", configuration.base_path, endpoint_id=crate::apis::urlencode(endpoint_id), msg_id=crate::apis::urlencode(msg_id), app_id=crate::apis::urlencode(app_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(local_var_param_value) = idempotency_key {
        local_var_req_builder = local_var_req_builder.header("idempotency-key", local_var_param_value.to_string());
    }
    if let Some(ref local_var_token) = configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<ResendWebhookApiV1AppAppIdMsgMsgIdEndpointEndpointIdResendPostError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}