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

Function getAssetsWorkspaceId

apps/sim/tools/jsm/utils.ts:116–139  ·  view source on GitHub ↗
(cloudId: string, accessToken: string)

Source from the content-addressed store, hash-verified

114 * @throws If discovery fails or no workspace is provisioned
115 */
116export async function getAssetsWorkspaceId(cloudId: string, accessToken: string): Promise<string> {
117 const response = await fetch(
118 `https://api.atlassian.com/ex/jira/${cloudId}/rest/servicedeskapi/assets/workspace`,
119 { method: 'GET', headers: getJsmHeaders(accessToken) }
120 )
121
122 if (!response.ok) {
123 const errorText = await response.text()
124 throw new Error(
125 `Failed to resolve Assets workspace: ${response.status} - ${errorText || response.statusText}`
126 )
127 }
128
129 const data = await response.json()
130 const workspaceId: string | undefined = data?.values?.[0]?.workspaceId
131
132 if (!workspaceId) {
133 throw new Error(
134 'No Assets workspace found for this site. Assets (Insight) may not be enabled on the Jira instance.'
135 )
136 }
137
138 return workspaceId
139}

Callers 1

resolveAssetsContextFunction · 0.85

Calls 2

getJsmHeadersFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected