import { type DisplayProperty, type EventFilter, type HttpEndpointMetadata, type RequestFilter, type TriggerMetadata } from "@systemfsoftware/trigger.dev_core-v2"; import { Job } from "./job.js"; import { TriggerClient } from "./triggerClient.js"; import type { EventSpecification, EventSpecificationExample, Trigger, VerifyResult } from "./types.js"; type HttpEndpointOptions> = { id: string; enabled?: boolean; event: TEventSpecification; respondWith?: RespondWith; verify: VerifyCallback; }; export type RequestOptions = { filter?: RequestFilter; }; export declare class HttpEndpoint> { private readonly options; constructor(options: HttpEndpointOptions); get id(): string; onRequest(options?: RequestOptions): HttpTrigger>; toJSON(): HttpEndpointMetadata; } type TriggerOptions> = { endpointId: string; event: TEventSpecification; filter?: EventFilter; verify: VerifyCallback; }; declare class HttpTrigger> implements Trigger { private readonly options; constructor(options: TriggerOptions); toJSON(): TriggerMetadata; get event(): TEventSpecification; attachToJob(triggerClient: TriggerClient, job: Job, any>): void; get preprocessRuns(): boolean; verifyPayload(payload: Request): Promise; } type RespondWith = { /** Only Requests that match this filter will cause the `handler` function to run. * For example, you can use this to only respond to `GET` Requests. */ filter?: RequestFilter; /** If you set this to `true`, the Request that comes in won't go on to Trigger any Runs. * This is useful if you want to Respond to the Request, but don't want to Trigger any Runs. */ skipTriggeringRuns?: boolean; /** This is a function that's called when a Request comes in. * It's passed the Request object, and expects you to return a Response object. */ handler: (request: Request, verify: () => Promise) => Promise; }; export type VerifyCallback = (request: Request) => Promise; export type EndpointOptions = { /** Used to uniquely identify the HTTP Endpoint inside your Project. */ id: string; enabled?: boolean; /** Usually you would use the domain name of the service, e.g. `cal.com`. */ source: string; /** An optional title, displayed in the dashboard. */ title?: string; /** An optional icon name that's displayed in the dashboard. * Lots of company names are supported, e.g. `github`, `twilio`. * You can also reference the name of any [Tabler icon](https://tabler-icons.io/), e.g. `brand-google-maps`, `brand-twitch`. */ icon?: string; /** Used to provide example payloads that are accepted by the job. * This will be available in the dashboard and can be used to trigger test runs. */ examples?: EventSpecificationExample[]; /** Properties that are displayed in the dashboard. */ properties?: DisplayProperty[]; /** This optional object allows you to immediately Respond to a Request. This is useful for some APIs where they do a `GET` Request when the webhook is first setup and expect a specific Response. Only use this if you really need to Respond to the Request that comes in. Most of the time you don't. */ respondWith?: RespondWith; /** This is compulsory, and is used to verify that the received webhook is authentic. * It's a function that expects you to return a result object like: In 90% of cases, you'll want to use the `verifyRequestSignature` helper function we provide. @example ```ts //if it's valid return { success: true } //if it's invalid, reason is optional return { success: false, reason: "No header" } ``` */ verify: VerifyCallback; }; export declare function httpEndpoint(options: EndpointOptions): HttpEndpoint>; export {}; //# sourceMappingURL=httpEndpoint.d.ts.map