Skip to content

Commit

Permalink
Merge pull request #80 from rinukkusu/release/0.4.0
Browse files Browse the repository at this point in the history
Release/0.4.0
  • Loading branch information
rinukkusu authored Oct 27, 2020
2 parents 0cdbcc3 + 1b2e7a5 commit 7290739
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 49 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.4.0

- implement podcast endpoints

## 0.3.7+1

- fix recentlyPlayed endpoint and add unit tests
Expand Down
2 changes: 1 addition & 1 deletion example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() async {
print(podcast.name);

print('\nPodcast episode:');
var episodes = await spotify.showEpisodes.list('4AlxqGkkrqe0mfIx3Mi7Xt');
var episodes = await spotify.shows.episodes('4AlxqGkkrqe0mfIx3Mi7Xt');
var firstEpisode = (await episodes.first()).items.first;
print(firstEpisode.name);

Expand Down
1 change: 0 additions & 1 deletion lib/spotify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ part 'src/endpoints/search.dart';
part 'src/endpoints/audio_features.dart';
part 'src/endpoints/categories.dart';
part 'src/endpoints/shows.dart';
part 'src/endpoints/show_episodes.dart';
part 'src/endpoints/me.dart';

part 'src/spotify_credentials.dart';
Expand Down
40 changes: 0 additions & 40 deletions lib/src/endpoints/show_episodes.dart

This file was deleted.

17 changes: 15 additions & 2 deletions lib/src/endpoints/shows.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017, chances. All rights reserved. Use of this source code
// Copyright (c) 2020, deandreamatias, rinukkusu. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

part of spotify;
Expand Down Expand Up @@ -29,12 +29,25 @@ class Shows extends EndpointPaging {
return Show.fromJson(map);
}

/// Get a several shows. Can get only one too
/// Get one or several shows
Future<Iterable<Show>> list(List<String> showsId) async {
final jsonString = await _get('$_path?ids=${showsId.join(',')}');
final map = json.decode(jsonString);

final showsMap = map['shows'] as Iterable<dynamic>;
return showsMap.map((m) => Show.fromJson(m));
}

/// Get a Show's Episodes
///
/// [market]: An ISO 3166-1 alpha-2 country code or the string 'from_token'.
/// If a country code is specified, only artists, albums, and tracks with
/// content that is playable in that market is returned.
Pages<Episode> episodes(String showId, {String market = ''}) {
var query = _buildQuery({'market': market});
var queryString = query.isNotEmpty ? '?$query' : '';

return _getPages('$_path/$showId/episodes$queryString',
(json) => Episode.fromJson(json));
}
}
3 changes: 0 additions & 3 deletions lib/src/spotify_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ abstract class SpotifyApiBase {
Categories get categories => _categories;
Me _me;
Me get me => _me;
ShowEpisodes _showEpisodes;
ShowEpisodes get showEpisodes => _showEpisodes;
Shows _shows;
Shows get shows => _shows;
oauth2.Client get client => _client;
Expand All @@ -50,7 +48,6 @@ abstract class SpotifyApiBase {
_search = Search(this);
_audioFeatures = AudioFeatures(this);
_categories = Categories(this);
_showEpisodes = ShowEpisodes(this);
_shows = Shows(this);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: spotify
description: An incomplete dart library for interfacing with the Spotify Web API.
version: 0.3.7+1
version: 0.4.0
homepage: https://github.com/rinukkusu/spotify-dart

environment:
Expand Down
2 changes: 1 addition & 1 deletion test/spotify_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Future main() async {

group('Show episodes', () {
test('list', () async {
var episodes = await spotify.showEpisodes.list('4AlxqGkkrqe0mfIx3Mi7Xt');
var episodes = await spotify.shows.episodes('4AlxqGkkrqe0mfIx3Mi7Xt');
var firstEpisode = (await episodes.first()).items.first;

expect(firstEpisode.type, 'episode');
Expand Down

0 comments on commit 7290739

Please sign in to comment.