auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, auths) => {
}
import fetch from 'node-fetch';
const blogList = 'AQMkADAwATMzAGZmAS04MDU4LWQ4ZjctMDACLTAwCgAuAAAD2b-xt4VpMU28CRdh70oBigEAzwpFFkTJnUqSIr7l4olnFgACofznJAAAAA==';
const rootUrl = `https://graph.microsoft.com/v1.0/me/todo/lists/${blogList}/tasks?$filter=status ne 'completed'`;
async function getCompletedToDos(todos = [], url = rootUrl) {
let result = await fetch(url, {
headers: {
'Authorization':`Bearer ${auths.microsoft_graph_api.oauth_access_token}`
}
});
let data = await result.json();
data.value.forEach(d => {
todos.push({
title:d.title,
created:d.createdDateTime,
lastModified:d.lastModifiedDateTime,
id:d.id,
content:d.body.content
})
});
if(data['@odata.nextLink']) {
return await getCompletedToDos(todos, data['@odata.nextLink']);
} else return todos;
}
return await getCompletedToDos();
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
$respond({
status:200,
headers: {
'Content-Type':'application/json'
},
body:steps.getToDos.$return_value
})