MCPcopy Create free account
hub / github.com/Moosync/Moosync / handle_request

Method handle_request

src-tauri/src/extensions/request_handler.rs:230–260  ·  view source on GitHub ↗
(&self, command: MainCommand)

Source from the content-addressed store, hash-verified

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}

Callers 1

get_extension_stateFunction · 0.80

Calls 15

get_songsMethod · 0.80
get_entityMethod · 0.80
send_ui_requestMethod · 0.80
get_preferencesMethod · 0.80
set_preferencesMethod · 0.80
add_songsMethod · 0.80
remove_songMethod · 0.80
add_playlistMethod · 0.80
register_oauthMethod · 0.80
update_accountsMethod · 0.80
extension_updatedMethod · 0.80
get_secureMethod · 0.45

Tested by

no test coverage detected