pub struct Jira { /* private fields */ }Expand description
Jira client with cached-session management via the Session trait.
Implementations§
Source§impl Jira
impl Jira
Sourcepub fn new(config: &JiraConfig) -> Self
pub fn new(config: &JiraConfig) -> Self
Builds a client from the config; no network activity yet.
use kasl::api::jira::{Jira, JiraConfig};
let config = JiraConfig {
login: "username".to_string(),
api_url: "https://jira.company.com".to_string(),
completed_statuses: Vec::new(),
};
let jira = Jira::new(&config);Sourcepub async fn get_completed_issues(
&mut self,
date: &NaiveDate,
) -> Result<Vec<JiraIssue>>
pub async fn get_completed_issues( &mut self, date: &NaiveDate, ) -> Result<Vec<JiraIssue>>
Fetches the user’s issues resolved on date (full-day range).
A 401 drops the cached session and retries up to the limit; other failures propagate - completed issues feed the report, so a silent empty result would hide real problems.
let config = JiraConfig {
login: "username".to_string(),
api_url: "https://jira.company.com".to_string(),
completed_statuses: Vec::new(),
};
let mut jira = Jira::new(&config);
let today = chrono::Local::now().date_naive();
let issues = jira.get_completed_issues(&today).await?;
for issue in issues {
println!("Completed: {} - {}", issue.key, issue.fields.summary);
}Sourcepub async fn get_assigned_open_issues(
&mut self,
extra_field_ids: &[String],
) -> Result<Vec<JiraIssue>>
pub async fn get_assigned_open_issues( &mut self, extra_field_ids: &[String], ) -> Result<Vec<JiraIssue>>
Fetches open issues currently assigned to the authenticated user.
Uses JQL assignee = currentUser() AND resolution is EMPTY. Paginates
through all matching issues (startAt / total). Extra field ids
(custom fields such as Scoring) are included in the fields query.
Auth failures and network errors return an empty list (same pattern as
[get_completed_issues]) so callers can keep polling safely.
Sourcepub async fn get_assigned_open_issues_noninteractive(
&mut self,
extra_field_ids: &[String],
) -> Result<Option<Vec<JiraIssue>>>
pub async fn get_assigned_open_issues_noninteractive( &mut self, extra_field_ids: &[String], ) -> Result<Option<Vec<JiraIssue>>>
Like [get_assigned_open_issues], but never prompts for a password.
Uses a cached session cookie and/or encrypted .jira_secret. Returns
Ok(None) when neither is available so background daemons can skip
the poll without blocking on stdin.
Sourcepub fn issue_browse_url(&self, key: &str) -> String
pub fn issue_browse_url(&self, key: &str) -> String
Builds a browse URL for an issue key using this client’s API base.
Sourcepub fn priority_rank(priority: &Option<JiraPriority>) -> i32
pub fn priority_rank(priority: &Option<JiraPriority>) -> i32
Maps a Jira priority id to a sortable rank (lower = more urgent).
Sourcepub fn extract_number(value: &Value) -> Option<f64>
pub fn extract_number(value: &Value) -> Option<f64>
Extracts a numeric value from a Jira custom-field JSON value.
Supports bare numbers, numeric strings, and objects with value / amount.
Trait Implementations§
Source§impl Session for Jira
impl Session for Jira
Source§fn set_credentials(&mut self, password: &str) -> Result<()>
fn set_credentials(&mut self, password: &str) -> Result<()>
login.Source§fn session_id_file(&self) -> &str
fn session_id_file(&self) -> &str
Source§fn reset_retry(&mut self)
fn reset_retry(&mut self)
Source§async fn get_session_id(&mut self) -> Result<String>
async fn get_session_id(&mut self) -> Result<String>
MAX_RETRY_COUNT] password attempts (a retry always
re-prompts rather than reusing a password that just failed).