public abstract class AbstractRepositoryHookRequest extends Object implements RepositoryHookRequest
RepositoryHookRequests
. Plugins that want to invoke
pre-hooks
or
post-hooks
with a custom request type can use
this class as a base class to provide the common request attributes.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractRepositoryHookRequest.AbstractBuilder<B extends AbstractRepositoryHookRequest.AbstractBuilder<B>> |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRepositoryHookRequest(AbstractRepositoryHookRequest.AbstractBuilder<?> builder) |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getContext()
Retrieves any additional context that was supplied to the request.
|
Collection<RefChange> |
getRefChanges() |
Repository |
getRepository() |
Optional<ScmHookDetails> |
getScmHookDetails() |
RepositoryHookTrigger |
getTrigger() |
boolean |
isDryRun() |
protected AbstractRepositoryHookRequest(AbstractRepositoryHookRequest.AbstractBuilder<?> builder)
@Nonnull public Map<String,Object> getContext()
RepositoryHookRequest
On dry runs
, the context will always be empty.
getContext
in interface RepositoryHookRequest
@Nonnull public Collection<RefChange> getRefChanges()
getRefChanges
in interface RepositoryHookRequest
empty
for some dry-run requests where the
target hash is not yet known because the relevant commit hasn't been created yet. As an example, this is
the case for merge requests
. In these cases, the specialized request type should
provide sufficient information about the proposed change. For MergeHookRequest
, this would be
MergeHookRequest.getFromRef()
and MergeHookRequest.getToRef()
.@Nonnull public Repository getRepository()
getRepository
in interface RepositoryHookRequest
@Nonnull public Optional<ScmHookDetails> getScmHookDetails()
getScmHookDetails
in interface RepositoryHookRequest
@Nonnull public RepositoryHookTrigger getTrigger()
getTrigger
in interface RepositoryHookRequest
public boolean isDryRun()
isDryRun
in interface RepositoryHookRequest
true
if this hook is a dry-run request, otherwise false
Copyright © 2020 Atlassian. All rights reserved.