({msgId, email, accessToken, format = 'full', metaHeaders = []})
| 22 | export const MAIL_QUOTA = 25 * 1024 * 1024; |
| 23 | |
| 24 | export async function getMessage({msgId, email, accessToken, format = 'full', metaHeaders = []}) { |
| 25 | const options = { |
| 26 | method: 'GET', |
| 27 | headers: { |
| 28 | Authorization: `Bearer ${accessToken}`, |
| 29 | Accept: 'application/json' |
| 30 | }, |
| 31 | contentType: 'json' |
| 32 | }; |
| 33 | return fetchJSON( |
| 34 | `https://www.googleapis.com/gmail/v1/users/${email}/messages/${msgId}?format=${format}${metaHeaders.map(header => `&metadataHeaders=${header}`).join('')}`, |
| 35 | options |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | export async function getMessageMimeType({msgId, email, accessToken}) { |
| 40 | const {payload} = await getMessage({msgId, email, accessToken, format: 'metadata', metaHeaders: ['content-type']}); |
no test coverage detected