Class WorkItemTrackingHelpersRequestBuilder

java.lang.Object
org.azd.abstractions.BaseRequestBuilder
org.azd.workitemtracking.WorkItemTrackingRequestBuilder
org.azd.helpers.workitemtracking.WorkItemTrackingHelpersRequestBuilder

public class WorkItemTrackingHelpersRequestBuilder extends WorkItemTrackingRequestBuilder
Helper request builder that combines multiple Apis to create logical helper methods for ease of use.
  • 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

      public WorkItem createWorkItem(String workItemType, String title) 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 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 item
      description - Description for the work item
      tags - Tags for the work item
      Returns:
      WorkItem
      Throws:
      AzDException - Default Api Exception handler.
    • addHyperLinks

      public WorkItem addHyperLinks(int workItemId, Map<String,String> hyperlinksMap) throws AzDException
      Create hyperlinks for the given work item.
      Parameters:
      workItemId - The work item's ID.
      hyperlinksMap - A Map 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

      public WorkItem removeHyperLinks(int workItemId, List<String> urls) throws AzDException
      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.

      Parameters:
      workItemId - The work item's ID.
      urls - A List with 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 AzDException
      Add 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.