Package org.azd.helpers.workitemtracking
Class WorkItemTrackingHelpersRequestBuilder
java.lang.Object
org.azd.abstractions.BaseRequestBuilder
org.azd.workitemtracking.WorkItemTrackingRequestBuilder
org.azd.helpers.workitemtracking.WorkItemTrackingHelpersRequestBuilder
Helper request builder that combines multiple Apis to create logical helper methods for ease of use.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.azd.abstractions.BaseRequestBuilder
BaseRequestBuilder.ProjectExcludeParameter -
Field Summary
Fields inherited from class org.azd.abstractions.BaseRequestBuilder
accessTokenCredential, apiVersion, area, locationId, organizationUrl, serializer -
Constructor Summary
ConstructorsConstructorDescriptionWorkItemTrackingHelpersRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential) Instantiates a new RequestBuilder instance and sets the default values. -
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.createWorkItem(String workItemType, String title) Creates a single work item.createWorkItem(String workItemType, String title, String description, String[] tags) Creates a single work item.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.Methods inherited from class org.azd.workitemtracking.WorkItemTrackingRequestBuilder
attachments, classificationNodes, fields, projectProcessMigration, queries, recycleBin, revisions, tags, wiql, workItems, workItemTypes, workItemTypesFieldMethods inherited from class org.azd.abstractions.BaseRequestBuilder
builder
-
Constructor Details
-
WorkItemTrackingHelpersRequestBuilder
public WorkItemTrackingHelpersRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential) Instantiates a new RequestBuilder instance and sets the default values.- Parameters:
organizationUrl- Represents organization location request url.accessTokenCredential- Access token credential object.
-
-
Method Details
-
createWorkItem
Creates a single work item.- Parameters:
workItemType- The work item type of the work item to create. e.g., "user story", "bug", "task"title- The title for the work item- Returns:
WorkItem- Throws:
AzDException- Default Api Exception handler.
-
createWorkItem
public WorkItem createWorkItem(String workItemType, String title, String description, String[] tags) throws AzDException Creates a single work item.- 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 itemtags- Tags for the work item- Returns:
WorkItem- Throws:
AzDException- Default Api Exception handler.
-
addHyperLinks
Create hyperlinks for the given work item.- Parameters:
workItemId- The work item's ID.hyperlinksMap- AMapthat 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
AzDExceptionis thrown.- Parameters:
workItemId- The work item's ID.urls- AListwith the URL of the hyperlinks.- Returns:
- The updated
WorkItem. - Throws:
AzDException- Handles errors from REST API and validates passed arguments.
-
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.- 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.- 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.
-