Skip to main content

WorkItemsClient

Struct WorkItemsClient 

Source
pub struct WorkItemsClient<'a> { /* private fields */ }

Implementations§

Source§

impl WorkItemsClient<'_>

Source

pub async fn get(&self, id: i64) -> Result<WorkItem>

Get a single work item by its numeric ID.

§Arguments
  • id — The work item ID (e.g., 42).
§Returns

The WorkItem with its fields map populated.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_with_options( &self, id: i64, options: &GetWorkItemOptions, ) -> Result<WorkItem>

Get a single work item with extended options.

§Arguments
  • id — The work item ID.
  • options — GetWorkItemOptions for field selection, expansion, as-of date, etc.
§Returns

The WorkItem with requested fields and expansions.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_many(&self, ids: &[i64]) -> Result<Vec<WorkItem>>

Get multiple work items by their IDs.

§Arguments
  • ids — A slice of work item IDs to fetch.
§Returns

A Vec<WorkItem> in the same order as the requested IDs.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_many_with_options( &self, ids: &[i64], options: &GetWorkItemOptions, ) -> Result<Vec<WorkItem>>

Get multiple work items with extended options.

§Arguments
  • ids — A slice of work item IDs to fetch.
  • options — GetWorkItemOptions for field selection, expansion, etc.
§Returns

A Vec<WorkItem> with the requested options applied.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_batch( &self, request: &WorkItemBatchGetRequest, ) -> Result<Vec<WorkItem>>

Get work items using a batch request with full filtering control.

§Arguments
§Returns

A Vec<WorkItem> matching the batch criteria.

Source§

impl WorkItemsClient<'_>

Source

pub async fn create( &self, project: &str, work_item_type: &str, patch_document: &[JsonPatchOperation], ) -> Result<WorkItem>

Create a new work item.

§Arguments
  • project — The project name where the work item will be created.
  • work_item_type — The work item type (e.g., "Bug", "Task", "User Story").
  • patch_document — A slice of JsonPatchOperation describing the fields to set. Use JsonPatchOperation::add() to build operations.
§Returns

The newly created WorkItem.

Source§

impl WorkItemsClient<'_>

Source

pub async fn create_with_options( &self, project: &str, work_item_type: &str, patch_document: &[JsonPatchOperation], options: &CreateWorkItemOptions, ) -> Result<WorkItem>

Create a new work item with additional options.

§Arguments
  • project — The project name.
  • work_item_type — The work item type (e.g., "Bug").
  • patch_document — A slice of JsonPatchOperation describing the fields.
  • options — CreateWorkItemOptions for validation, rule bypass, and notifications.
§Returns

The newly created WorkItem.

Source§

impl WorkItemsClient<'_>

Source

pub async fn update( &self, id: i64, patch_document: &[JsonPatchOperation], ) -> Result<WorkItem>

Update an existing work item.

§Arguments
§Returns

The updated WorkItem.

Source§

impl WorkItemsClient<'_>

Source

pub async fn update_with_options( &self, id: i64, patch_document: &[JsonPatchOperation], options: &UpdateWorkItemOptions, ) -> Result<WorkItem>

Update an existing work item with additional options.

§Arguments
  • id — The work item ID to update.
  • patch_document — A slice of JsonPatchOperation describing the fields to modify.
  • options — UpdateWorkItemOptions for validation, rule bypass, and notifications.
§Returns

The updated WorkItem.

Source§

impl WorkItemsClient<'_>

Source

pub async fn delete(&self, id: i64) -> Result<WorkItemDelete>

Move a work item to the recycle bin (soft delete).

§Arguments
  • id — The work item ID to delete.
§Returns

A WorkItemDelete describing the deleted work item.

Source§

impl WorkItemsClient<'_>

Source

pub async fn destroy(&self, id: i64) -> Result<WorkItemDelete>

Permanently destroy a work item (bypasses the recycle bin).

§Arguments
  • id — The work item ID to permanently delete.
§Returns

A WorkItemDelete confirming the permanent deletion.

Source§

impl WorkItemsClient<'_>

Source

pub async fn query_by_wiql( &self, project: &str, wiql: &Wiql, ) -> Result<WorkItemQueryResult>

Execute a WIQL (Work Item Query Language) query.

§Arguments
  • project — The project name to scope the query to.
  • wiql — A Wiql object containing the WIQL query string.
§Returns

A WorkItemQueryResult with matching work item references.

Source§

impl WorkItemsClient<'_>

Source

pub async fn query_by_wiql_for_team( &self, project: &str, team: &str, wiql: &Wiql, ) -> Result<WorkItemQueryResult>

Execute a WIQL query scoped to a specific team.

§Arguments
  • project — The project name.
  • team — The team name within the project.
  • wiql — A Wiql object containing the WIQL query string.
§Returns

A WorkItemQueryResult scoped to the team’s area path.

Source§

impl WorkItemsClient<'_>

Source

pub async fn query_by_id( &self, project: &str, query_id: &str, ) -> Result<WorkItemQueryResult>

Execute a saved query by its ID.

§Arguments
  • project — The project name.
  • query_id — The GUID of the saved query.
§Returns

A WorkItemQueryResult from executing the saved query.

Source§

impl WorkItemsClient<'_>

Source

pub async fn query_by_id_for_team( &self, project: &str, team: &str, query_id: &str, ) -> Result<WorkItemQueryResult>

Execute a saved query by ID, scoped to a specific team.

§Arguments
  • project — The project name.
  • team — The team name within the project.
  • query_id — The GUID of the saved query.
§Returns

A WorkItemQueryResult scoped to the team.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_work_item_types( &self, project: &str, ) -> Result<Vec<WorkItemType>>

List all work item types available in a project.

§Arguments
  • project — The project name.
§Returns

A Vec<WorkItemType> listing all available types (e.g., Bug, Task, User Story).

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_work_item_type( &self, project: &str, work_item_type: &str, ) -> Result<WorkItemType>

Get a specific work item type definition.

§Arguments
  • project — The project name.
  • work_item_type — The type name (e.g., "Bug", "Task").
§Returns

The WorkItemType definition including states, fields, and transitions.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_fields(&self) -> Result<Vec<WorkItemField>>

List all work item fields across the organization.

§Returns

A Vec<WorkItemField> describing every available work item field.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_fields_for_project( &self, project: &str, ) -> Result<Vec<WorkItemField>>

List work item fields available in a specific project.

§Arguments
  • project — The project name.
§Returns

A Vec<WorkItemField> for the given project.

Source§

impl WorkItemsClient<'_>

Source

pub async fn get_state_colors( &self, project_names: &[String], ) -> Result<Vec<ProjectWorkItemStateColors>>

Get state colors for work item types across projects.

§Arguments
  • project_names — A slice of project names to get state colors for.
§Returns

A Vec<ProjectWorkItemStateColors> with color mappings per work item type.

Trait Implementations§

Source§

impl<'a> Clone for WorkItemsClient<'a>

Source§

fn clone(&self) -> Self

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
Source§

impl<'a> Debug for WorkItemsClient<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for WorkItemsClient<'a>

§

impl<'a> !UnwindSafe for WorkItemsClient<'a>

§

impl<'a> Freeze for WorkItemsClient<'a>

§

impl<'a> Send for WorkItemsClient<'a>

§

impl<'a> Sync for WorkItemsClient<'a>

§

impl<'a> Unpin for WorkItemsClient<'a>

§

impl<'a> UnsafeUnpin for WorkItemsClient<'a>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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