public interface

HookService

com.atlassian.bitbucket.hook.HookService

Class Overview

A service which handles the management of hook requests. It allows SCM providers to register hosting requests with the application and allow the SCM layer to callback to server via a socket

Summary

Public Methods
@Nullable <T> T doWithHookRequest(int repositoryId, Function<HookRequestHandle, T> callback)
Perform an operation with a hook request
@Nonnull HookRequestHandle registerRequest(int repositoryId)
Register a hosting request with the hook service.

Public Methods

@Nullable public T doWithHookRequest (int repositoryId, Function<HookRequestHandle, T> callback)

Perform an operation with a hook request

Parameters
repositoryId the id of the repository the hosting request is for
callback a callback which will handle the operation
Returns
  • the value returned from the callback

@Nonnull public HookRequestHandle registerRequest (int repositoryId)

Register a hosting request with the hook service. It is the responsibility of the SCM provider to call close() when the request is complete. It is suggested for implementers to use doWithHookRequest(int, java.util.function.Function) if possible as this will clean up the request for the callee

Parameters
repositoryId the id of the repository the hosting request is for
Returns
  • a handle for the HookRequest.