MCPcopy Index your code
hub / github.com/massCodeIO/massCode / postCapture

Function postCapture

integrations/clipper/src/api.ts:103–124  ·  view source on GitHub ↗
(
  settings: ExtensionSettings,
  request: CaptureRequest,
)

Source from the content-addressed store, hash-verified

101}
102
103export async function postCapture(
104 settings: ExtensionSettings,
105 request: CaptureRequest,
106): Promise<CaptureResponse> {
107 const response = await fetch(
108 `http://localhost:${settings.apiPort}/captures/`,
109 {
110 body: JSON.stringify(request),
111 headers: {
112 'Authorization': `Bearer ${settings.apiToken}`,
113 'Content-Type': 'application/json',
114 },
115 method: 'POST',
116 },
117 )
118
119 if (!response.ok) {
120 throw new Error(await getErrorMessage(response))
121 }
122
123 return (await response.json()) as CaptureResponse
124}
125
126export function isCaptureTarget(value: unknown): value is CaptureTarget {
127 return value === 'code' || value === 'notes' || value === 'http'

Callers 2

captureFromTabFunction · 0.90
captureCurrentPayloadFunction · 0.90

Calls 1

getErrorMessageFunction · 0.70

Tested by

no test coverage detected