(accessToken: string, messageId: string, logger: Logger)
| 544 | } |
| 545 | |
| 546 | async function markOutlookEmailAsRead(accessToken: string, messageId: string, logger: Logger) { |
| 547 | try { |
| 548 | const response = await fetchWithRetry( |
| 549 | `https://graph.microsoft.com/v1.0/me/messages/${messageId}`, |
| 550 | { |
| 551 | method: 'PATCH', |
| 552 | headers: { |
| 553 | Authorization: `Bearer ${accessToken}`, |
| 554 | 'Content-Type': 'application/json', |
| 555 | }, |
| 556 | body: JSON.stringify({ isRead: true }), |
| 557 | } |
| 558 | ) |
| 559 | |
| 560 | if (!response.ok) { |
| 561 | logger.error( |
| 562 | `Failed to mark email ${messageId} as read:`, |
| 563 | response.status, |
| 564 | await response.text() |
| 565 | ) |
| 566 | } |
| 567 | } catch (error) { |
| 568 | logger.error(`Error marking email ${messageId} as read:`, error) |
| 569 | } |
| 570 | } |
no test coverage detected