(cloudId: string)
| 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 |
no test coverage detected