From 5582ebd43791c41e443c53c72db9e67cdb527d22 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 21 May 2026 17:47:08 +0300 Subject: Implement PodcastListScreen and SubscribeDialog with podcast feed management (ab) Co-Authored-By: Claude Sonnet 4.6 --- player-android/lib/api/dio_player_api_client.dart | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'player-android/lib/api/dio_player_api_client.dart') 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 @@ -365,6 +365,37 @@ class DioPlayerApiClient extends PlayerApiClient { return Share.fromJson(response.data!); } + // --------------------------------------------------------------------------- + // 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 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 = { + 'feed_url': feedUrl, + if (setName != null && setName.isNotEmpty) 'set_name': setName, + }; + + final response = await rawDio.post>( + '$_kApiV1/podcasts', + data: body, + ); + return PodcastFeed.fromJson(response.data!); + } + // --------------------------------------------------------------------------- // Private helpers // --------------------------------------------------------------------------- -- cgit v1.2.3