pub struct JiraClient { /* private fields */ }Implementations§
Source§impl JiraClient
impl JiraClient
pub fn new(config: JiraConfig) -> Self
pub fn base_url(&self) -> &str
Sourcepub async fn get_myself(&self) -> Result<String>
pub async fn get_myself(&self) -> Result<String>
Get the current authenticated user’s accountId.
Sourcepub async fn get_myself_timezone(&self) -> Result<Option<String>>
pub async fn get_myself_timezone(&self) -> Result<Option<String>>
Get the current authenticated user’s Jira timezone (IANA name), if available.
Sourcepub async fn search_issues(
&self,
jql: &str,
next_page_token: Option<&str>,
max_results: Option<u32>,
) -> Result<SearchResult>
pub async fn search_issues( &self, jql: &str, next_page_token: Option<&str>, max_results: Option<u32>, ) -> Result<SearchResult>
Search issues using JQL with cursor-based pagination.
Sourcepub async fn search_issues_with_fields(
&self,
jql: &str,
next_page_token: Option<&str>,
max_results: Option<u32>,
fields: &[&str],
) -> Result<SearchResult>
pub async fn search_issues_with_fields( &self, jql: &str, next_page_token: Option<&str>, max_results: Option<u32>, fields: &[&str], ) -> Result<SearchResult>
Search issues with an explicit fields list (e.g. ["*all"], ["*navigable"],
or specific field IDs like ["summary", "components", "customfield_10010"]).
Sourcepub async fn list_fields(&self) -> Result<Vec<Field>>
pub async fn list_fields(&self) -> Result<Vec<Field>>
Fetch all visible fields (system + custom) from the Jira instance.
Endpoint: GET /rest/api/3/field.
Sourcepub async fn create_issue(&self, req: CreateIssueRequest) -> Result<Issue>
👎Deprecated since 0.40.0: Use create_issue_v2 — supports custom fields, labels, components, parent, fix versions
pub async fn create_issue(&self, req: CreateIssueRequest) -> Result<Issue>
Use create_issue_v2 — supports custom fields, labels, components, parent, fix versions
Create a new issue.
Deprecated in favor of JiraClient::create_issue_v2, which supports
custom fields, labels, components, parent, fix versions, and ADF
descriptions. This method is retained for backward compatibility and
will be removed in a future release.
Sourcepub async fn update_issue(
&self,
key: &str,
req: UpdateIssueRequest,
) -> Result<()>
pub async fn update_issue( &self, key: &str, req: UpdateIssueRequest, ) -> Result<()>
Update an existing issue.
Sourcepub async fn delete_issue(&self, key: &str) -> Result<()>
pub async fn delete_issue(&self, key: &str) -> Result<()>
Delete an issue.
Sourcepub async fn get_project_fields(&self, project_key: &str) -> Result<Vec<Field>>
pub async fn get_project_fields(&self, project_key: &str) -> Result<Vec<Field>>
Get fields available for a project (runtime field resolution — no hardcoding).
The createmeta/{project}/issuetypes LIST endpoint only returns issue
types (no per-type fields), so fields are resolved per issue type via
the createmeta/{project}/issuetypes/{id} endpoint and merged.
Sourcepub async fn get_server_info(&self) -> Result<Value>
pub async fn get_server_info(&self) -> Result<Value>
Get server info (used to detect Jira tier).
Sourcepub async fn transition_issue(
&self,
key: &str,
transition_id: &str,
) -> Result<()>
pub async fn transition_issue( &self, key: &str, transition_id: &str, ) -> Result<()>
Transition an issue to a new status.
Sourcepub async fn get_transitions(&self, key: &str) -> Result<Vec<Transition>>
pub async fn get_transitions(&self, key: &str) -> Result<Vec<Transition>>
Get available transitions for an issue.
Sourcepub async fn add_watcher(&self, key: &str, account_id: &str) -> Result<()>
pub async fn add_watcher(&self, key: &str, account_id: &str) -> Result<()>
Add a watcher to an issue. Jira REST expects the request body to be a raw JSON string containing the accountId (not an object).
Sourcepub async fn remove_watcher(&self, key: &str, account_id: &str) -> Result<()>
pub async fn remove_watcher(&self, key: &str, account_id: &str) -> Result<()>
Remove a watcher from an issue (accountId passed as query parameter).
Sourcepub async fn list_watchers(&self, key: &str) -> Result<Watchers>
pub async fn list_watchers(&self, key: &str) -> Result<Watchers>
List all watchers on an issue.
Sourcepub async fn get_issue_types(&self, project_key: &str) -> Result<Vec<IssueType>>
pub async fn get_issue_types(&self, project_key: &str) -> Result<Vec<IssueType>>
Get available issue types for a project (id + name).
Sourcepub async fn get_issue_type_by_name(
&self,
project_key: &str,
issue_type_name: &str,
) -> Result<IssueType>
pub async fn get_issue_type_by_name( &self, project_key: &str, issue_type_name: &str, ) -> Result<IssueType>
Resolve an issue type by exact or case-insensitive name within a project.
Sourcepub async fn get_fields_for_issue_type(
&self,
project_key: &str,
issue_type_id: &str,
) -> Result<Vec<Field>>
pub async fn get_fields_for_issue_type( &self, project_key: &str, issue_type_id: &str, ) -> Result<Vec<Field>>
Get fields for a specific issue type within a project (with allowed values).
Sourcepub async fn search_users(&self, query: &str) -> Result<Vec<JiraUser>>
pub async fn search_users(&self, query: &str) -> Result<Vec<JiraUser>>
Search Jira users by query string (for User field autocomplete).
Sourcepub async fn get_project_components(
&self,
project_key: &str,
) -> Result<Vec<Component>>
pub async fn get_project_components( &self, project_key: &str, ) -> Result<Vec<Component>>
List components available within a project.
Sourcepub async fn get_project_versions(
&self,
project_key: &str,
) -> Result<Vec<ProjectVersion>>
pub async fn get_project_versions( &self, project_key: &str, ) -> Result<Vec<ProjectVersion>>
List fix versions available within a project.
Sourcepub async fn create_project_version(
&self,
request: &CreateProjectVersionRequest,
) -> Result<ProjectVersion>
pub async fn create_project_version( &self, request: &CreateProjectVersionRequest, ) -> Result<ProjectVersion>
Create a project version in Jira.
Sourcepub async fn update_project_version(
&self,
version_id: &str,
request: &UpdateProjectVersionRequest,
) -> Result<ProjectVersion>
pub async fn update_project_version( &self, version_id: &str, request: &UpdateProjectVersionRequest, ) -> Result<ProjectVersion>
Update project version metadata like release/start dates or release state.
Sourcepub async fn list_sprints_for_project_with_states(
&self,
project_key: &str,
states: &[&str],
) -> Result<Vec<Sprint>>
pub async fn list_sprints_for_project_with_states( &self, project_key: &str, states: &[&str], ) -> Result<Vec<Sprint>>
List project sprints for the given sprint states via the Agile API.
Sourcepub async fn list_sprints_for_project(
&self,
project_key: &str,
) -> Result<Vec<Sprint>>
pub async fn list_sprints_for_project( &self, project_key: &str, ) -> Result<Vec<Sprint>>
List active and future sprints for a project via the Agile API.
Sourcepub async fn list_boards(
&self,
project_key: Option<&str>,
board_type: Option<&str>,
) -> Result<Vec<Board>>
pub async fn list_boards( &self, project_key: Option<&str>, board_type: Option<&str>, ) -> Result<Vec<Board>>
List Agile boards, optionally filtered by project key and board type.
Sourcepub async fn get_board(&self, board_id: u64) -> Result<Board>
pub async fn get_board(&self, board_id: u64) -> Result<Board>
Fetch a single Agile board by ID.
Sourcepub async fn board_issues(
&self,
board_id: u64,
jql: Option<&str>,
max_results: Option<u32>,
) -> Result<Vec<Issue>>
pub async fn board_issues( &self, board_id: u64, jql: Option<&str>, max_results: Option<u32>, ) -> Result<Vec<Issue>>
List issues on a board (optionally filtered by JQL).
Sourcepub async fn board_backlog(
&self,
board_id: u64,
jql: Option<&str>,
max_results: Option<u32>,
) -> Result<Vec<Issue>>
pub async fn board_backlog( &self, board_id: u64, jql: Option<&str>, max_results: Option<u32>, ) -> Result<Vec<Issue>>
List backlog issues on a board (issues not in an active or future sprint).
Sourcepub async fn create_sprint(
&self,
board_id: u64,
name: &str,
start_date: Option<&str>,
end_date: Option<&str>,
goal: Option<&str>,
) -> Result<Sprint>
pub async fn create_sprint( &self, board_id: u64, name: &str, start_date: Option<&str>, end_date: Option<&str>, goal: Option<&str>, ) -> Result<Sprint>
Create a sprint on a Jira board.
Sourcepub async fn update_sprint(&self, sprint_id: u64, body: Value) -> Result<Sprint>
pub async fn update_sprint(&self, sprint_id: u64, body: Value) -> Result<Sprint>
Update sprint metadata or lifecycle state.
Sourcepub async fn delete_sprint(&self, sprint_id: u64) -> Result<()>
pub async fn delete_sprint(&self, sprint_id: u64) -> Result<()>
Delete a sprint.
Sourcepub async fn add_issue_to_sprint(
&self,
sprint_id: u64,
issue_key: &str,
) -> Result<()>
pub async fn add_issue_to_sprint( &self, sprint_id: u64, issue_key: &str, ) -> Result<()>
Add an issue to a sprint (Agile API).
Sourcepub async fn add_comment_adf(
&self,
issue_key: &str,
adf: Value,
) -> Result<Comment>
pub async fn add_comment_adf( &self, issue_key: &str, adf: Value, ) -> Result<Comment>
Add a comment using pre-built ADF JSON (skips Markdown conversion).
Sourcepub async fn upload_attachment(
&self,
issue_key: &str,
file_path: &Path,
) -> Result<Vec<Attachment>>
pub async fn upload_attachment( &self, issue_key: &str, file_path: &Path, ) -> Result<Vec<Attachment>>
Upload a file as an attachment to an issue.
Sourcepub async fn upload_attachment_bytes(
&self,
issue_key: &str,
file_name: &str,
bytes: Vec<u8>,
media_type: Option<&str>,
) -> Result<Vec<Attachment>>
pub async fn upload_attachment_bytes( &self, issue_key: &str, file_name: &str, bytes: Vec<u8>, media_type: Option<&str>, ) -> Result<Vec<Attachment>>
Upload an in-memory attachment to an issue.
Sourcepub async fn create_issue_v2(&self, req: CreateIssueRequestV2) -> Result<Issue>
pub async fn create_issue_v2(&self, req: CreateIssueRequestV2) -> Result<Issue>
Create a new issue with dynamic custom fields.
Sourcepub async fn get_comments(&self, issue_key: &str) -> Result<Vec<Comment>>
pub async fn get_comments(&self, issue_key: &str) -> Result<Vec<Comment>>
List all comments for an issue.
Sourcepub async fn add_comment(&self, issue_key: &str, body: &str) -> Result<Comment>
pub async fn add_comment(&self, issue_key: &str, body: &str) -> Result<Comment>
Add a comment to an issue.
Sourcepub async fn get_worklogs(&self, issue_key: &str) -> Result<Vec<Worklog>>
pub async fn get_worklogs(&self, issue_key: &str) -> Result<Vec<Worklog>>
List all worklogs for an issue.
Sourcepub async fn add_worklog(
&self,
issue_key: &str,
time_spent: &str,
comment: Option<&str>,
started: Option<&str>,
) -> Result<Worklog>
pub async fn add_worklog( &self, issue_key: &str, time_spent: &str, comment: Option<&str>, started: Option<&str>, ) -> Result<Worklog>
Add a worklog entry to an issue.
time_spent uses Jira format: “2h 30m”, “1d”, “45m”
started is optional ISO 8601 timestamp; defaults to now if None.
Sourcepub async fn delete_worklog(
&self,
issue_key: &str,
worklog_id: &str,
) -> Result<()>
pub async fn delete_worklog( &self, issue_key: &str, worklog_id: &str, ) -> Result<()>
Delete a worklog entry.
Sourcepub async fn delete_comment(
&self,
issue_key: &str,
comment_id: &str,
) -> Result<()>
pub async fn delete_comment( &self, issue_key: &str, comment_id: &str, ) -> Result<()>
Delete a comment from an issue.
Sourcepub async fn list_attachments(&self, issue_key: &str) -> Result<Vec<Attachment>>
pub async fn list_attachments(&self, issue_key: &str) -> Result<Vec<Attachment>>
List attachments on an issue.
Sourcepub async fn download_attachment(
&self,
attachment_id: &str,
) -> Result<(String, Vec<u8>, String)>
pub async fn download_attachment( &self, attachment_id: &str, ) -> Result<(String, Vec<u8>, String)>
Download an attachment by ID.
Returns (filename, bytes, mime_type). The filename comes from the
Content-Disposition header when present, otherwise the trailing
path segment of the redirect URL, otherwise "attachment-<id>".
Sourcepub async fn delete_attachment(&self, attachment_id: &str) -> Result<()>
pub async fn delete_attachment(&self, attachment_id: &str) -> Result<()>
Delete an attachment by ID.
Sourcepub async fn get_remote_links(&self, issue_key: &str) -> Result<Vec<RemoteLink>>
pub async fn get_remote_links(&self, issue_key: &str) -> Result<Vec<RemoteLink>>
List remote links on an issue.
Sourcepub async fn add_remote_link(
&self,
issue_key: &str,
url_str: &str,
title: &str,
) -> Result<Value>
pub async fn add_remote_link( &self, issue_key: &str, url_str: &str, title: &str, ) -> Result<Value>
Add a remote link to an issue.
Sourcepub async fn delete_remote_link(
&self,
issue_key: &str,
link_id: &str,
) -> Result<()>
pub async fn delete_remote_link( &self, issue_key: &str, link_id: &str, ) -> Result<()>
Delete a remote link from an issue.
Sourcepub async fn get_all_issues(&self, jql: &str) -> Result<Vec<Issue>>
pub async fn get_all_issues(&self, jql: &str) -> Result<Vec<Issue>>
Fetch ALL issues matching a JQL query using cursor-based pagination. Respects the Atlassian safeguard: max 500 pages.
Sourcepub async fn archive_issues(&self, issue_keys: &[String]) -> Result<()>
pub async fn archive_issues(&self, issue_keys: &[String]) -> Result<()>
Archive a batch of issues by key. Jira accepts up to 1000 per request.
Sourcepub async fn move_issue(
&self,
issue_key: &str,
target_project_key: &str,
target_issue_type_id: &str,
target_parent: Option<&str>,
) -> Result<Issue>
pub async fn move_issue( &self, issue_key: &str, target_project_key: &str, target_issue_type_id: &str, target_parent: Option<&str>, ) -> Result<Issue>
Move an issue using Jira’s native bulk move API.
Sourcepub async fn raw_request(
&self,
method: &str,
path: &str,
body: Option<Value>,
) -> Result<Option<Value>>
pub async fn raw_request( &self, method: &str, path: &str, body: Option<Value>, ) -> Result<Option<Value>>
Execute an arbitrary Jira REST API call and return the raw JSON response.
Returns None for 204 No Content responses (success with no body).
path should start with /rest/...
Check if this Jira instance is Premium tier.
Sourcepub async fn get_plans(&self) -> Result<Vec<Value>>
pub async fn get_plans(&self) -> Result<Vec<Value>>
List Jira Plans (requires Jira Premium / Advanced Roadmaps).
Sourcepub async fn list_issue_link_types(&self) -> Result<Vec<IssueLinkType>>
pub async fn list_issue_link_types(&self) -> Result<Vec<IssueLinkType>>
List available issue link types.
Sourcepub async fn link_issues(
&self,
outward_key: &str,
inward_key: &str,
type_name: &str,
comment: Option<&str>,
) -> Result<()>
pub async fn link_issues( &self, outward_key: &str, inward_key: &str, type_name: &str, comment: Option<&str>, ) -> Result<()>
Create a link between two issues.
type_name is the name of the link type (e.g., “Blocks”).
outward_key is the issue that is doing the action (e.g., the blocker).
inward_key is the issue that is receiving the action (e.g., the blocked issue).
Sourcepub async fn get_issue_link(&self, link_id: &str) -> Result<IssueLink>
pub async fn get_issue_link(&self, link_id: &str) -> Result<IssueLink>
Get a specific issue link by ID.
Sourcepub async fn delete_issue_link(&self, link_id: &str) -> Result<()>
pub async fn delete_issue_link(&self, link_id: &str) -> Result<()>
Delete an issue link by ID.
Trait Implementations§
Source§impl Clone for JiraClient
impl Clone for JiraClient
Source§fn clone(&self) -> JiraClient
fn clone(&self) -> JiraClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more