0.5.7 • Published 25 days ago

oura_api v0.5.7

Weekly downloads
-
License
MIT
Repository
github
Last release
25 days ago

OURA_API

Library to interact with v2 of the Oura API.

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


Example usage ESM

Installation

# For Deno
deno add @pinta365/oura-api

# For Bun
bunx jsr add @pinta365/oura-api

# For Node.js
npx jsr add @pinta365/oura-api

Usage

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}`);
}

Example usage for CommonJS

Node.js

Install package.

npm install oura_api --save

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 documentation can be found at the JSR documentation page.

Included data scopes for v2 of the API.

Endpoint/ScopeStatus
Oura Base
Daily ActivityImplemented
Daily ReadinessImplemented
Daily SleepImplemented
Daily Spo2Implemented
Daily StressImplemented
Enhanced TagImplemented
Heart RateImplemented
Personal InfoImplemented
Rest Mode PeriodImplemented
Ring ConfigurationImplemented
SessionImplemented
SleepImplemented
Sleep TimeImplemented
TagDEPRICATED
WorkoutImplemented
Webhook Subscription
List subscriptionImplemented
Create subscriptionImplemented
Update subscriptionImplemented
Delete subscriptionImplemented
Renew subscriptionImplemented

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.

0.5.7

25 days ago

0.5.5

2 months ago

0.5.3

2 months ago

0.5.2

2 months ago

0.5.1

2 months ago

0.4.0

3 months ago

0.2.0

8 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago