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
//! Interfaces for accessing and managing resolutions

// Third party
use std::collections::BTreeMap;

// Ours
use crate::{Jira, Result};

#[derive(Debug)]
pub struct Resolution {
    jira: Jira,
}

#[derive(Deserialize, Debug, Clone)]
pub struct Resolved {
    pub id: String,
    pub title: String,
    #[serde(rename = "type")]
    pub resolution_type: String,
    pub properties: BTreeMap<String, ::serde_json::Value>,
    #[serde(rename = "additionalProperties")]
    pub additional_properties: bool,
}

impl Resolution {
    pub fn new(jira: &Jira) -> Resolution {
        Resolution { jira: jira.clone() }
    }

    pub fn get<I>(&self, id: I) -> Result<Resolved>
    where
        I: Into<String>,
    {
        self.jira.get("api", &format!("/resolution/{}", id.into()))
    }
}