jimce-deezer-api-ts
v0.0.2
Published
A TypeScript Deezer API client for Node.js
Maintainers
Readme
Jimce Deezer API Client
A TypeScript-based Deezer API Client for Node.js.
Installation
npm install jimce-deezer-api-tsUsage
Basic Usage
import { JimceDeezerAPI } from 'jimce-deezer-api-ts';
const client = new JimceDeezerAPI();
// Search for a track
const results = await client.search('YOUR SEARCH');
const data = JSON.stringify(results, null, 2)
console.log(data);API Methods
Search
const results = await client.search('YOUR SEARCH');Tracks
const track = await client.getTrack(<TRACK_ID>);Albums
const album = await client.getAlbum(<ALBUM_ID>);Artists
const artist = await client.getArtist(<ARTIST_ID>);Playlists
const playlist = await client.getPlaylist(<PLAYLIST_ID>);Podcasts
const podcast = await client.getPodcast(<PODCAST_ID>);Episodes
const episode = await client.getEpisode(<EPISODE_ID>);Radio
const radio = await client.getRadio(<RADIO_ID>);Charts (Top Charts)
const chart = await client.getChart();Genres
const genres = await client.getGenres();Editorial
const editorial = await client.getEditorial();API Information
const infos = await client.getInfos();
const options = await client.getOptions();Types
The package comes with full TypeScript support:
import { Track, Album, Artist, SearchResult } from 'jimce-deezer-api-ts';
const results: SearchResult = await client.search('Query');
const track: Track = results.data[0];Development
Build
npm run buildDevelopment Watch Mode
npm run devTesting
The package includes two different test suites:
1. Integration Tests (Mocked)
Standard unit tests with mocked API responses:
npm testThese tests:
- ✅ Mock the fetch requests
- ✅ Test parameter encoding
- ✅ Test error handling
- ✅ Completely isolated from the real API
2. Functional Tests (Real API)
End-to-end tests against the real Deezer API:
npm run test:functionalThese tests validate:
- ✅ All 13 API endpoints work
- ✅ Response structures are correct
- ✅ Data types are correct
- ✅ Concurrent requests work
All Tests
npm run test:allTest Watch Mode
npm run test:watchGitHub Actions (Automated Tests)
The CI pipeline is defined in .github/workflows/tests.yml.
- Integration Tests (mocked) run automatically on:
- Pull requests
- Push to
mainandmaster
- Functional Tests (real Deezer API, not mocked) run automatically on:
- Push to
mainandmaster - Schedule (Monday and Thursday at 02:00 UTC)
- Manual trigger via
workflow_dispatch
- Push to
This keeps PR feedback fast while real API tests run automatically on a regular schedule.
Test Structure
tests/
├── integration/
│ └── deezer-client.integration.test.ts (Mocked Tests)
├── functional/
│ └── deezer-api.functional.test.ts (Real API Tests)
└── setup.ts