MCPcopy
hub / github.com/simstudioai/sim / handleGetEnvelope

Function handleGetEnvelope

apps/sim/app/api/tools/docusign/route.ts:407–433  ·  view source on GitHub ↗
(
  apiBase: string,
  headers: Record<string, string>,
  params: Record<string, unknown>,
  signal?: AbortSignal
)

Source from the content-addressed store, hash-verified

405}
406
407async function handleGetEnvelope(
408 apiBase: string,
409 headers: Record<string, string>,
410 params: Record<string, unknown>,
411 signal?: AbortSignal
412) {
413 const { envelopeId } = params
414 if (!envelopeId) {
415 return NextResponse.json({ success: false, error: 'envelopeId is required' }, { status: 400 })
416 }
417
418 const response = await fetchDocusign(
419 `${apiBase}/envelopes/${(envelopeId as string).trim()}?include=recipients,documents`,
420 { headers },
421 signal
422 )
423 const data = await readDocusignJson(response, 'DocuSign envelope response')
424
425 if (!response.ok) {
426 return NextResponse.json(
427 { success: false, error: docusignError(data, 'Failed to get envelope') },
428 { status: response.status }
429 )
430 }
431
432 return NextResponse.json(data)
433}
434
435async function handleListEnvelopes(
436 apiBase: string,

Callers 1

route.tsFile · 0.85

Calls 3

fetchDocusignFunction · 0.85
readDocusignJsonFunction · 0.85
docusignErrorFunction · 0.85

Tested by

no test coverage detected