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

Function fetchFormStructure

apps/sim/connectors/google-forms/google-forms.ts:196–215  ·  view source on GitHub ↗

* Fetches the form structure via the Forms API. Returns null on 404 (form * deleted or inaccessible).

(
  accessToken: string,
  formId: string
)

Source from the content-addressed store, hash-verified

194 * deleted or inaccessible).
195 */
196async function fetchFormStructure(
197 accessToken: string,
198 formId: string
199): Promise<FormStructure | null> {
200 const url = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}`
201 const response = await fetchWithRetry(url, {
202 method: 'GET',
203 headers: {
204 Authorization: `Bearer ${accessToken}`,
205 Accept: 'application/json',
206 },
207 })
208
209 if (!response.ok) {
210 if (response.status === 404) return null
211 throw new Error(`Failed to fetch form structure ${formId}: ${response.status}`)
212 }
213
214 return (await response.json()) as FormStructure
215}
216
217/**
218 * Result of fetching a form's responses: the collected responses (capped at

Callers 1

google-forms.tsFile · 0.85

Calls 1

fetchWithRetryFunction · 0.90

Tested by

no test coverage detected