summaryrefslogtreecommitdiff
path: root/player-android/lib/api
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-21 17:47:08 +0300
committerPaul Buetow <paul@buetow.org>2026-05-21 17:47:08 +0300
commit5582ebd43791c41e443c53c72db9e67cdb527d22 (patch)
tree832ac98c0fd89cc26b0f3be5b724485d884533de /player-android/lib/api
parent12c967f39c35c5ffaf5714e77aae1e9b0c018733 (diff)
Implement PodcastListScreen and SubscribeDialog with podcast feed management (ab)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'player-android/lib/api')
-rw-r--r--player-android/lib/api/dio_player_api_client.dart31
1 files changed, 31 insertions, 0 deletions
diff --git a/player-android/lib/api/dio_player_api_client.dart b/player-android/lib/api/dio_player_api_client.dart
index aee73f8..4443ba3 100644
--- a/player-android/lib/api/dio_player_api_client.dart
+++ b/player-android/lib/api/dio_player_api_client.dart
@@ -366,6 +366,37 @@ class DioPlayerApiClient extends PlayerApiClient {
}
// ---------------------------------------------------------------------------
+ // Podcasts
+ // ---------------------------------------------------------------------------
+
+ /// Subscribes to a new podcast feed and returns the created [PodcastFeed].
+ ///
+ /// POST /api/v1/podcasts
+ /// Requires admin privileges (the server returns 403 for non-admin users).
+ ///
+ /// [feedUrl] is the URL of the RSS/Atom feed to subscribe to.
+ /// [setName] is an optional human-readable name for the podcast set;
+ /// when omitted the server derives it from the feed's own title element.
+ @override
+ Future<PodcastFeed> subscribePodcast({
+ required String feedUrl,
+ String? setName,
+ }) async {
+ // Omit set_name from the request body when not provided so the server falls
+ // back to the feed's title rather than receiving an explicit null.
+ final body = <String, dynamic>{
+ 'feed_url': feedUrl,
+ if (setName != null && setName.isNotEmpty) 'set_name': setName,
+ };
+
+ final response = await rawDio.post<Map<String, dynamic>>(
+ '$_kApiV1/podcasts',
+ data: body,
+ );
+ return PodcastFeed.fromJson(response.data!);
+ }
+
+ // ---------------------------------------------------------------------------
// Private helpers
// ---------------------------------------------------------------------------