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

Function fetchCollectionIds

apps/sim/connectors/webflow/webflow.ts:374–398  ·  view source on GitHub ↗

* Fetches collection IDs for a site. If a specific collectionId is provided, * returns only that ID. Otherwise fetches all collections from the site.

(
  accessToken: string,
  siteId: string,
  collectionIds: string[]
)

Source from the content-addressed store, hash-verified

372 * returns only that ID. Otherwise fetches all collections from the site.
373 */
374async function fetchCollectionIds(
375 accessToken: string,
376 siteId: string,
377 collectionIds: string[]
378): Promise<string[]> {
379 if (collectionIds.length > 0) {
380 return collectionIds
381 }
382
383 const url = `${WEBFLOW_API}/sites/${siteId}/collections`
384 const response = await fetchWithRetry(url, {
385 method: 'GET',
386 headers: {
387 Authorization: `Bearer ${accessToken}`,
388 'accept-version': '2.0.0',
389 },
390 })
391
392 if (!response.ok) {
393 throw new Error(`Failed to list Webflow collections: ${response.status}`)
394 }
395
396 const data = (await response.json()) as { collections: WebflowCollection[] }
397 return (data.collections || []).map((c) => c.id)
398}
399
400/**
401 * Fetches a collection's display name, caching in syncContext.

Callers 1

webflow.tsFile · 0.85

Calls 1

fetchWithRetryFunction · 0.90

Tested by

no test coverage detected