# opentidal

> A thin TIDAL API wrapper written in TypeScript.

Latest version **0.0.5** (published 2021-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install opentidal
pnpm add opentidal
yarn add opentidal
bun add opentidal
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-01-18 |
| First published | 2021-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 38.3 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | vaaski |
| Maintainers | vaaski |
| Keywords | openTIDAL, TIDAL, API |

## Links

- npm: https://www.npmjs.com/package/opentidal
- Repository: https://github.com/openTIDAL/openTIDAL.js
- Homepage: https://github.com/openTIDAL/openTIDAL.js#readme
- Issues: https://github.com/openTIDAL/openTIDAL.js/issues
- npm.io page: https://npm.io/package/opentidal

## Dependencies (2)

- [qs](https://npm.io/package/qs.md) ^6.9.6
- [axios](https://npm.io/package/axios.md) ^0.21.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2021-01-18
- 0.0.4 — 2021-01-17
- 0.0.3 — 2021-01-17
- 0.0.2 — 2021-01-17
- 0.0.1 — 2021-01-17

## README

<p align="center">
  <a href="https://github.com/openTIDAL/openTIDAL.js" target="_blank">
    <img src="https://colo.vaaski.com/static/openTIDAL-banner.svg">
  </a>
</p>
<hr>

<p align="center">
  A thin TIDAL API wrapper written in TypeScript with 100% test coverage.
</p>

<p align="center">
  <a href="https://npmjs.org/package/opentidal" alt="version">
    <img src="https://img.shields.io/npm/v/opentidal.svg?style=for-the-badge">
  </a>
  <a href="https://codecov.io/gh/openTIDAL/openTIDAL.js" alt="downloads">
    <img alt="Codecov" src="https://img.shields.io/codecov/c/gh/openTIDAL/openTIDAL.js?style=for-the-badge">
  </a>
  <a href="https://npmjs.org/package/opentidal" alt="downloads">
    <img src="https://img.shields.io/npm/dw/opentidal.svg?style=for-the-badge">
  </a>
</p>

# Example usage

```ts
import { auth } from "openTIDAL"

const client_id = "client_id"
const client_secret = "client_secret"

;(async () => {
  // get a device token to start the auth process
  const deviceToken = await auth.getDeviceToken({ client_id })

  // prints something like https://link.tidal.com/ABCDE
  // go to the provided URI and authorize the device
  console.log(`authorize via https://${deviceToken.verificationUriComplete}`)

  let accessToken

  // poll this endpoint until authorization is complete
  const interval = setInterval(async () => {
    console.log("checking if authorized")
    accessToken = await auth.getAccessToken({
      client_id,
      client_secret,
      device_code: deviceToken.deviceCode,
    })

    // if the response contains an access_token, you're authenticated!
    if ("access_token" in accessToken) {
      clearInterval(interval)
      console.log("access_token:", accessToken.access_token)
    }
  }, deviceToken.interval * 1000)
})()
```

---
_Source: https://npm.io/package/opentidal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
