Add an issue get command to the client and use it for the view command
This commit is contained in:
parent
194e25dc14
commit
07864325d7
3 changed files with 38 additions and 16 deletions
|
@ -1,10 +1,12 @@
|
|||
mod issue_create_command;
|
||||
mod issue_get_command;
|
||||
mod issue_transitions_command;
|
||||
mod issue_transitions_update_command;
|
||||
mod search_command;
|
||||
mod self_command;
|
||||
|
||||
pub use issue_create_command::IssueCreateCommand;
|
||||
pub use issue_get_command::IssueGetCommand;
|
||||
pub use issue_transitions_command::IssueTransitionsCommand;
|
||||
pub use issue_transitions_update_command::IssueTransitionsUpdateCommand;
|
||||
pub use search_command::SearchCommand;
|
||||
|
|
33
crates/libjirac/src/client/commands/issue_get_command.rs
Normal file
33
crates/libjirac/src/client/commands/issue_get_command.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crate::client::{JiraCommand, JiraRequestType};
|
||||
use crate::entities::issue::JiraIssue;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IssueGetCommand {
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
impl IssueGetCommand {
|
||||
pub fn new(key: &str) -> Self {
|
||||
Self {
|
||||
key: key.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl JiraCommand for IssueGetCommand {
|
||||
type TResponse = JiraIssue;
|
||||
type TPayload = ();
|
||||
const REQUEST_TYPE: JiraRequestType = JiraRequestType::Read;
|
||||
|
||||
fn endpoint(&self) -> String {
|
||||
format!("/rest/api/2/issue/{}", self.key)
|
||||
}
|
||||
|
||||
fn request_body(&self) -> Option<&Self::TPayload> {
|
||||
None
|
||||
}
|
||||
|
||||
fn query_params(&self) -> Option<Vec<(String, String)>> {
|
||||
None
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue