MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / session

Method session

src/api_client.rs:424–441  ·  view source on GitHub ↗

Introspect the token currently configured on this client. Returns the linked user (when applicable). Used to verify a token's validity without conflating it with repository-level access checks — those are done with [`Self::session_and_repository_overview`].

(&self)

Source from the content-addressed store, hash-verified

422 /// validity without conflating it with repository-level access checks —
423 /// those are done with [`Self::session_and_repository_overview`].
424 pub async fn session(&self) -> std::result::Result<SessionPayload, SessionError> {
425 let response = self
426 .gql_client
427 .query_unwrap::<SessionData>(include_str!("queries/Session.gql"))
428 .await;
429 match response {
430 Ok(data) => Ok(data.session),
431 Err(err)
432 if err.contains_error_code("UNAUTHENTICATED")
433 || err.contains_error_code("UNAUTHORIZED") =>
434 {
435 Err(SessionError::Unauthenticated)
436 }
437 Err(err) => Err(SessionError::Other(anyhow!(
438 "Failed to validate token: {err}"
439 ))),
440 }
441 }
442
443 /// Validate the token and look up a candidate repository in one
444 /// round-trip. Used by `auth status` (with a detected git remote) and

Callers 2

loginFunction · 0.80
resolve_auth_statusFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected