Class SpaceClient


  • public class SpaceClient
    extends Object
    • Method Detail

      • getProfile

        @NotNull
        public SpaceUser getProfile​(@NotNull
                                    String accessToken)
      • getProjectsId

        @NotNull
        public List<String> getProjectsId​(@NotNull
                                          String accessToken)
      • createUserPermanentToken

        @NotNull
        public String createUserPermanentToken​(@NotNull
                                               String accessToken,
                                               @NotNull
                                               String name,
                                               @NotNull
                                               String scope)
      • reportBuildStartedToMergeRequest

        public void reportBuildStartedToMergeRequest​(@NotNull
                                                     String accessToken,
                                                     @NotNull
                                                     String codeReviewId,
                                                     @NotNull
                                                     SBuild build)
      • reportBuildFinishedToMergeRequest

        public void reportBuildFinishedToMergeRequest​(@NotNull
                                                      String accessToken,
                                                      @NotNull
                                                      String codeReviewId,
                                                      @NotNull
                                                      SBuild build)
      • reportBuildFailedToMergeRequest

        public void reportBuildFailedToMergeRequest​(@NotNull
                                                    String accessToken,
                                                    @NotNull
                                                    String codeReviewId,
                                                    @NotNull
                                                    SBuild build)
      • reportBuildInterrupted

        public void reportBuildInterrupted​(@NotNull
                                           String accessToken,
                                           @NotNull
                                           String codeReviewId,
                                           @NotNull
                                           SBuild build)
      • reportBuildMarkedAsSuccessfulToMergeRequest

        public void reportBuildMarkedAsSuccessfulToMergeRequest​(@NotNull
                                                                String accessToken,
                                                                @NotNull
                                                                String codeReviewId,
                                                                @NotNull
                                                                SBuild build)
      • isPermissionReportExternalCheckEnabled

        public boolean isPermissionReportExternalCheckEnabled​(@NotNull
                                                              String accessToken,
                                                              @NotNull
                                                              String projectId,
                                                              @NotNull
                                                              String repository)
      • getAllMyProjects

        @NotNull
        public List<SpaceProject> getAllMyProjects​(@NotNull
                                                   String accessToken)
        Lists all Space projects / repositories the user can see. Can not be used for non-user tokens.
        Parameters:
        accessToken - a user access token
        Returns:
        found Space projects with their repositories
      • getAllProjects

        @NotNull
        public List<SpaceProject> getAllProjects​(@NotNull
                                                 String accessToken)
        Lists all Space projects / repositories depending on the access token. Can be used to get a Space application specific view.
        Parameters:
        accessToken - a Space access token
        Returns:
        found Space projects with their repositories
      • getRepositoryUrl

        @Nullable
        public String getRepositoryUrl​(@NotNull
                                       String accessToken,
                                       @NotNull
                                       String projectId,
                                       @NotNull
                                       String repositoryName)
      • requestApplicationRights

        public void requestApplicationRights​(@NotNull
                                             String accssToken,
                                             @NotNull
                                             String contextIdentifier,
                                             @NotNull
                                             Set<SpaceRight> rights)
      • createChildApplication

        @NotNull
        public SpaceApplication createChildApplication​(@NotNull
                                                       String name)
        Requests the creation of a Space application on behalf of the current Space application
        Returns:
        the created application with its credentials
      • getApplicationPublicKeys

        public SpaceJwks getApplicationPublicKeys()
        Retrieves the public keys associated with the current application in form of a JSON Web Key Set (JWKS).
        Returns:
        JWKS
      • getApplicationRights

        @NotNull
        public SpaceApplicationRights getApplicationRights​(@NotNull
                                                           String contextIdentifier)
        Retrieves all rights of the current application for the given context identifier.

        Note: only currently supported types of SpaceRight will be available.

        Parameters:
        contextIdentifier - Space context identifier
        Returns:
        Map of rights to their respective status
      • getApplicationAuthorizedContexts

        @NotNull
        public List<PermissionContext> getApplicationAuthorizedContexts()
        Retrieves all currently authorized contexts of the current application.

        Note: currently unsupported types of PermissionContext will not be included.

        Returns:
        list of permission context objects
      • getApplicationAuthorizedProjectKeys

        @NotNull
        public List<String> getApplicationAuthorizedProjectKeys()
        Retrieves all currently authorized project's project keys of the current application. This is implemented by getting all permission contexts (see getApplicationAuthorizedContexts()) and narrowing down to project permission contexts.
        Returns:
        list of authorized project's project keys
      • getApplication

        @NotNull
        public SpaceApplicationDTO getApplication()
        Retrieves the current application and its settings from Space.
        Returns:
        DTO for Space application
      • setupApplicationGettingStartedInfo

        public void setupApplicationGettingStartedInfo​(@NotNull
                                                       String callbackUrl,
                                                       @NotNull
                                                       String applicationTitle,
                                                       boolean useTab)
        Sets up the Space Getting Started UI extension for this application. This enables the redirect back to TeamCity after application installation.
        Parameters:
        callbackUrl - where the user will be redirected back to
        applicationTitle - title of the application in the Space UI
        useTab - whether a tab is used