(&self, command: MainCommand)
| 228 | |
| 229 | #[tracing::instrument(level = "debug", skip(self))] |
| 230 | pub async fn handle_request(&self, command: MainCommand) -> Result<MainCommandResponse> { |
| 231 | tracing::debug!("Got request from extension {:?}", command); |
| 232 | |
| 233 | Ok(match command { |
| 234 | MainCommand::GetSong(get_song_options) => self.get_songs(get_song_options)?, |
| 235 | MainCommand::GetEntity(get_entity_options) => self.get_entity(get_entity_options)?, |
| 236 | MainCommand::GetCurrentSong() |
| 237 | | MainCommand::GetPlayerState() |
| 238 | | MainCommand::GetVolume() |
| 239 | | MainCommand::GetTime() |
| 240 | | MainCommand::GetQueue() => self.send_ui_request(command).await?, |
| 241 | MainCommand::GetPreference(preference_data) => self.get_preferences(preference_data)?, |
| 242 | MainCommand::SetPreference(preference_data) => self.set_preferences(preference_data)?, |
| 243 | MainCommand::GetSecure(preference_data) => self.get_secure(preference_data)?, |
| 244 | MainCommand::SetSecure(preference_data) => self.set_secure(preference_data)?, |
| 245 | MainCommand::AddSongs(vec) => self.add_songs(vec)?, |
| 246 | MainCommand::RemoveSong(song) => self.remove_song(song)?, |
| 247 | MainCommand::UpdateSong(song) => self.update_song(song)?, |
| 248 | MainCommand::AddPlaylist(queryable_playlist) => { |
| 249 | self.add_playlist(queryable_playlist)? |
| 250 | } |
| 251 | MainCommand::AddToPlaylist(add_to_playlist_request) => self.add_to_playlist( |
| 252 | add_to_playlist_request.playlist_id, |
| 253 | add_to_playlist_request.songs, |
| 254 | )?, |
| 255 | MainCommand::RegisterOAuth(url) => self.register_oauth(url)?, |
| 256 | MainCommand::OpenExternalUrl(url) => self.open_external(url)?, |
| 257 | MainCommand::UpdateAccounts(key) => self.update_accounts(key)?, |
| 258 | MainCommand::ExtensionsUpdated() => self.extension_updated().await?, |
| 259 | }) |
| 260 | } |
| 261 | } |
no test coverage detected