MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / list_views

Method list_views

atomic-remote/src/http/queries.rs:393–428  ·  view source on GitHub ↗

List all views on the remote repository. Returns one [`RemoteViewInfo`] per remote view (name, scope, parent, change count, state). Clients use this to enumerate the remote's views — for example to pull or recreate every view, not just the default one. Servers that predate the `?views` endpoint answer the request with a generic JSON info blob; that output does not match the tab-separated line fo

(&self)

Source from the content-addressed store, hash-verified

391 ///
392 /// The remote's views, in server order (deterministically sorted by name).
393 pub async fn list_views(&self) -> RemoteResult<Vec<RemoteViewInfo>> {
394 let url = format!("{}?views", self.base_url);
395 debug!("GET views: {}", url);
396
397 let response = self
398 .client
399 .get(&url)
400 .send()
401 .await
402 .map_err(|e| RemoteError::connection_failed(&url, e))?;
403
404 crate::check_min_version_header(response.headers());
405 let status = response.status();
406
407 match status {
408 StatusCode::OK => {
409 let text = response
410 .text()
411 .await
412 .map_err(|e| RemoteError::connection_failed(&url, e))?;
413 let views: Vec<RemoteViewInfo> =
414 text.lines().filter_map(RemoteViewInfo::parse).collect();
415 debug!("Found {} remote views", views.len());
416 Ok(views)
417 }
418 StatusCode::NOT_FOUND => Ok(Vec::new()),
419 StatusCode::UNAUTHORIZED | StatusCode::FORBIDDEN => {
420 let msg = response.text().await.unwrap_or_default();
421 Err(RemoteError::auth_failed(&url, msg))
422 }
423 _ => {
424 let msg = response.text().await.unwrap_or_default();
425 Err(RemoteError::http(status.as_u16(), msg))
426 }
427 }
428 }
429
430 /// Fetch a view's manifest from the remote.
431 ///

Callers

nothing calls this directly

Calls 6

check_min_version_headerFunction · 0.85
textMethod · 0.80
getMethod · 0.65
statusMethod · 0.45
collectMethod · 0.45
linesMethod · 0.45

Tested by

no test coverage detected