MCPcopy Create free account
hub / github.com/simstudioai/sim / listWorkspaceProjects

Function listWorkspaceProjects

apps/sim/connectors/asana/asana.ts:111–131  ·  view source on GitHub ↗

* Fetches all project GIDs in a workspace, used when no specific project is configured.

(
  accessToken: string,
  workspaceGid: string
)

Source from the content-addressed store, hash-verified

109 * Fetches all project GIDs in a workspace, used when no specific project is configured.
110 */
111async function listWorkspaceProjects(
112 accessToken: string,
113 workspaceGid: string
114): Promise<AsanaProject[]> {
115 const projects: AsanaProject[] = []
116 let offset: string | undefined
117
118 // eslint-disable-next-line no-constant-condition
119 while (true) {
120 const offsetParam = offset ? `&offset=${offset}` : ''
121 const result = await asanaGet<{ data: AsanaProject[]; next_page: { offset: string } | null }>(
122 accessToken,
123 `/projects?workspace=${workspaceGid}&limit=100${offsetParam}`
124 )
125 projects.push(...result.data)
126 if (!result.next_page) break
127 offset = result.next_page.offset
128 }
129
130 return projects
131}
132
133export const asanaConnector: ConnectorConfig = {
134 ...asanaConnectorMeta,

Callers 1

asana.tsFile · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected