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

Function fetchUsers

apps/sim/tools/jira/search_users.ts:79–106  ·  view source on GitHub ↗
(cloudId: string)

Source from the content-addressed store, hash-verified

77
78 transformResponse: async (response: Response, params?: JiraSearchUsersParams) => {
79 const fetchUsers = async (cloudId: string) => {
80 const queryParams = new URLSearchParams()
81 queryParams.append('query', params!.query)
82 if (params!.maxResults !== undefined)
83 queryParams.append('maxResults', String(params!.maxResults))
84 if (params!.startAt !== undefined) queryParams.append('startAt', String(params!.startAt))
85
86 const usersUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/user/search?${queryParams.toString()}`
87
88 const usersResponse = await fetch(usersUrl, {
89 method: 'GET',
90 headers: {
91 Accept: 'application/json',
92 Authorization: `Bearer ${params!.accessToken}`,
93 },
94 })
95
96 if (!usersResponse.ok) {
97 let message = `Failed to search Jira users (${usersResponse.status})`
98 try {
99 const err = await usersResponse.json()
100 message = err?.errorMessages?.join(', ') || err?.message || message
101 } catch (_e) {}
102 throw new Error(message)
103 }
104
105 return usersResponse.json()
106 }
107
108 let data: any
109

Callers 1

search_users.tsFile · 0.70

Calls 2

joinMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected