// Copyright 2020 Ben Hills and the project contributors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:pinepods_mobile/entities/episode.dart'; import 'package:pinepods_mobile/entities/podcast.dart'; import 'package:pinepods_mobile/entities/transcript.dart'; import 'package:pinepods_mobile/state/episode_state.dart'; /// An abstract class that represent the actions supported by the chosen /// database or storage implementation. abstract class Repository { /// General Future close(); /// Podcasts Future findPodcastById(num id); Future findPodcastByGuid(String guid); Future savePodcast(Podcast podcast, {bool withEpisodes = true}); Future deletePodcast(Podcast podcast); Future> subscriptions(); /// Episodes Future> findAllEpisodes(); Future findEpisodeById(int id); Future findEpisodeByGuid(String guid); Future> findEpisodesByPodcastGuid( String pguid, { PodcastEpisodeFilter filter = PodcastEpisodeFilter.none, PodcastEpisodeSort sort = PodcastEpisodeSort.none, }); Future findEpisodeByTaskId(String taskId); Future saveEpisode(Episode episode, [bool updateIfSame = false]); Future> saveEpisodes(List episodes, [bool updateIfSame = false]); Future deleteEpisode(Episode episode); Future deleteEpisodes(List episodes); Future> findDownloadsByPodcastGuid(String pguid); Future> findDownloads(); Future findTranscriptById(int id); Future saveTranscript(Transcript transcript); Future deleteTranscriptById(int id); Future deleteTranscriptsById(List id); /// Queue Future saveQueue(List episodes); Future> loadQueue(); /// Event listeners Stream? podcastListener; Stream? episodeListener; }