habitica-sync/view/habiticaAPI.ts
ransurf f77466b8a2 cleaned more date code, setup testing for stats, renamed plugin and info
cleaned more date code, setup testing for stats, renamed plugin and info
2021-10-12 19:48:33 -07:00

32 lines
No EOL
950 B
TypeScript

// import fetch from "node-fetch";
export async function getTasks(username: string, credentials: string){
const url = "https://habitica.com/api/v3/tasks/user?type=todos"
const response = fetch(url, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"x-client": username.concat("-testAPI"),
"x-api-user": username,
"x-api-key": credentials,
},
})
return (response)
}
export async function getStats(username: string, credentials: string){
const url = "https://habitica.com/export/userdata.json"
const response = fetch(url, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"x-client": username.concat("-testAPI"),
"x-api-user": username,
"x-api-key": credentials,
},
})
console.log(response)
console.log("stats above")
return (response)
}