MCPcopy Index your code
hub / github.com/simstudioai/sim / callZoomInfo

Function callZoomInfo

apps/sim/app/api/tools/zoominfo/proxy/route.ts:45–79  ·  view source on GitHub ↗
(req: ZoomInfoProxyRequest, accessToken: string)

Source from the content-addressed store, hash-verified

43}
44
45async function callZoomInfo(req: ZoomInfoProxyRequest, accessToken: string): Promise<Invocation> {
46 const url = assertSafeZoomInfoUrl(buildApiUrl(req), 'apiUrl').toString()
47 const hasBody = req.body !== undefined && req.body !== null
48 const headers: Record<string, string> = {
49 Authorization: `Bearer ${accessToken}`,
50 Accept: 'application/json',
51 }
52 if (hasBody) headers['Content-Type'] = 'application/json'
53
54 const response = await secureFetchWithValidation(
55 url,
56 {
57 method: req.method,
58 headers,
59 body: hasBody
60 ? typeof req.body === 'string'
61 ? req.body
62 : JSON.stringify(req.body)
63 : undefined,
64 timeout: ZOOMINFO_OUTBOUND_FETCH_TIMEOUT_MS,
65 },
66 'apiUrl'
67 )
68
69 const raw = await response.text()
70 let parsed: unknown = null
71 if (raw.length > 0) {
72 try {
73 parsed = JSON.parse(raw)
74 } catch {
75 parsed = raw
76 }
77 }
78 return { status: response.status, body: parsed }
79}
80
81export const POST = withRouteHandler(async (request: NextRequest) => {
82 const requestId = generateRequestId()

Callers 1

route.tsFile · 0.85

Calls 6

assertSafeZoomInfoUrlFunction · 0.90
textMethod · 0.80
parseMethod · 0.80
buildApiUrlFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected