Giter VIP home page Giter VIP logo

oura_api's Introduction

OURA_API

Library to interact with v2 of the Oura API.

Available for Deno and Bun through JSR Package and for Node.js via a NPM package. Deno users can also use the deno.land/x package.


Example usage

Deno and Bun

Deno install notes

Through JSR and imports map

deno add @pinta365/oura-api

import { Oura } from "@pinta365/oura-api";

Or directly from deno.land/x

import { Oura } from "https://deno.land/x/oura_api/mod.ts";

Note

If you're importing the package from deno.land/x the example code will use the latest version but you should always change import URL to include a specific version number. Example: https://deno.land/x/[email protected]/mod.ts


Bun Install notes

bunx jsr add @pinta365/oura-api

import { Oura } from "@pinta365/oura-api";
//from deno.land/x (Deno)
import { Oura, DateFormat } from "https://deno.land/x/oura_api/mod.ts";
//or from JSR (Deno and Bun)
//import { Oura, DateFormat } from "@pinta365/oura-api";


// Replace 'YOUR_ACCESS_TOKEN' with your actual access token
const accessToken = "YOUR_ACCESS_TOKEN";
const ouraClient = new Oura(accessToken);

const startDate: DateFormat = "2023-01-01";
const endDate: DateFormat = "2023-01-10";

try {
  const dailyActivityData = await ouraClient.getDailyActivityDocuments(startDate, endDate);

  console.log(`Daily Activity Data: ${JSON.stringify(dailyActivityData, null, 4)}`);
} catch (error) {
  console.error(`Error fetching daily activity data: ${error}`);
}

Node.js

Install package.

npm install oura_api --save

const Api = require('oura_api');

Code example.

const Api = require('oura_api');
// Replace 'YOUR_ACCESS_TOKEN' with your actual access token
const accessToken = "YOUR_ACCESS_TOKEN";
const ouraClient = new Api.Oura(accessToken);

const startDate = "2023-01-01";
const endDate = "2023-01-10";


const example = async () => {
    try {
        const dailyActivityData = await ouraClient.getDailyActivityDocuments(startDate, endDate);
      
        console.log(`Daily Activity Data: ${JSON.stringify(dailyActivityData, null, 4)}`);
      } catch (error) {
        console.error(`Error fetching daily activity data: ${error}`);
      }
  };
  
  example();

Documentaion

Library and method documentation can be found at the Deno Land documentation page.

Included data scopes for v2 of the API.

Endpoint/Scope Status
Oura Base
Daily Activity Implemented
Daily Readiness Implemented
Daily Sleep Implemented
Daily Spo2 Implemented
Daily Stress Implemented
Enhanced Tag Implemented
Heart Rate Implemented
Personal Info Implemented
Rest Mode Period Implemented
Ring Configuration Implemented
Session Implemented
Sleep Implemented
Sleep Time Implemented
Tag DEPRICATED
Workout Implemented
Webhook Subscription
List subscription Implemented
Create subscription Implemented
Update subscription Implemented
Delete subscription Implemented
Renew subscription Implemented

Additional info concerning the webhook API

According to the API docs the webhooks enable you to receive near real-time Oura data updates and are the preferred way to receive the latest data from the Oura API.

I have not been able to fully verify this yet but the subscription workflow has been implemented.

Read the Webhook docs before atempting to use it.

Issues

Issues or questions concerning the library can be raised at the github repository page.

License

This project is licensed under the MIT License - see the LICENSE file for details.

oura_api's People

Contributors

pinta365 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.