MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / registerTrigger

Method registerTrigger

packages/trigger-sdk/src/apiClient.ts:351–385  ·  view source on GitHub ↗
(
    client: string,
    id: string,
    key: string,
    payload: RegisterTriggerBodyV2,
    idempotencyKey?: string
  )

Source from the content-addressed store, hash-verified

349 }
350
351 async registerTrigger(
352 client: string,
353 id: string,
354 key: string,
355 payload: RegisterTriggerBodyV2,
356 idempotencyKey?: string
357 ): Promise<RegisterSourceEventV2> {
358 const apiKey = await this.#apiKey();
359
360 this.#logger.debug("registering trigger", {
361 id,
362 payload,
363 });
364
365 const headers: HeadersInit = {
366 "Content-Type": "application/json",
367 Authorization: `Bearer ${apiKey}`,
368 };
369
370 if (idempotencyKey) {
371 headers["Idempotency-Key"] = idempotencyKey;
372 }
373
374 const response = await zodfetch(
375 RegisterSourceEventSchemaV2,
376 `${this.#apiUrl}/api/v2/${client}/triggers/${id}/registrations/${key}`,
377 {
378 method: "PUT",
379 headers: headers,
380 body: JSON.stringify(payload),
381 }
382 );
383
384 return response;
385 }
386
387 async registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata) {
388 const apiKey = await this.#apiKey();

Callers

nothing calls this directly

Calls 3

#apiKeyMethod · 0.95
zodfetchFunction · 0.70
debugMethod · 0.65

Tested by

no test coverage detected