MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / getFirstMethodAndEndpoint

Function getFirstMethodAndEndpoint

frontend/src/utils/util.ts:32–51  ·  view source on GitHub ↗
(openapiJson:any)

Source from the content-addressed store, hash-verified

30 return result;
31 };
32 const getFirstMethodAndEndpoint = (openapiJson:any) => {
33 if (!openapiJson || !openapiJson.paths || !openapiJson.servers) {
34 return null;
35 }
36 const baseUrl = openapiJson.servers[0].url;
37 const paths = Object.keys(openapiJson.paths);
38
39 if (paths.length === 0) {
40 return null;
41 }
42
43 const firstPath = paths[0];
44 const methods = openapiJson.paths[firstPath];
45 const firstMethod = Object.keys(methods)[0];
46
47 return {
48 method: firstMethod.toUpperCase(),
49 endpoint: baseUrl + firstPath
50 };
51 }
52 const formatTimestamp = (timestamp:number) => {
53 const date = new Date(timestamp);
54 const options: Intl.DateTimeFormatOptions = { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false,month: 'short', day: 'numeric', year: 'numeric' };

Callers 4

ActionsFunction · 0.90
fetchDataFunction · 0.90
fetchActionsListFunction · 0.90
fetchActionsListFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected