(cloudId: string)
| 134 | } |
| 135 | |
| 136 | const makeRequest = async (cloudId: string) => { |
| 137 | const worklogUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${params!.issueKey?.trim() ?? ''}/worklog` |
| 138 | const worklogResponse = await fetch(worklogUrl, { |
| 139 | method: 'POST', |
| 140 | headers: { |
| 141 | Accept: 'application/json', |
| 142 | 'Content-Type': 'application/json', |
| 143 | Authorization: `Bearer ${params!.accessToken}`, |
| 144 | }, |
| 145 | body: JSON.stringify(buildWorklogBody(params!)), |
| 146 | }) |
| 147 | |
| 148 | if (!worklogResponse.ok) { |
| 149 | let message = `Failed to add worklog to Jira issue (${worklogResponse.status})` |
| 150 | try { |
| 151 | const err = await worklogResponse.json() |
| 152 | message = err?.errorMessages?.join(', ') || err?.message || message |
| 153 | } catch (_e) {} |
| 154 | throw new Error(message) |
| 155 | } |
| 156 | |
| 157 | return worklogResponse.json() |
| 158 | } |
| 159 | |
| 160 | let data: any |
| 161 |
no test coverage detected