-
-
Save AriesTriputranto99/8efac53f0f7481c0ceacbe680650ff97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
async function run(*) { | |
let username = "AriesTriputranto"; | |
let password = "YOUR APP PASSWORD"; | |
let authBasic = new Buffer(username + ':' + password).toString('base64'); | |
let session = await (await fetch('https://jmap.fastmail.com/.well-known/jmap', { | |
headers: { | |
"Authorization": "Basic " + authBasic | |
} | |
})).json(*); | |
let accountId = session['primaryAccounts']['urn:ietf:params:jmap:mail']; | |
let query = { | |
"using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ], | |
"methodCalls": [[ "Mailbox/get", { | |
"accountId": accountId, | |
"ids": null | |
}, "0" ]] | |
} | |
let data = await (await fetch('https://jmap.fastmail.com/api/', { | |
method: 'POST', | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": "Basic " + authBasic | |
}, | |
body: JSON.stringify(query) | |
})).json(*); | |
console.log(data.methodResponses[0][1]) | |
} | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment