Package org.azd.core

Class CoreApi

All Implemented Interfaces:
CoreDetails

public class CoreApi extends AzDAsyncApi<CoreApi> implements CoreDetails
Core class to manage core API
  • Constructor Details

    • CoreApi

      public CoreApi(Connection connection)
      Pass the connection object to work with Core Api
      Parameters:
      connection - Connection object
  • Method Details

    • getProcesses

      public Processes getProcesses() throws AzDException
      Get a list of processes.
      Specified by:
      getProcesses in interface CoreDetails
      Returns:
      a list of processes Processes
      Throws:
      AzDException - Default Api Exception handler.
    • createProject

      public OperationReference createProject(String projectName, String description) throws AzDException
      Creates a default scrum project
      Specified by:
      createProject in interface CoreDetails
      Parameters:
      projectName - pass the project name
      description - pass the description for the project
      Returns:
      object with link to the project
      Throws:
      AzDException - Default Api Exception handler.
    • createProject

      public OperationReference createProject(String projectName, String description, String sourceControlType, String templateTypeId) throws AzDException
      Creates a project for given process id
      Specified by:
      createProject in interface CoreDetails
      Parameters:
      projectName - pass the project name
      description - project description
      sourceControlType - type of version control
      templateTypeId - pass the process id. Run getProcesses to get the list of process id
      Returns:
      object with link to the project
      Throws:
      AzDException - Default Api Exception handler.
    • deleteProject

      public OperationReference deleteProject(String projectId) throws AzDException
      Queues a project to be deleted.

      You should pass the project id to delete it. Passing the project name won't delete. To get the project id run getProject() with projectName and get the Id.

      Specified by:
      deleteProject in interface CoreDetails
      Parameters:
      projectId - pass the project id
      Returns:
      object of deleted project with url
      Throws:
      AzDException - Default Api Exception handler.
    • getProject

      public Project getProject(String projectName) throws AzDException
      Get project with the specified id or name
      Specified by:
      getProject in interface CoreDetails
      Parameters:
      projectName - pass the project name or id
      Returns:
      project object Project
      Throws:
      AzDException - Default Api Exception handler.
    • getProject

      public Project getProject(String projectName, boolean includeCapabilities, boolean includeHistory) throws AzDException
      Get project with the specified id or name with optional parameters
      Specified by:
      getProject in interface CoreDetails
      Parameters:
      projectName - pass the project name or id
      includeCapabilities - Include capabilities (such as source control) in the team project result (default: false).
      includeHistory - Search within renamed projects (that had such name in the past).
      Returns:
      project object Project
      Throws:
      AzDException - Default Api Exception handler.
    • getProjectProperties

      public ProjectProperties getProjectProperties(String projectId) throws AzDException
      Get a collection of team project properties.
      Specified by:
      getProjectProperties in interface CoreDetails
      Parameters:
      projectId - provide the project guid not the project name
      Returns:
      ProjectProperties ProjectProperties
      Throws:
      AzDException - Default Api Exception handler.
    • getProjects

      public Projects getProjects() throws AzDException
      Get all projects in the organization that the authenticated user has access to.
      Specified by:
      getProjects in interface CoreDetails
      Returns:
      array of projects Projects
      Throws:
      AzDException - Default Api Exception handler.
    • getProjects

      public Projects getProjects(Integer skip, Integer top, Number continuationToken, Boolean getDefaultTeamImageUrl, ProjectState stateFilter) throws AzDException
      Get all projects in the organization that the authenticated user has access to.
      Specified by:
      getProjects in interface CoreDetails
      Parameters:
      skip - specify how many projects to skip
      top - specify the number projects to retrieve
      continuationToken - specify the next value to retrieve
      getDefaultTeamImageUrl - if true gets the default team image url
      stateFilter - allowed values are [all, createPending, deleted, deleting, new, unchanged, wellFormed]
      Returns:
      array of projects Projects
      Throws:
      AzDException - Default Api Exception handler.
    • updateProject

      public OperationReference updateProject(String projectId, Project projectParameters) throws AzDException
      Update an existing project's name, abbreviation, description, or restore a project.
      Specified by:
      updateProject in interface CoreDetails
      Parameters:
      projectId - pass the project id
      projectParameters - HashMap of project parameters to be updated.

      Refer "https://docs.microsoft.com/en-us/rest/api/azure/devops/core/projects/update?view=azure-devops-rest-6.1"

      Returns:
      an object or team project with url
      Throws:
      AzDException - Default Api Exception handler.
    • createTeam

      public WebApiTeam createTeam(String projectName, String teamName) throws AzDException
      Create a team in a team project.
      Specified by:
      createTeam in interface CoreDetails
      Parameters:
      projectName - project name or GUID
      teamName - pass the team name
      Returns:
      returns web api object
      Throws:
      AzDException - Default Api Exception handler.
    • deleteTeam

      public Void deleteTeam(String projectName, String teamName) throws AzDException
      Delete a team.
      Specified by:
      deleteTeam in interface CoreDetails
      Parameters:
      projectName - pass the project name or id
      teamName - pass the team name
      Throws:
      AzDException - Default Api Exception handler.
    • getTeam

      public WebApiTeam getTeam(String projectName, String teamName) throws AzDException
      Get a specific team.
      Specified by:
      getTeam in interface CoreDetails
      Parameters:
      projectName - pass the project name or id
      teamName - pass the team name
      Returns:
      team object
      Throws:
      AzDException - Default Api Exception handler.
    • getTeam

      public WebApiTeam getTeam(String projectName, String teamName, boolean expandIdentity) throws AzDException
      Get a specific team.
      Specified by:
      getTeam in interface CoreDetails
      Parameters:
      projectName - pass the project name or id
      teamName - pass the team name
      expandIdentity - if true gets the identity object
      Returns:
      team object
      Throws:
      AzDException - Default Api Exception handler.
    • getTeams

      public WebApiTeams getTeams() throws AzDException
      Get a list of all teams.
      Specified by:
      getTeams in interface CoreDetails
      Returns:
      array of team
      Throws:
      AzDException - Default Api Exception handler.
    • getTeams

      public WebApiTeams getTeams(boolean expandIdentity, boolean mine, int skip, int top) throws AzDException
      Get a list of all teams.
      Specified by:
      getTeams in interface CoreDetails
      Parameters:
      expandIdentity - if true gets the identity object
      mine - if true gets the team to which user has access to
      skip - pass to skip number of teams
      top - pass to retrieve number of teams
      Returns:
      array of team
      Throws:
      AzDException - Default Api Exception handler.
    • updateTeams

      public WebApiTeam updateTeams(String projectName, String teamName, String description) throws AzDException
      Update a team's name and/or description.
      Specified by:
      updateTeams in interface CoreDetails
      Parameters:
      projectName - The name or ID (GUID) of the team project containing the team to update.
      teamName - The name or ID of the team to update.
      description - provide the description for your team to update
      Returns:
      team object WebApiTeam
      Throws:
      AzDException - Default Api Exception handler.
    • getFeatureState

      public Optional<Boolean> getFeatureState(String projectId, FeatureManagement feature) throws AzDException
      Call un-published API feature to fetch project service feature state. See FeatureManagement for current list of features. Besides an 'enabled' and 'disabled' state, there is also an undefined state, hence the Optional return wrapper
      Specified by:
      getFeatureState in interface CoreDetails
      Parameters:
      projectId - project identifier
      feature - FeatureManagement enum type for which to return state
      Returns:
      Optional wrapped boolean, empty if state is undefined
      Throws:
      AzDException - Default Api Exception handler
    • featureToggle

      public ProjectFeature featureToggle(String projectId, FeatureManagement feature, boolean state) throws AzDException
      Set project feature state for project service See FeatureManagement for list of features
      Specified by:
      featureToggle in interface CoreDetails
      Parameters:
      projectId - project identifier
      feature - enum value for feature to enable or disable
      state - enable or disable feature
      Returns:
      object containing feature id and state
      Throws:
      AzDException - Default Api Exception handler