openapi_github/models/
hook_delivery.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// HookDelivery : Delivery made by a webhook.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct HookDelivery {
17    /// Unique identifier of the delivery.
18    #[serde(rename = "id")]
19    pub id: i32,
20    /// Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event).
21    #[serde(rename = "guid")]
22    pub guid: String,
23    /// Time when the delivery was delivered.
24    #[serde(rename = "delivered_at")]
25    pub delivered_at: String,
26    /// Whether the delivery is a redelivery.
27    #[serde(rename = "redelivery")]
28    pub redelivery: bool,
29    /// Time spent delivering.
30    #[serde(rename = "duration")]
31    pub duration: f64,
32    /// Description of the status of the attempted delivery
33    #[serde(rename = "status")]
34    pub status: String,
35    /// Status code received when delivery was made.
36    #[serde(rename = "status_code")]
37    pub status_code: i32,
38    /// The event that triggered the delivery.
39    #[serde(rename = "event")]
40    pub event: String,
41    /// The type of activity for the event that triggered the delivery.
42    #[serde(rename = "action", deserialize_with = "Option::deserialize")]
43    pub action: Option<String>,
44    /// The id of the GitHub App installation associated with this event.
45    #[serde(rename = "installation_id", deserialize_with = "Option::deserialize")]
46    pub installation_id: Option<i32>,
47    /// The id of the repository associated with this event.
48    #[serde(rename = "repository_id", deserialize_with = "Option::deserialize")]
49    pub repository_id: Option<i32>,
50    /// The URL target of the delivery.
51    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
52    pub url: Option<String>,
53    #[serde(rename = "request")]
54    pub request: Box<models::HookDeliveryRequest>,
55    #[serde(rename = "response")]
56    pub response: Box<models::HookDeliveryResponse>,
57}
58
59impl HookDelivery {
60    /// Delivery made by a webhook.
61    pub fn new(id: i32, guid: String, delivered_at: String, redelivery: bool, duration: f64, status: String, status_code: i32, event: String, action: Option<String>, installation_id: Option<i32>, repository_id: Option<i32>, request: models::HookDeliveryRequest, response: models::HookDeliveryResponse) -> HookDelivery {
62        HookDelivery {
63            id,
64            guid,
65            delivered_at,
66            redelivery,
67            duration,
68            status,
69            status_code,
70            event,
71            action,
72            installation_id,
73            repository_id,
74            url: None,
75            request: Box::new(request),
76            response: Box::new(response),
77        }
78    }
79}
80