A Dart Library for interacting with The Tidal Developer Portal APIs

idal Developer Portal API Library

A Dart library for connecting to and interacting with the Tidal Developer Portal APIs.

Features

  • Provides easy access to Tidal's API described on the Tidal Developer Portal.
  • Well-documented and structured for developer convenience.

Implemented APIs

  • Authorization
  • Album API
  • Artist API
  • Track API
  • Video API
  • Search API

Getting Started

Installation

To use this library, add it to your pubspec.yaml:

dependencies:
  tidal: <latest-version>

Then run

dart pub get

Usage

You can start using the library by initializing a Tidal instance and making requests to Tidal's API. Here's a basic example:

import 'package:tidal/tidal.dart';

void main() async {
  final clientId = 'your_client_id';
  final clientSecret = 'your_client_secret';

  final tidal = await Tidal.initialize(clientId: clientId, clientSecret: clientSecret);

  // Use the Tidal instance to interact with the API.
}

Additional information

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add tidal

With Flutter:

 $ flutter pub add tidal

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  tidal: ^0.3.0

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:tidal/tidal.dart'; 

example/example.dart

import 'package:tidal/tidal.dart';

void main(List<String> args) async {
  // Declare your Tidal api credentials.
  // This is just an example, store your credentials safely.
  final tidalClientId = String.fromEnvironment('TIDAL_CLIENT_ID');
  final tidalClientSecret = String.fromEnvironment('TIDAL_CLIENT_SECRET');

  // Setup the tidal client.
  final tidal = await Tidal.initialize(
    clientId: tidalClientId,
    clientSecret: tidalClientSecret,
  );

  // Fetch a specific artist.
  final jayz = await tidal.artist.getSingleArtist(
    id: "7804",
    countryCode: "US",
  );

  print("$jayz\n");

  // Fetch multiple artists with their IDs.
  final multipleArtists = await tidal.artist.getMultipleArtists(
    ids: [
      "7804",
      "1566",
    ],
    countryCode: "US",
  );

  print("${multipleArtists.items}\n");

  // Fetch a song by its ID.
  final imThatGirl = await tidal.track.getSingleTrack(
    id: "251380837",
    countryCode: "US",
  );

  print("$imThatGirl\n");

  // Fetch an album.
  final renaissance = await tidal.album.getSingleAlbum(
    albumId: "251380836",
    countryCode: "US",
  );

  print("$renaissance\n");

  // Fetch a video.
  final killJayZVideo = await tidal.video.getSingleVideo(
    id: "75623239",
    countryCode: "US",
  );

  print("$killJayZVideo\n");

  // Search something.
  final searchResult = await tidal.search.searchForCatalogItems(
    query: "jay z",
    countryCode: "US",
  );

  print("${searchResult.artists.items}\n");
  print("${searchResult.albums.items}\n");
  print("${searchResult.tracks.items}\n");
  print("${searchResult.videos.items}\n");

  // You can also search in a specific catalog category.
  final searchedArtists = await tidal.artist.search(
    query: "lupe fiasco",
    countryCode: "US",
  );

  print("${searchedArtists.items}\n");

  // You can retrieve similar artists for a given artist.
  final similarAritsts = await tidal.artist.getSimilarArtistsForGivenArtist(
    id: jayz.id,
    countryCode: "US",
  );

  print("$similarAritsts\n");

  // Make sure to dispose the client when you're done.
  tidal.dispose();
} 

Download details:

Author: filippomenchini

Source: https://github.com/filippomenchini/tidal

#flutter #android #ios 

A Dart Library for interacting with The Tidal Developer Portal APIs
1.55 GEEK