32 lines
770 B
Rust
32 lines
770 B
Rust
|
use crate::client::{JiraCommand, JiraRequestType};
|
||
|
use crate::entities::issue_request::{IssueCreateRequest, IssueCreateResponse};
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub struct IssueCreateCommand {
|
||
|
issue: IssueCreateRequest,
|
||
|
}
|
||
|
|
||
|
impl IssueCreateCommand {
|
||
|
pub fn new(issue: IssueCreateRequest) -> Self {
|
||
|
Self { issue }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl JiraCommand for IssueCreateCommand {
|
||
|
type TResponse = IssueCreateResponse;
|
||
|
type TPayload = IssueCreateRequest;
|
||
|
const REQUEST_TYPE: JiraRequestType = JiraRequestType::Create;
|
||
|
|
||
|
fn endpoint(&self) -> String {
|
||
|
"/rest/api/2/issue".to_string()
|
||
|
}
|
||
|
|
||
|
fn request_body(&self) -> Option<&Self::TPayload> {
|
||
|
Some(&self.issue)
|
||
|
}
|
||
|
|
||
|
fn query_params(&self) -> Option<Vec<(String, String)>> {
|
||
|
None
|
||
|
}
|
||
|
}
|