NetlifyIntegration
The NetlifyIntegration
provides different methods to help create your integration.
Usage example
// src/index.ts
import { NetlifyIntegration } from "@netlify/sdk";
const integration = new NetlifyIntegration();
// Adding a build event handler
integration.addBuildEventHandler("onPreBuild", () => {
console.log("This is my first build event handler!");
});
Type parameters
Name | Type |
---|---|
SiteConfigSchema | ZodSchema , undefined |
TeamConfigSchema | ZodSchema , undefined |
BuildContext | ZodSchema , undefined |
BuildConfigSchema | ZodSchema , undefined |
Methods
addBuildEventContext
addBuildEventContext(func)
Used to add a build context to the integration that can be used in a build event handler.
Parameters
Name | Type |
---|---|
handler | func |
Returns
Returns a promise with an object
.
addBuildEventHandler
addBuildEventHandler(type, func)
Used to add a build event handler to the integration.
Parameters
Name | Type |
---|---|
type | BuildHookType , one of the build events |
func | func |
Returns
void
addConnector
addConnector(config)
Used to create a connector for the integration.
Parameters
Name | Type |
---|---|
config | ConnectorConfig |
Returns
addApiHandler
addApiHandler(name, func)
Used to add an API handler to the integration.
Parameters
Name | Type |
---|---|
name | string |
func | func |
Returns
void
onDisable
onDisable(func)
Used to customize the disable flow.
Parameters
Name | Type |
---|---|
func | func |
Returns
void
onEnable
onEnable(func)
Used to customize the enable flow.
Parameters
Name | Type |
---|---|
func | func |
Returns
void