Skip to main content

Hook API

The hook module of the @codebolt/plugin-sdk.

import plugin from '@codebolt/plugin-sdk';

Quick Reference​

MethodDescription
createCreate a new hook
deleteDelete a hook
disableDisable a hook
enableEnable a hook
getGet a hook by ID
initializeInitialize the hook manager for a project
listList all hooks
updateUpdate an existing hook

Methods​


create​

plugin.hook.create(config: HookConfig): Promise<HookResponse>

Create a new hook

ParameterTypeRequiredDescription
configHookConfigYesHook configuration

Returns: Promise<HookResponse>

Full reference →


delete​

plugin.hook.delete(hookId: string): Promise<HookDeleteResponse>

Delete a hook

ParameterTypeRequiredDescription
hookIdstringYesHook ID

Returns: Promise<HookDeleteResponse>

Full reference →


disable​

plugin.hook.disable(hookId: string): Promise<HookResponse>

Disable a hook

ParameterTypeRequiredDescription
hookIdstringYesHook ID

Returns: Promise<HookResponse>

Full reference →


enable​

plugin.hook.enable(hookId: string): Promise<HookResponse>

Enable a hook

ParameterTypeRequiredDescription
hookIdstringYesHook ID

Returns: Promise<HookResponse>

Full reference →


get​

plugin.hook.get(hookId: string): Promise<HookResponse>

Get a hook by ID

ParameterTypeRequiredDescription
hookIdstringYesHook ID

Returns: Promise<HookResponse>

Full reference →


initialize​

plugin.hook.initialize(projectPath: string): Promise<HookInitializeResponse>

Initialize the hook manager for a project

ParameterTypeRequiredDescription
projectPathstringYesPath to the project

Returns: Promise<HookInitializeResponse>

Full reference →


list​

plugin.hook.list(): Promise<HookListResponse>

List all hooks

No parameters.

Returns: Promise<HookListResponse>

Full reference →


update​

plugin.hook.update(hookId: string, config: Partial<HookConfig>): Promise<HookResponse>

Update an existing hook

ParameterTypeRequiredDescription
hookIdstringYesHook ID
configPartial<HookConfig>YesUpdated hook configuration

Returns: Promise<HookResponse>

Full reference →