1
2
3
4
5
6
7
8
9
import { Oura } from "https://deno.land/x/oura_api@0.3.1/mod.ts";
export const getReadinessScore = async (ouraToken) => {
const oura = new Oura(ouraToken);
const yesterday = (d => (d.setDate(d.getDate() - 1), d))(new Date()).toISOString().split("T")[0];
const today = new Date().toISOString().split("T")[0];
const docs = await oura.getDailyReadinessDocuments(today, today);
return docs.data.reverse()[0];
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v16
November 22, 2023