jira_api_v2/models/
webhook.rs

1/*
2 * The Jira Cloud platform REST API
3 *
4 * Jira Cloud platform REST API documentation
5 *
6 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
7 * Contact: ecosystem@atlassian.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Webhook : A webhook.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Webhook {
17    /// The ID of the webhook.
18    #[serde(rename = "id")]
19    pub id: i64,
20    /// The JQL filter that specifies which issues the webhook is sent for.
21    #[serde(rename = "jqlFilter")]
22    pub jql_filter: String,
23    /// The Jira events that trigger the webhook.
24    #[serde(rename = "events")]
25    pub events: Vec<Events>,
26    #[serde(rename = "expirationDate")]
27    pub expiration_date: i64,
28}
29
30impl Webhook {
31    /// A webhook.
32    pub fn new(id: i64, jql_filter: String, events: Vec<Events>, expiration_date: i64) -> Webhook {
33        Webhook {
34            id,
35            jql_filter,
36            events,
37            expiration_date,
38        }
39    }
40}
41/// The Jira events that trigger the webhook.
42#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
43pub enum Events {
44    #[serde(rename = "jira:issue_created")]
45    JiraColonIssueCreated,
46    #[serde(rename = "jira:issue_updated")]
47    JiraColonIssueUpdated,
48    #[serde(rename = "jira:issue_deleted")]
49    JiraColonIssueDeleted,
50    #[serde(rename = "comment_created")]
51    CommentCreated,
52    #[serde(rename = "comment_updated")]
53    CommentUpdated,
54    #[serde(rename = "comment_deleted")]
55    CommentDeleted,
56    #[serde(rename = "issue_property_set")]
57    IssuePropertySet,
58    #[serde(rename = "issue_property_deleted")]
59    IssuePropertyDeleted,
60}
61
62impl Default for Events {
63    fn default() -> Events {
64        Self::JiraColonIssueCreated
65    }
66}
67