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

Method registerEndpoint

packages/trigger-sdk/src/apiClient.ts:105–136  ·  view source on GitHub ↗
(options: { url: string; name: string })

Source from the content-addressed store, hash-verified

103 }
104
105 async registerEndpoint(options: { url: string; name: string }): Promise<EndpointRecord> {
106 const apiKey = await this.#apiKey();
107
108 this.#logger.debug("Registering endpoint", {
109 url: options.url,
110 name: options.name,
111 });
112
113 const response = await fetch(`${this.#apiUrl}/api/v1/endpoints`, {
114 method: "POST",
115 headers: {
116 "Content-Type": "application/json",
117 Authorization: `Bearer ${apiKey}`,
118 },
119 body: JSON.stringify({
120 url: options.url,
121 name: options.name,
122 }),
123 });
124
125 if (response.status >= 400 && response.status < 500) {
126 const body = await response.json();
127
128 throw new Error(body.error);
129 }
130
131 if (response.status !== 200) {
132 throw new Error(`Failed to register entry point, got status code ${response.status}`);
133 }
134
135 return await response.json();
136 }
137
138 async runTask(
139 runId: string,

Callers

nothing calls this directly

Calls 4

#apiKeyMethod · 0.95
jsonMethod · 0.80
debugMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected