public interface RepositoryHookService
Modifier and Type | Method and Description |
---|---|
SettingsBuilder |
createSettingsBuilder()
Create a new
SettingsBuilder which can be used to create a Settings instance. |
void |
delete(DeleteRepositoryHookRequest request)
Delete the hook configuration specified in the request.
|
RepositoryHook |
disable(DisableRepositoryHookRequest request)
Disable the hook specified in the request.
|
RepositoryHook |
enable(EnableRepositoryHookRequest request)
Enable and apply settings for the hook specified in the request.
|
CacheableAvatarSupplier |
getAvatar(String hookKey)
Returns a supplier of an avatar for this hook, either one specified in the module or a default.
|
RepositoryHook |
getByKey(Scope scope,
String hookKey)
Find an effective installed hook with the specified key enabled status for this scope.
|
RepositoryHookSettings |
getSettings(GetRepositoryHookSettingsRequest request)
Gets the effective settings for the hook specified in the request.
|
int |
migrateSettings(String oldHookKey,
String newHookKey)
Migrates settings between the specified hook keys.
|
<T extends RepositoryHookRequest> |
postUpdate(T request)
Calls all registered and enabled
repository-hook modules (PostRepositoryHook ) |
<T extends RepositoryHookRequest> |
preUpdate(T request)
Calls all registered and enabled
repository-hook modules (PreRepositoryHook ) |
Page<RepositoryHook> |
search(RepositoryHookSearchRequest request,
PageRequest pageRequest)
Searches for
repository hooks that match the provided request . |
Settings |
setSettings(SetRepositoryHookSettingsRequest request)
Sets the settings for the hook specified in the request.
|
@Nonnull SettingsBuilder createSettingsBuilder()
SettingsBuilder
which can be used to create a Settings
instance.void delete(@Nonnull DeleteRepositoryHookRequest request)
request
- describes the hook for which the configuration should be deletedArgumentValidationException
- if the provided request is for any Scope
other than
REPOSITORY
@Nonnull RepositoryHook disable(@Nonnull DisableRepositoryHookRequest request)
request
- describing the hook to be disabledRepositoryHook
@Nonnull RepositoryHook enable(@Nonnull EnableRepositoryHookRequest request) throws FormValidationException
request
- details for enabling a repository hookRepositoryHook
FormValidationException
- when settings are invalid, leaving the existing version unchangedArgumentValidationException
- if the settings to be saved are too large, the current limit is 32KB
once serialized.@Nonnull CacheableAvatarSupplier getAvatar(@Nonnull String hookKey)
hookKey
- the hook key with the desired avatar@Nullable RepositoryHook getByKey(@Nonnull Scope scope, @Nonnull String hookKey)
An effective hook is a hook that is either:
Repository hooks
can be configured at
project scope
or
repository scope
scope
- the scope to load the hook fromhookKey
- the hook to lookupRepositoryHook
if found. Otherwise null
.@Nullable RepositoryHookSettings getSettings(@Nonnull GetRepositoryHookSettingsRequest request)
request
- details to get the settings for the specified hooknull
if no settings are stored.int migrateSettings(@Nonnull String oldHookKey, @Nonnull String newHookKey)
Hook keys are based on the combination of the plugin's key and the <repository-hook/>
's key
attribute. Changing either key will result in a new hook key, and the "loss" of all existing settings
in all repositories (because they remain associated with the old key).
When calling this method, the <repository-hook/>
for the specified oldHookKey
must no longer
be installed, and the <repository-hook/>
for the new key must be present.
Calling this method requires ADMIN
permission.
Apps may need to use the SecurityService
to apply that permission.
oldHookKey
- the hook's old keynewHookKey
- the hook's new keyArgumentValidationException
- if the old hook is still installed, or the new hook is not installed<T extends RepositoryHookRequest> void postUpdate(@Nonnull T request)
repository-hook
modules (PostRepositoryHook
)T
- type of the requestrequest
- describes the ref changes that have been applied@Nonnull <T extends RepositoryHookRequest> RepositoryHookResult preUpdate(@Nonnull T request)
repository-hook
modules (PreRepositoryHook
)T
- type of the requestrequest
- describes the ref changes that are about to be maderepository-hook
modules@Nonnull Page<RepositoryHook> search(@Nonnull RepositoryHookSearchRequest request, @Nonnull PageRequest pageRequest)
repository hooks
that match the provided request
.request
- a request object describing the repository hooks to returnpageRequest
- paging optionsRepositoryHook
s matching the supplied type@Nonnull Settings setSettings(@Nonnull SetRepositoryHookSettingsRequest request) throws FormValidationException
request
- describing the update settings requestFormValidationException
- when settings are invalid, leaving the existing version unchangedArgumentValidationException
- if the settings to be saved are too large, the current limit is 32KB
once serialized.createSettingsBuilder()
Copyright © 2024 Atlassian. All rights reserved.