Package org.azd.workitemtracking
Class WorkItemTrackingApi
- All Implemented Interfaces:
WorkItemTrackingDetails
public class WorkItemTrackingApi
extends AzDAsyncApi<WorkItemTrackingApi>
implements WorkItemTrackingDetails
WorkItem Tracking class to manage work items API
-
Constructor Summary
ConstructorDescriptionWorkItemTrackingApi
(Connection connection) Pass the connection object to work with WorkItem Tracking Api -
Method Summary
Modifier and TypeMethodDescriptionaddHyperLinks
(int workItemId, Map<String, String> hyperlinksMap) Create hyperlinks for the given work item.addWorkItemAttachment
(int workItemId, Map<String, String> fieldsToUpdate) Add an attachment to a work item.createAttachment
(String fileName, AttachmentUploadType uploadType, String teamAreaPath, InputStream contentStream) Uploads an attachment.createAttachment
(String fileName, AttachmentUploadType uploadType, String teamAreaPath, String contents) Deprecated.This method is deprecated as of version 5.0.0.createQuery
(String query, QueryHierarchyItem queryHierarchyItem) Creates a query, or moves a query.createWorkItem
(String workItemType, String title, String description, Map<String, Object> additionalFields) Creates a single work item optionally with additional fields.createWorkItem
(String workItemType, WorkItemOperation operation, String title) Creates a single work item.createWorkItem
(String workItemType, WorkItemOperation operation, String title, String description, String[] tags) Creates a single work item.createWorkItemField
(WorkItemField workItemField) Create a new field.deleteQuery
(String query) Delete a query or a folder.deleteWorkItem
(int id) Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required.deleteWorkItem
(int id, boolean destroy) Deletes the specified work item permanently if the destroy parameter has been set to true, WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion.deleteWorkItemField
(String fieldNameOrRefName) Deletes the field.getAttachment
(String id, String fileName) Deprecated.This method is deprecated as of version 5.0.0.getAttachmentAsZip
(String id, String fileName, boolean download) Downloads an attachment as a zip file.getAttachmentContent
(String id, String fileName, boolean download) Downloads an attachment.Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin.getDeletedWorkItemsFromRecycleBin
(int[] ids) Gets the work items from the recycle bin, whose IDs have been specified in the parametersGets the root queries and their childrengetQueries
(int depth, QueryExpand expand, boolean includeDeleted) Gets the root queries and their childrenRetrieves an individual query and its childrengetQuery
(String query, int depth, QueryExpand expand, boolean includeDeleted, boolean useIsoDateFormat) Retrieves an individual query and its childrengetQueryBatches
(QueryErrorPolicy errorPolicy, QueryExpand expand, String[] ids) Gets a list of queries by ids (Maximum 1000)getWorkItem
(int id) Returns a single work item.getWorkItem
(int id, WorkItemExpand expand) Returns a single work item.getWorkItem
(int id, WorkItemExpand expand, String asOf) Returns a single work item.getWorkItem
(int id, WorkItemExpand expand, String[] fields) Returns a single work item.getWorkItem
(int id, WorkItemExpand expand, String[] fields, String asOf) Returns a single work item.getWorkItemField
(String fieldNameOrRefName) Gets information on a specific field.Returns information for all fields.getWorkItemFields
(GetFieldsExpand expand) Returns information for all fields.getWorkItemFromRecycleBin
(int id) Gets a deleted work item from Recycle Bin.getWorkItemRevision
(int workItemId, int revisionNumber) Returns a fully hydrated work item for the requested revisiongetWorkItemRevision
(int workItemId, int revisionNumber, WorkItemExpand expand) Returns a fully hydrated work item for the requested revisiongetWorkItemRevisions
(int workItemId) Returns the list of fully hydrated work item revisions.getWorkItemRevisions
(int workItemId, WorkItemExpand expand) Returns the list of fully hydrated work item revisions.getWorkItemRevisions
(int workItemId, WorkItemExpand expand, int top, int skip) Returns the list of fully hydrated work item revisions, paged.getWorkItems
(int[] ids) Returns a list of work items (Maximum 200)getWorkItems
(int[] ids, WorkItemExpand expand) Returns a list of work items (Maximum 200)getWorkItems
(int[] ids, WorkItemExpand expand, String asOf) Returns a list of work items (Maximum 200)getWorkItems
(int[] ids, WorkItemExpand expand, String[] fields) Returns a list of work items (Maximum 200)getWorkItems
(int[] ids, WorkItemExpand expand, String[] fields, String asOf, WorkItemErrorPolicy errorPolicy) Returns a list of work items (Maximum 200)getWorkItemType
(String workItemTypeName) Returns a work item type definition.Returns the list of work item typesmigrateProjectProcess
(String processId) Migrates a project to a different process within the same OOB type.queryByWiql
(String team, String query) Gets the results of the query given its WIQL.queryByWiql
(String team, String query, int top, boolean timePrecision) Gets the results of the query given its WIQL.removeHyperLinks
(int workItemId, List<String> urls) Remove hyperlinks for the given work item.removeWorkItemAttachment
(int workItemId, List<String> attachmentUrl) Removes the attachment from a work item.removeWorkItemFromRecycleBin
(int id) Destroys the specified work item permanently from the Recycle Bin.restoreWorkItemFromRecycleBin
(int id) Restores the deleted work item from Recycle Bin.searchQuery
(String filter) searchQuery
(String filter, QueryExpand expand, boolean includeDeleted, int top) updateWorkItem
(int workItemId, Map<String, Object> fieldsToUpdate) Update a single work item with the internal field names.updateWorkItem
(int workItemId, Map<String, Object> fieldsToUpdate, WorkItemOperation operation) Update a single work item with the internal field names.updateWorkItem
(int workItemId, WorkItemExpand expand, boolean bypassRules, boolean suppressNotifications, boolean validateOnly, Map<String, Object> fieldsToUpdate) Update a single work item with the internal field names.updateWorkItem
(int workItemId, WorkItemExpand expand, boolean bypassRules, boolean suppressNotifications, boolean validateOnly, Map<String, Object> fieldsToUpdate, WorkItemOperation operation) Update a single work item with the internal field names.updateWorkItemField
(String fieldNameOrRefName, boolean isDeleted) Update a field.Methods inherited from class org.azd.utils.AzDAsyncApi
createAsync
-
Constructor Details
-
WorkItemTrackingApi
Pass the connection object to work with WorkItem Tracking Api- Parameters:
connection
- Connection object
-
-
Method Details
-
createWorkItem
public WorkItem createWorkItem(String workItemType, WorkItemOperation operation, String title) throws AzDException Creates a single work item.- Specified by:
createWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemType
- The work item type of the work item to create. e.g., "user story", "bug", "task"operation
- The patch operationWorkItemOperation
title
- The title for the work item- Returns:
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
createWorkItem
public WorkItem createWorkItem(String workItemType, WorkItemOperation operation, String title, String description, String[] tags) throws AzDException Creates a single work item.- Specified by:
createWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemType
- The work item type of the work item to create. e.g., "user story", "bug", "task"operation
- The patch operationWorkItemOperation
title
- The title for the work itemdescription
- Description for the work itemtags
- Tags for the work item- Returns:
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
createWorkItem
public WorkItem createWorkItem(String workItemType, String title, String description, Map<String, Object> additionalFields) throws AzDExceptionCreates a single work item optionally with additional fields.- Specified by:
createWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemType
- The work item type of the work item to create. e.g., "user story", "bug", "task"title
- The title for the work itemdescription
- Description for the work itemadditionalFields
- Provide the additional fields as a HashMap to create the work item. This requires the internal fields to be specified. E.g., System.Tags, System.AreaPath, System.State, System.Reason etc.,- Returns:
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
deleteWorkItem
Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required.- Specified by:
deleteWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- ID of the work item to be deleted- Returns:
WorkItemDelete
- Throws:
AzDException
- Default Api Exception handler.
-
deleteWorkItem
Deletes the specified work item permanently if the destroy parameter has been set to true, WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution.- Specified by:
deleteWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- ID of the work item to be deleteddestroy
- Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone.- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItem
Returns a single work item.- Specified by:
getWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- The work item id- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItem
Returns a single work item.- Specified by:
getWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- The work item idexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItem
Returns a single work item.- Specified by:
getWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- The work item idexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
asOf
- AsOf UTC date time string- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItem
Returns a single work item.- Specified by:
getWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- The work item idexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
fields
- Comma-separated list of requested fields- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItem
public WorkItem getWorkItem(int id, WorkItemExpand expand, String[] fields, String asOf) throws AzDException Returns a single work item.- Specified by:
getWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
id
- The work item idexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
fields
- Comma-separated list of requested fieldsasOf
- AsOf UTC date time string- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItems
Returns a list of work items (Maximum 200)- Specified by:
getWorkItems
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- Integer array of requested work item ids. (Maximum 200 ids allowed).- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItems
Returns a list of work items (Maximum 200)- Specified by:
getWorkItems
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- Integer array of requested work item ids. (Maximum 200 ids allowed).expand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItems
Returns a list of work items (Maximum 200)- Specified by:
getWorkItems
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- Integer array of requested work item ids. (Maximum 200 ids allowed).expand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
asOf
- AsOf UTC date time string- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItems
public WorkItemList getWorkItems(int[] ids, WorkItemExpand expand, String[] fields) throws AzDException Returns a list of work items (Maximum 200)- Specified by:
getWorkItems
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- Integer array of requested work item ids. (Maximum 200 ids allowed).expand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
fields
- Comma-separated list of requested fields- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItems
public WorkItemList getWorkItems(int[] ids, WorkItemExpand expand, String[] fields, String asOf, WorkItemErrorPolicy errorPolicy) throws AzDException Returns a list of work items (Maximum 200)- Specified by:
getWorkItems
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- Integer array of requested work item ids. (Maximum 200 ids allowed).expand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
fields
- Comma-separated list of requested fieldsasOf
- AsOf UTC date time stringerrorPolicy
- The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}.WorkItemErrorPolicy
- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemRevisions
Returns the list of fully hydrated work item revisions.- Specified by:
getWorkItemRevisions
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work item- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemRevisions
Returns the list of fully hydrated work item revisions.- Specified by:
getWorkItemRevisions
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work itemexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemRevisions
public WorkItemList getWorkItemRevisions(int workItemId, WorkItemExpand expand, int top, int skip) throws AzDException Returns the list of fully hydrated work item revisions, paged.- Specified by:
getWorkItemRevisions
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work itemexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
top
- Specify top pages to listskip
- Specify to skip pages- Returns:
WorkItemList
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemRevision
Returns a fully hydrated work item for the requested revision- Specified by:
getWorkItemRevision
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work itemrevisionNumber
- The work item revision number- Returns:
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemRevision
public WorkItem getWorkItemRevision(int workItemId, int revisionNumber, WorkItemExpand expand) throws AzDException Returns a fully hydrated work item for the requested revision- Specified by:
getWorkItemRevision
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work itemrevisionNumber
- The work item revision numberexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
- Returns:
WorkItem
- Throws:
AzDException
- Default Api Exception handler.
-
queryByWiql
Gets the results of the query given its WIQL.- Specified by:
queryByWiql
in interfaceWorkItemTrackingDetails
- Parameters:
team
- Team ID or team namequery
- Specify the query to list the work items. E.g., "Select * From WorkItems Where [System.WorkItemType] = 'User Story'"- Returns:
- WorkItemQueryResult
WorkItemQueryResult
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
queryByWiql
public WorkItemQueryResult queryByWiql(String team, String query, int top, boolean timePrecision) throws AzDException Gets the results of the query given its WIQL.- Specified by:
queryByWiql
in interfaceWorkItemTrackingDetails
- Parameters:
team
- Team ID or team namequery
- Specify the query to list the work items. E.g., "Select * From WorkItems Where [System.WorkItemType] = 'User Story'"top
- The max number of results to return.timePrecision
- The max number of results to return.- Returns:
- WorkItemQueryResult
WorkItemQueryResult
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
removeWorkItemFromRecycleBin
Destroys the specified work item permanently from the Recycle Bin. This action can not be undone.- Specified by:
removeWorkItemFromRecycleBin
in interfaceWorkItemTrackingDetails
- Parameters:
id
- ID of the work item to be destroyed permanently- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getWorkItemFromRecycleBin
Gets a deleted work item from Recycle Bin.- Specified by:
getWorkItemFromRecycleBin
in interfaceWorkItemTrackingDetails
- Parameters:
id
- ID of the work item to be returned- Returns:
- WorkItemDeleteReference
WorkItemDeleteReference
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getDeletedWorkItemsFromRecycleBin
Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin.- Specified by:
getDeletedWorkItemsFromRecycleBin
in interfaceWorkItemTrackingDetails
- Returns:
- WorkItemDeleteShallowReferences
WorkItemDeleteShallowReferences
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getDeletedWorkItemsFromRecycleBin
Gets the work items from the recycle bin, whose IDs have been specified in the parameters- Specified by:
getDeletedWorkItemsFromRecycleBin
in interfaceWorkItemTrackingDetails
- Parameters:
ids
- array of workitem ids- Returns:
- WorkItemDeleteReferences
WorkItemDeleteReferences
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
restoreWorkItemFromRecycleBin
Restores the deleted work item from Recycle Bin.- Specified by:
restoreWorkItemFromRecycleBin
in interfaceWorkItemTrackingDetails
- Parameters:
id
- ID of the work item to be restored- Returns:
- WorkItemDeleteReference
WorkItemDeleteReference
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
updateWorkItem
public WorkItem updateWorkItem(int workItemId, Map<String, Object> fieldsToUpdate) throws AzDExceptionUpdate a single work item with the internal field names.- Specified by:
updateWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work item to updatefieldsToUpdate
- HashMap of internal field names to update. E.g., System.Title, System.Description etc and it's associated values.- Returns:
- The updated
WorkItem
. - Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
updateWorkItem
public WorkItem updateWorkItem(int workItemId, Map<String, Object> fieldsToUpdate, WorkItemOperation operation) throws AzDExceptionUpdate a single work item with the internal field names.- Specified by:
updateWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work item to updatefieldsToUpdate
- HashMap of internal field names to update. E.g., System.Title, System.Description etc and it's associated values.operation
- TheWorkItemOperation
.- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
updateWorkItem
public WorkItem updateWorkItem(int workItemId, WorkItemExpand expand, boolean bypassRules, boolean suppressNotifications, boolean validateOnly, Map<String, Object> fieldsToUpdate) throws AzDExceptionUpdate a single work item with the internal field names. The operation type that will be used isWorkItemOperation.ADD
.- Specified by:
updateWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work item to updateexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
bypassRules
- Do not enforce the work item type rules on this updatesuppressNotifications
- Do not fire any notifications for this changevalidateOnly
- Indicate if you only want to validate the changes without saving the work itemfieldsToUpdate
- HashMap of internal field names to update. E.g., System.Title, System.Description etc and it's associated values.- Returns:
- WorkItemDeleteReference
WorkItemDeleteReference
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
updateWorkItem
public WorkItem updateWorkItem(int workItemId, WorkItemExpand expand, boolean bypassRules, boolean suppressNotifications, boolean validateOnly, Map<String, Object> fieldsToUpdate, WorkItemOperation operation) throws AzDExceptionUpdate a single work item with the internal field names.- Specified by:
updateWorkItem
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The id of the work item to updateexpand
- The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.WorkItemExpand
bypassRules
- Do not enforce the work item type rules on this updatesuppressNotifications
- Do not fire any notifications for this changevalidateOnly
- Indicate if you only want to validate the changes without saving the work itemfieldsToUpdate
- HashMap of internal field names to update. E.g., System.Title, System.Description etc and it's associated values.operation
- TheWorkItemOperation
.- Returns:
- WorkItem
WorkItem
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
addHyperLinks
Create hyperlinks for the given work item.- Specified by:
addHyperLinks
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The work item's ID.hyperlinksMap
- AMap
that each entry represents a hyperlink. The key is the hyperlink URL and the value is its comment. If a comment is not desired then the value can either be null (if its supported by the map) or an empty string.- Returns:
- The updated
WorkItem
. - Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
removeHyperLinks
Remove hyperlinks for the given work item.Note: All hyperlinks must exist in order to be removed. Even if one doesn't then an
AzDException
is thrown.- Specified by:
removeHyperLinks
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- The work item's ID.urls
- AList
with the URL of the hyperlinks.- Returns:
- The updated
WorkItem
. - Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
getWorkItemTypes
Returns the list of work item types- Specified by:
getWorkItemTypes
in interfaceWorkItemTrackingDetails
- Returns:
- list of Work Item type
WorkItemTypes
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getWorkItemType
Returns a work item type definition.- Specified by:
getWorkItemType
in interfaceWorkItemTrackingDetails
- Parameters:
workItemTypeName
- provide the work item type name. e.g., Bug or user story etc.- Returns:
- work item type
WorkItemType
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
createAttachment
@Deprecated public AttachmentReference createAttachment(String fileName, AttachmentUploadType uploadType, String teamAreaPath, String contents) throws AzDException Deprecated.This method is deprecated as of version 5.0.0. Please use createAttachment() with content stream for working with work item attachment API.- Specified by:
createAttachment
in interfaceWorkItemTrackingDetails
- Throws:
AzDException
-
createAttachment
public AttachmentReference createAttachment(String fileName, AttachmentUploadType uploadType, String teamAreaPath, InputStream contentStream) throws AzDException Uploads an attachment.- Specified by:
createAttachment
in interfaceWorkItemTrackingDetails
- Parameters:
fileName
- The name of the fileuploadType
- Attachment upload type: Simple or Chunked.AttachmentUploadType
teamAreaPath
- Target project Area PathcontentStream
- Stream to upload. Payload to create the attachment.- Returns:
- AttachmentReference
AttachmentReference
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getAttachmentContent
public InputStream getAttachmentContent(String id, String fileName, boolean download) throws AzDException Downloads an attachment.- Specified by:
getAttachmentContent
in interfaceWorkItemTrackingDetails
- Parameters:
id
- Attachment IDfileName
- Name of the filedownload
- If set to true always download attachment- Returns:
- Stream of the attachment content. Use
StreamHelper
to download the attachment contents to a file. - Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getAttachmentAsZip
public InputStream getAttachmentAsZip(String id, String fileName, boolean download) throws AzDException Downloads an attachment as a zip file.- Specified by:
getAttachmentAsZip
in interfaceWorkItemTrackingDetails
- Parameters:
id
- Attachment IDfileName
- Name of the filedownload
- If set to true always download attachment- Returns:
- Stream of the attachment content. Use
StreamHelper
to download the attachment contents to a file. - Throws:
AzDException
- Handles errors from REST API and validates passed arguments
-
getAttachment
Deprecated.This method is deprecated as of version 5.0.0. Please use getAttachmentContent() or getAttachmentAsZip() for working with work item attachment API.- Specified by:
getAttachment
in interfaceWorkItemTrackingDetails
- Throws:
AzDException
-
addWorkItemAttachment
public WorkItem addWorkItemAttachment(int workItemId, Map<String, String> fieldsToUpdate) throws AzDExceptionAdd an attachment to a work item. Pass the url of the attachment and comments as a Map to add the attachment to work item. Note that the attachment should already be created using createAttachment method.- Specified by:
addWorkItemAttachment
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- Id of the work item.fieldsToUpdate
- Map of url and comments.
var attachments = new HashMap<String, Object>() {{ put("https://url/of/attachment", "This is a comment"); }};
- Returns:
- The work item object. WorkItem
WorkItem
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
removeWorkItemAttachment
public WorkItem removeWorkItemAttachment(int workItemId, List<String> attachmentUrl) throws AzDException Removes the attachment from a work item. Pass the list of attachment url to be removed.- Specified by:
removeWorkItemAttachment
in interfaceWorkItemTrackingDetails
- Parameters:
workItemId
- ID of the work item.attachmentUrl
- List of attachment url.- Returns:
- The work item object. WorkItem
WorkItem
- Throws:
AzDException
- Handles errors from REST API and validates passed arguments.
-
getMyWorkRecentActivity
- Specified by:
getMyWorkRecentActivity
in interfaceWorkItemTrackingDetails
- Throws:
AzDException
-
getWorkItemFields
Returns information for all fields. The project ID/name parameter is optional.- Specified by:
getWorkItemFields
in interfaceWorkItemTrackingDetails
- Returns:
- WorkItemField Object
WorkItemFieldTypes
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemFields
Returns information for all fields. The project ID/name parameter is optional.- Specified by:
getWorkItemFields
in interfaceWorkItemTrackingDetails
- Parameters:
expand
- Use ExtensionFields to include extension fields, otherwise exclude them. Unless the feature flag for this parameter is enabled, extension fields are always included.- Returns:
- WorkItemFieldTypes Object
WorkItemFieldTypes
- Throws:
AzDException
- Default Api Exception handler.
-
getWorkItemField
Gets information on a specific field.- Specified by:
getWorkItemField
in interfaceWorkItemTrackingDetails
- Parameters:
fieldNameOrRefName
- Field simple name or reference name- Returns:
- WorkItemField Object
WorkItemField
- Throws:
AzDException
- Default Api Exception handler.
-
createWorkItemField
Create a new field.- Specified by:
createWorkItemField
in interfaceWorkItemTrackingDetails
- Parameters:
workItemField
- WorkItemField object to create a new work item- Returns:
- WorkItemField Object
WorkItemField
- Throws:
AzDException
- Default Api Exception handler.
-
deleteWorkItemField
Deletes the field. To undelete a filed, see "Update Field" API.- Specified by:
deleteWorkItemField
in interfaceWorkItemTrackingDetails
- Parameters:
fieldNameOrRefName
- Field simple name or reference name- Throws:
AzDException
- Default Api Exception handler.
-
updateWorkItemField
public WorkItemField updateWorkItemField(String fieldNameOrRefName, boolean isDeleted) throws AzDException Update a field.- Specified by:
updateWorkItemField
in interfaceWorkItemTrackingDetails
- Parameters:
fieldNameOrRefName
- Name/reference name of the field to be updated- Returns:
- WorkItemField Object
WorkItemField
- Throws:
AzDException
- Default Api Exception handler.
-
migrateProjectProcess
Migrates a project to a different process within the same OOB type. For example, you can only migrate a project from agile/custom-agile to agile/custom-agile.- Specified by:
migrateProjectProcess
in interfaceWorkItemTrackingDetails
- Returns:
- ProcessMigrationResultModel Object
ProcessMigrationResultModel
- Throws:
AzDException
- Default Api Exception handler.
-
createQuery
public QueryHierarchyItem createQuery(String query, QueryHierarchyItem queryHierarchyItem) throws AzDException Creates a query, or moves a query.- Specified by:
createQuery
in interfaceWorkItemTrackingDetails
- Parameters:
queryHierarchyItem
- Query Hierarchy item object.- Returns:
- QueryHierarchyItem Object
QueryHierarchyItem
- Throws:
AzDException
- Default Api Exception handler.
-
getQueries
Gets the root queries and their children- Specified by:
getQueries
in interfaceWorkItemTrackingDetails
- Returns:
- A list of QueryHierarchyItem Object
QueryHierarchyItems
- Throws:
AzDException
- Default Api Exception handler.
-
getQueries
public QueryHierarchyItems getQueries(int depth, QueryExpand expand, boolean includeDeleted) throws AzDException Gets the root queries and their children- Specified by:
getQueries
in interfaceWorkItemTrackingDetails
- Parameters:
depth
- In the folder of queries, return child queries and folders to this depth.expand
- Include the query string (wiql), clauses, query result columns, and sort options in the results.includeDeleted
- Include deleted queries and folders- Returns:
- A list of QueryHierarchyItem Object
QueryHierarchyItems
- Throws:
AzDException
- Default Api Exception handler.
-
getQuery
Retrieves an individual query and its children- Specified by:
getQuery
in interfaceWorkItemTrackingDetails
- Parameters:
query
- ID or path of the query.- Returns:
- QueryHierarchyItem Object
QueryHierarchyItem
- Throws:
AzDException
- Default Api Exception handler.
-
getQuery
public QueryHierarchyItem getQuery(String query, int depth, QueryExpand expand, boolean includeDeleted, boolean useIsoDateFormat) throws AzDException Retrieves an individual query and its children- Specified by:
getQuery
in interfaceWorkItemTrackingDetails
- Parameters:
query
- ID or path of the query.depth
- In the folder of queries, return child queries and folders to this depth.expand
- Include the query string (wiql), clauses, query result columns, and sort options in the results.includeDeleted
- Include deleted queries and foldersuseIsoDateFormat
- DateTime query clauses will be formatted using a ISO 8601 compliant format- Returns:
- QueryHierarchyItem Object
QueryHierarchyItem
- Throws:
AzDException
- Default Api Exception handler.
-
deleteQuery
Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder.- Specified by:
deleteQuery
in interfaceWorkItemTrackingDetails
- Parameters:
query
- ID or path of the query or folder to delete.- Throws:
AzDException
- Default Api Exception handler.
-
getQueryBatches
public QueryHierarchyItems getQueryBatches(QueryErrorPolicy errorPolicy, QueryExpand expand, String[] ids) throws AzDException Gets a list of queries by ids (Maximum 1000)- Specified by:
getQueryBatches
in interfaceWorkItemTrackingDetails
- Parameters:
errorPolicy
- The flag to control error policy in a query batch request. Possible options are { Fail, Omit }.expand
- The expand parameters for queries. Possible options are { None, Wiql, Clauses, All, Minimal }ids
- The requested query ids- Returns:
- QueryHierarchyItem Object
QueryHierarchyItem
- Throws:
AzDException
- Default Api Exception handler.
-
searchQuery
- Specified by:
searchQuery
in interfaceWorkItemTrackingDetails
- Throws:
AzDException
-
searchQuery
public QueryHierarchyItemsResult searchQuery(String filter, QueryExpand expand, boolean includeDeleted, int top) throws AzDException - Specified by:
searchQuery
in interfaceWorkItemTrackingDetails
- Throws:
AzDException
-