({email, message, threadId, accessToken})
| 93 | } |
| 94 | |
| 95 | export async function sendMessageMeta({email, message, threadId, accessToken}) { |
| 96 | const data = { |
| 97 | raw: base64EncodeUrl(btoa(message)) |
| 98 | }; |
| 99 | if (threadId) { |
| 100 | data.threadId = threadId; |
| 101 | } |
| 102 | const options = { |
| 103 | method: 'POST', |
| 104 | body: JSON.stringify(data), |
| 105 | mode: 'cors', |
| 106 | headers: { |
| 107 | 'Content-Type': 'application/json; charset=UTF-8', |
| 108 | Authorization: `Bearer ${accessToken}`, |
| 109 | } |
| 110 | }; |
| 111 | return fetchJSON( |
| 112 | ` https://www.googleapis.com/gmail/v1/users/${email}/messages/send`, |
| 113 | options |
| 114 | ); |
| 115 | } |
| 116 | |
| 117 | export async function getAccessToken({email, scopes = []}) { |
| 118 | scopes = deDup([...GMAIL_SCOPES_DEFAULT, ...scopes]); |
nothing calls this directly
no test coverage detected