public interface

HookScript

implements MinimalHookScript
com.atlassian.bitbucket.hook.script.HookScript

Class Overview

Describes a hook script.

A script represents some form of executable, such as a shell script or binary, which can be run in response to repository changes. Scripts are managed separately from the repositories where they're enabled to simplify the process of administering them. For example, if a given script is enabled in 2,000 different repositories, it can be updated in, or deleted from, all of them simultaneously with a single operation.

Summary

Public Methods
@Nonnull Date getCreatedDate()
@Nonnull Optional<String> getDescription()
Retrieves the script's description.
@Nonnull String getName()
Retrieves the script's name.
@Nonnull String getPluginKey()
Retrieves the plugin key for the app which created the script.
int getSize()
@Nonnull HookScriptType getType()
Retrieves the script's type.
@Nonnull Date getUpdatedDate()
[Expand]
Inherited Methods
From interface com.atlassian.bitbucket.hook.script.MinimalHookScript

Public Methods

@Nonnull public Date getCreatedDate ()

Returns
  • the date the script was created

@Nonnull public Optional<String> getDescription ()

Retrieves the script's description. Descriptions are limited to 255 characters but are otherwise free-form.

Returns
  • the script's description

@Nonnull public String getName ()

Retrieves the script's name. Names are limited to 255 characters but are otherwise free-form.

When a pre-style hook script rejects an update, the script's name is included in the veto added to the hook result. Like a filename, hook script names should be short, but descriptive. (However, unlike a filename, filesystem limitations do not apply to hook script names.)

Returns
  • the script's name

@Nonnull public String getPluginKey ()

Retrieves the plugin key for the app which created the script. Plugin keys are limited to 255 characters.

When a script is created, the app which creates it must provide its plugin key. This allows scripts to be associated with the app that created them, for administrative purposes.

Note: App developers are strongly discouraged from changing their plugin keys. While the key associated with a hook script can be updated later, this is only one of many references the overall system may have to an app's plugin key.

Returns
  • the plugin key for the app which created the script

public int getSize ()

Returns
  • the size of the script's contents

@Nonnull public HookScriptType getType ()

Retrieves the script's type.

Hook scripts can be written to be invoked as PreRepositoryHooks or PostRepositoryHooks. The type must be specified when the script is created, and cannot be updated after.

Returns
  • the script's type, indicating whether it will be invoked before or after changes are accepted

@Nonnull public Date getUpdatedDate ()

Returns
  • the date the script was last updated