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

Method getEndpointIndex

packages/cli/src/utils/triggerApi.ts:203–228  ·  view source on GitHub ↗
(indexId: string)

Source from the content-addressed store, hash-verified

201 }
202
203 async getEndpointIndex(indexId: string) {
204 const response = await fetch(`${this.baseUrl}/api/v1/endpointindex/${indexId}`, {
205 method: "GET",
206 headers: {
207 Accept: "application/json",
208 Authorization: `Bearer ${this.apiKey}`,
209 },
210 });
211
212 if (response.ok) {
213 const body = await response.json();
214 const parsed = GetEndpointIndexResponseSchema.safeParse(body);
215
216 if (parsed.success) {
217 return parsed.data;
218 }
219 }
220
221 return {
222 status: "FAILURE" as const,
223 error: {
224 message: `Bad response from Trigger.dev (${response.status})`,
225 },
226 updatedAt: new Date(),
227 };
228 }
229}
230
231function safeJsonParse(raw: string | null | undefined): unknown {

Callers 1

fetchIndexResultFunction · 0.80

Calls 2

jsonMethod · 0.80
fetchFunction · 0.70

Tested by

no test coverage detected