-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
# .github/workflows/publish-jsr.yml | ||
|
||
name: Publish to JSR | ||
|
||
# .github/workflows/publish.yml | ||
name: Publish to jsr.io | ||
on: | ||
create: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
release: | ||
types: [released] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: npx jsr publish --config jsr.json | ||
id-token: write | ||
uses: cross-org/workflows/.github/workflows/jsr-publish.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,47 +2,31 @@ | |
|
||
Library to interact with v2 of the [Oura API](https://cloud.ouraring.com/v2/docs). | ||
|
||
Available for **Deno** and **Bun** through [JSR Package](https://jsr.io/@pinta365/oura-api) and for Node.js via a [NPM package](https://www.npmjs.com/package/oura_api). | ||
Deno users can also use the [deno.land/x package](https://deno.land/x/oura_api). | ||
Available as ESM module for **Deno**, **Bun** and **Node.js** through [JSR Package](https://jsr.io/@pinta365/oura-api) | ||
and as CommonJS module for Node.js via a [NPM package](https://www.npmjs.com/package/oura_api). Deno users can also use | ||
the [deno.land/x package](https://deno.land/x/oura_api). | ||
|
||
--- | ||
|
||
## Example usage | ||
## Example usage ESM | ||
|
||
### Deno and Bun | ||
### Installation | ||
|
||
**Deno install notes** | ||
|
||
Through JSR and imports map | ||
``` | ||
```bash | ||
# For Deno | ||
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** | ||
``` | ||
# For Bun | ||
bunx jsr add @pinta365/oura-api | ||
|
||
import { Oura } from "@pinta365/oura-api"; | ||
# For Node.js | ||
npx jsr add @pinta365/oura-api | ||
``` | ||
|
||
```javascript | ||
//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"; | ||
### Usage | ||
|
||
```javascript | ||
import { Oura, DateFormat } from "@pinta365/oura-api"; | ||
|
||
// Replace 'YOUR_ACCESS_TOKEN' with your actual access token | ||
const accessToken = "YOUR_ACCESS_TOKEN"; | ||
|
@@ -60,69 +44,70 @@ try { | |
} | ||
``` | ||
|
||
## Example usage for CommonJS | ||
|
||
### Node.js | ||
|
||
Install package. | ||
|
||
``` | ||
npm install oura_api --save | ||
const Api = require('oura_api'); | ||
``` | ||
|
||
Code example. | ||
```javascript | ||
|
||
const Api = require('oura_api'); | ||
```javascript | ||
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) { | ||
} catch (error) { | ||
console.error(`Error fetching daily activity data: ${error}`); | ||
} | ||
}; | ||
example(); | ||
} | ||
}; | ||
|
||
example(); | ||
``` | ||
|
||
## Documentaion | ||
|
||
Library and method documentation can be found at the [Deno Land documentation](https://deno.land/x/oura_api?doc) page. | ||
Library documentation can be found at the [JSR documentation](https://jsr.io/@pinta365/oura-api/doc) page. | ||
|
||
### Included data scopes for v2 of the API. | ||
|
||
| Endpoint/Scope | Status | | ||
| :------------------------------------------------------------------------ | :---------- | | ||
| **[Oura Base](https://deno.land/x/oura_api/mod.ts?s=Oura)** | | | ||
| 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](https://deno.land/x/oura_api/mod.ts?s=Webhook)** | | | ||
| List subscription | Implemented | | ||
| Create subscription | Implemented | | ||
| Update subscription | Implemented | | ||
| Delete subscription | Implemented | | ||
| Renew subscription | Implemented | | ||
| Endpoint/Scope | Status | | ||
| :-------------------------------------------------------------------------- | :---------- | | ||
| **[Oura Base](https://jsr.io/@pinta365/oura-api/doc/~/Oura)** | | | ||
| 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](https://jsr.io/@pinta365/oura-api/doc/~/Webhook)** | | | ||
| List subscription | Implemented | | ||
| Create subscription | Implemented | | ||
| Update subscription | Implemented | | ||
| Delete subscription | Implemented | | ||
| Renew subscription | Implemented | | ||
|
||
### Additional info concerning the webhook API | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters