(&self)
| 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() { |
no test coverage detected