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];
};
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.