Interface WebhookService

All Known Implementing Classes:
WebhookServiceImpl

public interface WebhookService
  • Method Details

    • getWebhooks

      List<WebHook> getWebhooks(String currentUser, int offset, int limit, boolean forceUpdate) throws IllegalAccessException
      Get available github hooks using offset and limit.
      Parameters:
      currentUser - user name attempting to access connector hooks
      offset - Offset of result
      limit - Limit of result
      forceUpdate - force Load remote webhook or not.
      Returns:
      List of WebHook
      Throws:
      IllegalAccessException - when user is not authorized to access github hooks
    • getWebhookId

      WebHook getWebhookId(long webhookId)
      Retrieves a webHook identified by its technical identifier.
      Parameters:
      webhookId - WebHook technical identifier
      Returns:
      found WebHook
    • getWebhookId

      WebHook getWebhookId(long webhookId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves a webHook identified by its technical identifier accessed by a user
      Parameters:
      webhookId - WebHook technical identifier
      username - user name attempting to access connector webhook
      Returns:
      found WebHook
      Throws:
      IllegalAccessException - when user is not authorized to access webhook
      org.exoplatform.commons.exception.ObjectNotFoundException - webhook not found
    • getWebhooks

      List<WebHook> getWebhooks(int offset, int limit, boolean forceUpdate)
      Get available github hooks using offset and limit.
      Parameters:
      offset - Offset of result
      limit - Limit of result
      forceUpdate - force Load remote webhooks or not.
      Returns:
      List of WebHook
    • countWebhooks

      int countWebhooks(String currentUser, boolean forceUpdate) throws IllegalAccessException
      Count all gitHub webhooks
      Parameters:
      currentUser - User name accessing webhooks
      forceUpdate - force Load remote webhooks count or not.
      Returns:
      webhooks count
      Throws:
      IllegalAccessException - when user is not authorized to get github webhooks
    • createWebhook

      void createWebhook(String organizationName, String accessToken, String currentUser) throws org.exoplatform.commons.ObjectAlreadyExistsException, IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      create github organization hook.
      Parameters:
      organizationName - github organization name
      accessToken - gitHub personal access token
      currentUser - user name attempting to create github hook
      Throws:
      org.exoplatform.commons.ObjectAlreadyExistsException - when webhook already exists
      IllegalAccessException - when user is not authorized to create github webhook
      org.exoplatform.commons.exception.ObjectNotFoundException - when the github organization identified by its technical name is not found
    • updateWebHookAccessToken

      void updateWebHookAccessToken(long webHookId, String accessToken, String currentUser) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Update github organization hook.
      Parameters:
      webHookId - webHook Id
      accessToken - gitHub personal access token
      currentUser - user name attempting to update github hook
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • deleteWebhookHook

      void deleteWebhookHook(long organizationId, String currentUser) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      delete gitHub webhook
      Parameters:
      organizationId - github remote organization id
      currentUser - user name attempting to delete gitHub hook
      Throws:
      IllegalAccessException - when user is not authorized to delete the gitHub hook
      org.exoplatform.commons.exception.ObjectNotFoundException
    • forceUpdateWebhooks

      void forceUpdateWebhooks()
      Force update the stored github organization webhooks if there is a change to the remote webhooks, such as an entity deletion or the update event
    • verifyWebhookSecret

      boolean verifyWebhookSecret(String payload, String signature)
      Parameters:
      payload - payload The raw payload of the webhook request.
      signature - The signature received from the external system.
      Returns:
      true if the computed signature matches the provided signature.
    • isWebHookRepositoryEnabled

      boolean isWebHookRepositoryEnabled(String payload)
      Check if webhook repository is enabled
      Parameters:
      payload - payload The raw payload of the webhook request.
      Returns:
      true if the intended repository is enabled, else false.
    • isWebHookRepositoryEnabled

      boolean isWebHookRepositoryEnabled(long organizationRemoteId, long repositoryRemoteId)
      Check if webhook repository is enabled
      Parameters:
      organizationRemoteId - gitHub organization remote Id
      repositoryRemoteId - gitHub repository remote Id
      Returns:
      true if the intended repository is enabled, else false.
    • setWebHookRepositoryEnabled

      void setWebHookRepositoryEnabled(long organizationRemoteId, long repositoryRemoteId, boolean enabled, String currentUser) throws IllegalAccessException
      enables/disables repository
      Parameters:
      organizationRemoteId - gitHub organization remote Id
      repositoryRemoteId - gitHub repository remote Id
      enabled - true to enabled, else false
      currentUser - user name attempting to enables/disables repository.
      Throws:
      IllegalAccessException - when user is not authorized enables/disables repository
    • isWebHookWatchLimitEnabled

      boolean isWebHookWatchLimitEnabled(long organizationRemoteId)
      Check if webhook watch limit is enabled
      Parameters:
      organizationRemoteId - gitHub organization remote Id
      Returns:
      true if webHook watch limit is enabled, else false.
    • setWebHookWatchLimitEnabled

      void setWebHookWatchLimitEnabled(long organizationRemoteId, boolean enabled, String currentUser) throws IllegalAccessException
      Limit webhook watch scope or not
      Parameters:
      organizationRemoteId - gitHub organization remote Id
      enabled - true to enabled, else false
      currentUser - user name attempting to enables/disables webHook watch limit.
      Throws:
      IllegalAccessException - when user is not authorized Limit webhook watch scope
    • retrieveOrganizationRepos

      List<RemoteRepository> retrieveOrganizationRepos(long organizationRemoteId, String currentUser, int page, int perPage, String keyword) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieve available github organization repositories.
      Parameters:
      organizationRemoteId - gitHub organization remote Id
      currentUser - user name attempting to access remote organization repositories
      page - page
      perPage - perPage
      keyword - to search in repositories title
      Returns:
      List of RemoteRepository
      Throws:
      IllegalAccessException - when user is not authorized to access remote organization repositories
      org.exoplatform.commons.exception.ObjectNotFoundException
    • setEventEnabledForOrganization

      void setEventEnabledForOrganization(long eventId, long organizationId, boolean enabled, String currentUser) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Enables/disables organization event
      Parameters:
      eventId - event Id
      organizationId - organization remote id
      enabled - true to enabled, else false
      currentUser - user name attempting to enables/disables event.
      Throws:
      IllegalAccessException - when user is not authorized enables/disables organization event
      org.exoplatform.commons.exception.ObjectNotFoundException