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

Method get_id

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

Get the view ID (UUID). # Arguments `view` - The name of the view to query. # Returns The view's UUID as a string.

(&self, view: &str)

Source from the content-addressed store, hash-verified

128 ///
129 /// The view's UUID as a string.
130 pub async fn get_id(&self, view: &str) -> RemoteResult<String> {
131 let url = format!("{}?view={}&id", self.base_url, view);
132 debug!("GET id: {}", url);
133
134 let response = self
135 .client
136 .get(&url)
137 .send()
138 .await
139 .map_err(|e| RemoteError::connection_failed(&url, e))?;
140
141 crate::check_min_version_header(response.headers());
142 let status = response.status();
143
144 match status {
145 StatusCode::OK => {
146 let text = response
147 .text()
148 .await
149 .map_err(|e| RemoteError::connection_failed(&url, e))?;
150
151 Ok(text.trim().to_string())
152 }
153 StatusCode::NOT_FOUND => Err(RemoteError::view_not_found(view)),
154 StatusCode::UNAUTHORIZED | StatusCode::FORBIDDEN => {
155 let msg = response.text().await.unwrap_or_default();
156 Err(RemoteError::auth_failed(&url, msg))
157 }
158 _ => {
159 let msg = response.text().await.unwrap_or_default();
160 Err(RemoteError::http(status.as_u16(), msg))
161 }
162 }
163 }
164
165 /// Download a change file by hash.
166 ///

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected