Skip to main content

JiraClient

Struct JiraClient 

Source
pub struct JiraClient { /* private fields */ }

Implementations§

Source§

impl JiraClient

Source

pub fn new(config: JiraConfig) -> Self

Source

pub fn base_url(&self) -> &str

Source

pub async fn get_myself(&self) -> Result<String>

Get the current authenticated user’s accountId.

Source

pub async fn get_myself_timezone(&self) -> Result<Option<String>>

Get the current authenticated user’s Jira timezone (IANA name), if available.

Source

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.

Source

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"]).

Source

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.

Source

pub async fn get_issue(&self, key: &str) -> Result<Issue>

Fetch a single issue by key.

Source

pub 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

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.

Source

pub async fn update_issue( &self, key: &str, req: UpdateIssueRequest, ) -> Result<()>

Update an existing issue.

Source

pub async fn delete_issue(&self, key: &str) -> Result<()>

Delete an issue.

Source

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.

Source

pub async fn get_server_info(&self) -> Result<Value>

Get server info (used to detect Jira tier).

Source

pub async fn transition_issue( &self, key: &str, transition_id: &str, ) -> Result<()>

Transition an issue to a new status.

Source

pub async fn get_transitions(&self, key: &str) -> Result<Vec<Transition>>

Get available transitions for an issue.

Source

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).

Source

pub async fn remove_watcher(&self, key: &str, account_id: &str) -> Result<()>

Remove a watcher from an issue (accountId passed as query parameter).

Source

pub async fn list_watchers(&self, key: &str) -> Result<Watchers>

List all watchers on an issue.

Source

pub async fn get_issue_types(&self, project_key: &str) -> Result<Vec<IssueType>>

Get available issue types for a project (id + name).

Source

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.

Source

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).

Source

pub async fn search_users(&self, query: &str) -> Result<Vec<JiraUser>>

Search Jira users by query string (for User field autocomplete).

Source

pub async fn get_project_components( &self, project_key: &str, ) -> Result<Vec<Component>>

List components available within a project.

Source

pub async fn get_project_versions( &self, project_key: &str, ) -> Result<Vec<ProjectVersion>>

List fix versions available within a project.

Source

pub async fn create_project_version( &self, request: &CreateProjectVersionRequest, ) -> Result<ProjectVersion>

Create a project version in Jira.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn get_board(&self, board_id: u64) -> Result<Board>

Fetch a single Agile board by ID.

Source

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).

Source

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).

Source

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.

Source

pub async fn update_sprint(&self, sprint_id: u64, body: Value) -> Result<Sprint>

Update sprint metadata or lifecycle state.

Source

pub async fn delete_sprint(&self, sprint_id: u64) -> Result<()>

Delete a sprint.

Source

pub async fn add_issue_to_sprint( &self, sprint_id: u64, issue_key: &str, ) -> Result<()>

Add an issue to a sprint (Agile API).

Source

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).

Source

pub async fn upload_attachment( &self, issue_key: &str, file_path: &Path, ) -> Result<Vec<Attachment>>

Upload a file as an attachment to an issue.

Source

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.

Source

pub async fn create_issue_v2(&self, req: CreateIssueRequestV2) -> Result<Issue>

Create a new issue with dynamic custom fields.

Source

pub async fn get_comments(&self, issue_key: &str) -> Result<Vec<Comment>>

List all comments for an issue.

Source

pub async fn add_comment(&self, issue_key: &str, body: &str) -> Result<Comment>

Add a comment to an issue.

Source

pub async fn get_worklogs(&self, issue_key: &str) -> Result<Vec<Worklog>>

List all worklogs for an issue.

Source

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.

Source

pub async fn delete_worklog( &self, issue_key: &str, worklog_id: &str, ) -> Result<()>

Delete a worklog entry.

Source

pub async fn delete_comment( &self, issue_key: &str, comment_id: &str, ) -> Result<()>

Delete a comment from an issue.

Source

pub async fn list_attachments(&self, issue_key: &str) -> Result<Vec<Attachment>>

List attachments on an issue.

Source

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>".

Source

pub async fn delete_attachment(&self, attachment_id: &str) -> Result<()>

Delete an attachment by ID.

List remote links on an issue.

Add a remote link to an issue.

Delete a remote link from an issue.

Source

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.

Source

pub async fn archive_issues(&self, issue_keys: &[String]) -> Result<()>

Archive a batch of issues by key. Jira accepts up to 1000 per request.

Source

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.

Source

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/...

Source

pub async fn is_premium(&self) -> bool

Check if this Jira instance is Premium tier.

Source

pub async fn get_plans(&self) -> Result<Vec<Value>>

List Jira Plans (requires Jira Premium / Advanced Roadmaps).

List available issue link types.

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).

Get a specific issue link by ID.

Delete an issue link by ID.

Trait Implementations§

Source§

impl Clone for JiraClient

Source§

fn clone(&self) -> JiraClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more