35 lines
775 B
Rust
35 lines
775 B
Rust
use crate::client::{JiraCommand, JiraRequestType};
|
|
use crate::entities::search::JiraSearchResponse;
|
|
|
|
#[derive(Debug)]
|
|
pub struct SearchCommand {
|
|
jql: String,
|
|
}
|
|
|
|
impl SearchCommand {
|
|
pub fn new(jql: &str) -> Self {
|
|
Self {
|
|
jql: jql.to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl JiraCommand for SearchCommand {
|
|
type TResponse = JiraSearchResponse;
|
|
type TPayload = ();
|
|
const REQUEST_TYPE: JiraRequestType = JiraRequestType::Read;
|
|
|
|
fn endpoint(&self) -> String {
|
|
"/rest/api/2/search".to_string()
|
|
}
|
|
|
|
fn request_body(&self) -> Option<&Self::TPayload> {
|
|
None
|
|
}
|
|
|
|
fn query_params(&self) -> Option<Vec<(String, String)>> {
|
|
let params = vec![("jql".to_string(), self.jql.clone())];
|
|
|
|
Some(params)
|
|
}
|
|
}
|