Hook API
The hook module of the @codebolt/plugin-sdk.
import plugin from '@codebolt/plugin-sdk';
Quick Reference
| Method | Description |
|---|---|
create | Create a new hook |
delete | Delete a hook |
disable | Disable a hook |
enable | Enable a hook |
get | Get a hook by ID |
initialize | Initialize the hook manager for a project |
list | List all hooks |
update | Update an existing hook |
Methods
create
plugin.hook.create(config: HookConfig): Promise<HookResponse>
Create a new hook
| Parameter | Type | Required | Description |
|---|---|---|---|
config | HookConfig | Yes | Hook configuration |
Returns: Promise<HookResponse>
delete
plugin.hook.delete(hookId: string): Promise<HookDeleteResponse>
Delete a hook
| Parameter | Type | Required | Description |
|---|---|---|---|
hookId | string | Yes | Hook ID |
Returns: Promise<HookDeleteResponse>
disable
plugin.hook.disable(hookId: string): Promise<HookResponse>
Disable a hook
| Parameter | Type | Required | Description |
|---|---|---|---|
hookId | string | Yes | Hook ID |
Returns: Promise<HookResponse>
enable
plugin.hook.enable(hookId: string): Promise<HookResponse>
Enable a hook
| Parameter | Type | Required | Description |
|---|---|---|---|
hookId | string | Yes | Hook ID |
Returns: Promise<HookResponse>
get
plugin.hook.get(hookId: string): Promise<HookResponse>
Get a hook by ID
| Parameter | Type | Required | Description |
|---|---|---|---|
hookId | string | Yes | Hook ID |
Returns: Promise<HookResponse>
initialize
plugin.hook.initialize(projectPath: string): Promise<HookInitializeResponse>
Initialize the hook manager for a project
| Parameter | Type | Required | Description |
|---|---|---|---|
projectPath | string | Yes | Path to the project |
Returns: Promise<HookInitializeResponse>
list
plugin.hook.list(): Promise<HookListResponse>
List all hooks
No parameters.
Returns: Promise<HookListResponse>
update
plugin.hook.update(hookId: string, config: Partial<HookConfig>): Promise<HookResponse>
Update an existing hook
| Parameter | Type | Required | Description |
|---|---|---|---|
hookId | string | Yes | Hook ID |
config | Partial<HookConfig> | Yes | Updated hook configuration |
Returns: Promise<HookResponse>