-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from hayribakici/episodes
Adds episode API
- Loading branch information
Showing
10 changed files
with
281 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2023, hayribakici. 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; | ||
|
||
class Episodes extends EndpointBase { | ||
@override | ||
String get _path => 'v1/episodes'; | ||
|
||
Episodes(SpotifyApiBase api) : super(api); | ||
|
||
Future<EpisodeFull> get(String id, [String? market]) async { | ||
assert(id.isNotEmpty, 'No episode id was provided'); | ||
var jsonString = | ||
await _api._get('$_path/$id?' + _buildQuery({'market': market})); | ||
return EpisodeFull.fromJson(jsonDecode(jsonString)); | ||
} | ||
|
||
Future<Iterable<EpisodeFull>> list(List<String> ids, | ||
[String? market]) async { | ||
assert(ids.isNotEmpty, 'No episode id\'s were provided'); | ||
var jsonString = await _api._get( | ||
'$_path?' + _buildQuery({'ids': ids.join(','), 'market': market})); | ||
var episodesJson = jsonDecode(jsonString)['episodes'] as Iterable<dynamic>; | ||
return episodesJson.map((json) => EpisodeFull.fromJson(json)); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"audio_preview_url": "https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17", | ||
"description": "A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.", | ||
"html_description": "<p>A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.</p>\n", | ||
"duration_ms": 1686230, | ||
"explicit": true, | ||
"external_urls": { | ||
"spotify": "string" | ||
}, | ||
"href": "https://api.spotify.com/v1/episodes/5Xt5DXGzch68nYYamXrNxZ", | ||
"id": "5Xt5DXGzch68nYYamXrNxZ", | ||
"images": [ | ||
{ | ||
"url": "https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228\n", | ||
"height": 300, | ||
"width": 300 | ||
} | ||
], | ||
"is_externally_hosted": true, | ||
"is_playable": true, | ||
"language": "en", | ||
"languages": [ | ||
"fr", | ||
"en" | ||
], | ||
"name": "Starting Your Own Podcast: Tips, Tricks, and Advice From Anchor Creators", | ||
"release_date": "1981-12-15", | ||
"release_date_precision": "day", | ||
"resume_point": { | ||
"fully_played": true, | ||
"resume_position_ms": 0 | ||
}, | ||
"type": "episode", | ||
"uri": "spotify:episode:0zLhl3WsOCQHbe1BPTiHgr", | ||
"restrictions": { | ||
"reason": "string" | ||
}, | ||
"show": { | ||
"available_markets": [ | ||
"string" | ||
], | ||
"copyrights": [ | ||
{ | ||
"text": "No rights", | ||
"type": "C" | ||
} | ||
], | ||
"description": "hi", | ||
"html_description": "string", | ||
"explicit": true, | ||
"external_urls": { | ||
"spotify": "string" | ||
}, | ||
"href": "string", | ||
"id": "string", | ||
"images": [ | ||
{ | ||
"url": "https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228\n", | ||
"height": 300, | ||
"width": 300 | ||
} | ||
], | ||
"is_externally_hosted": true, | ||
"languages": [ | ||
"string" | ||
], | ||
"media_type": "string", | ||
"name": "The No-Show", | ||
"publisher": "string", | ||
"type": "show", | ||
"uri": "string", | ||
"total_episodes": 1 | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"href": "https://api.spotify.com/v1/me/shows?offset=0&limit=20\n", | ||
"limit": 20, | ||
"next": "https://api.spotify.com/v1/me/shows?offset=1&limit=1", | ||
"offset": 0, | ||
"previous": "https://api.spotify.com/v1/me/shows?offset=1&limit=1", | ||
"total": 4, | ||
"items": [ | ||
{ | ||
"added_at": "2019-08-24T14:15:22Z", | ||
"episode": { | ||
"audio_preview_url": "https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17", | ||
"description": "A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.\n", | ||
"html_description": "<p>A Spotify podcast sharing fresh insights on important topics of the moment—in a way only Spotify can. You’ll hear from experts in the music, podcast and tech industries as we discover and uncover stories about our work and the world around us.</p>\n", | ||
"duration_ms": 1686230, | ||
"explicit": true, | ||
"external_urls": { | ||
"spotify": "string" | ||
}, | ||
"href": "https://api.spotify.com/v1/episodes/5Xt5DXGzch68nYYamXrNxZ", | ||
"id": "5Xt5DXGzch68nYYamXrNxZ", | ||
"images": [ | ||
{ | ||
"url": "https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228\n", | ||
"height": 300, | ||
"width": 300 | ||
} | ||
], | ||
"is_externally_hosted": true, | ||
"is_playable": true, | ||
"language": "en", | ||
"languages": [ | ||
"fr", | ||
"en" | ||
], | ||
"name": "Starting Your Own Podcast: Tips, Tricks, and Advice From Anchor Creators", | ||
"release_date": "1981-12-15", | ||
"release_date_precision": "day", | ||
"resume_point": { | ||
"fully_played": true, | ||
"resume_position_ms": 0 | ||
}, | ||
"type": "episode", | ||
"uri": "spotify:episode:0zLhl3WsOCQHbe1BPTiHgr", | ||
"restrictions": { | ||
"reason": "string" | ||
}, | ||
"show": { | ||
"available_markets": [ | ||
"string" | ||
], | ||
"copyrights": [ | ||
{ | ||
"text": "string", | ||
"type": "string" | ||
} | ||
], | ||
"description": "string", | ||
"html_description": "string", | ||
"explicit": true, | ||
"external_urls": { | ||
"spotify": "string" | ||
}, | ||
"href": "string", | ||
"id": "string", | ||
"images": [ | ||
{ | ||
"url": "https://i.scdn.co/image/ab67616d00001e02ff9ca10b55ce82ae553c8228\n", | ||
"height": 300, | ||
"width": 300 | ||
} | ||
], | ||
"is_externally_hosted": true, | ||
"languages": [ | ||
"string" | ||
], | ||
"media_type": "string", | ||
"name": "string", | ||
"publisher": "string", | ||
"type": "show", | ||
"uri": "string", | ||
"total_episodes": 0 | ||
} | ||
} | ||
} | ||
] | ||
} |
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