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

Method fetch_user_details

src-tauri/src/providers/youtube.rs:343–365  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

341
342 #[tracing::instrument(level = "debug", skip(self))]
343 async fn fetch_user_details(&self) -> Result<ProviderStatus> {
344 if let Some(api_client) = self.api_client.read().await.as_ref() {
345 let (_, user_info) = api_client
346 .api_client
347 .channels()
348 .list(&vec!["snippet".into()])
349 .mine(true)
350 .max_results(1)
351 .doit()
352 .await?;
353
354 let mut username = Some("".to_string());
355 if let Some(items) = user_info.items {
356 let channel = items.first().unwrap();
357 if let Some(snippet) = &channel.snippet {
358 username = snippet.title.clone();
359 }
360 }
361 return Ok(self.get_provider_status(username).await);
362 }
363
364 Err("API client not initialized".into())
365 }
366
367 async fn search_playlists(&self, term: &str) -> Result<Vec<QueryablePlaylist>> {
368 if let Some(api_client) = self.get_api_client().await.as_ref() {

Callers 2

create_api_clientMethod · 0.45
authorizeMethod · 0.45

Calls 2

cloneMethod · 0.80
get_provider_statusMethod · 0.45

Tested by

no test coverage detected