Avatar

@just_be

3 public vals
Joined February 5, 2023
Hiya! I'm Justin, an engineer at oxide.computer currently living in Brooklyn, NY. I co-host devtools.fm and am interested in the future of personal computing, malleable software, and anything we can build to make folks' lives easier.
1
2
3
4
5
6
7
8
9
10
11
import { Oura } from "https://deno.land/x/oura_api@0.3.1/mod.ts";
export const getSleepScore = async (ouraToken) => {
const oura = new Oura(ouraToken);
const today = new Date().toISOString().split("T")[0];
const yesterday = (d => (d.setDate(d.getDate() - 1), d))(new Date()).toISOString().split("T")[0];
console.log(yesterday);
const docs = await oura.getSleepDocuments(yesterday, today);
console.log(docs);
return docs.data.reverse()[0];
};
1
2
import { Oura } from "https://deno.land/x/oura_api@0.3.1/mod.ts";
export const oura = (ouraPersonalAccessToken) => new Oura(ouraPersonalAccessToken);
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];
};
Next