pub struct ApiClient { /* private fields */ }Implementations§
Source§impl ApiClient
impl ApiClient
pub fn new(base_url: &str, api_key: Option<&str>) -> Self
pub async fn register_repo( &self, req: RegisterRepoRequest, ) -> Result<RegisterRepoResponse, Box<dyn Error>>
pub async fn device_start(&self) -> Result<DeviceAuthResponse, Box<dyn Error>>
pub async fn device_status( &self, token: &str, ) -> Result<DeviceStatusResponse, Box<dyn Error>>
pub async fn logout(&self) -> Result<(), Box<dyn Error>>
Sourcepub async fn get_me(&self) -> Result<MeResponse, GetMeError>
pub async fn get_me(&self) -> Result<MeResponse, GetMeError>
GET /api/v1/auth/me — validates the bearer token and returns user
identity. Used by tracevault status to distinguish “logged out”,
“expired token”, and “server unreachable”.
pub async fn list_repos(&self) -> Result<Vec<RepoListItem>, Box<dyn Error>>
pub async fn get_agent_instructions( &self, repo_id: &Uuid, ) -> Result<AgentInstructionsResponse, Box<dyn Error>>
pub async fn verify_commits( &self, repo_id: &Uuid, req: CiVerifyRequest, ) -> Result<CiVerifyResponse, Box<dyn Error>>
pub async fn push_commit( &self, repo_id: &str, req: &CommitPushRequest, ) -> Result<CommitPushResponse, Box<dyn Error>>
pub async fn stream_event( &self, repo_id: &str, req: &StreamEventRequest, ) -> Result<StreamEventResponse, Box<dyn Error>>
Sourcepub async fn stream_event_for_project(
&self,
project_id: Uuid,
repo_id: &str,
req: &StreamEventRequest,
) -> Result<StreamEventResponse, Box<dyn Error>>
pub async fn stream_event_for_project( &self, project_id: Uuid, repo_id: &str, req: &StreamEventRequest, ) -> Result<StreamEventResponse, Box<dyn Error>>
Project-scoped variant of stream_event: posts to the project’s
stream endpoint with repo_id as a query param instead of a path
segment. The query is built with Url::query_pairs_mut, mirroring
resolve_project’s ?git_url=, so repo_id is percent-encoded
rather than string-interpolated into the URL.
Called from commands::stream::send_stream_event when a local
project binding resolves for the capturing event.
pub async fn check_policies( &self, repo_id: &Uuid, req: CheckPoliciesRequest, ) -> Result<CheckPoliciesResponse, Box<dyn Error>>
Sourcepub async fn resolve_remote(
&self,
git_url: &str,
) -> Result<Option<ResolveRemoteResponse>, Box<dyn Error>>
pub async fn resolve_remote( &self, git_url: &str, ) -> Result<Option<ResolveRemoteResponse>, Box<dyn Error>>
Resolve a git URL to its codebase (git remote) by NORMALIZED URL —
deduped, unlike an exact github_url match. Ok(None) if the
codebase isn’t tracked: a genuine domain 404, identified by the
server’s JSON error envelope (see [is_domain_error_body]). A bare
404 with no such body — axum’s built-in “no route matched” fallback
— is surfaced as Err instead, since it means this server doesn’t
have this route at all (most plausibly a CLI/server version skew,
e.g. this CLI shipped ahead of a server that still uses the old
org-scoped paths) rather than an absent codebase.
Sourcepub async fn get_remote_detail(
&self,
remote_id: Uuid,
) -> Result<RemoteDetail, Box<dyn Error>>
pub async fn get_remote_detail( &self, remote_id: Uuid, ) -> Result<RemoteDetail, Box<dyn Error>>
Full detail for a remote (codebase): its display name, normalized URL, clone status, and linked repos.
Sourcepub async fn get_remote_repos(
&self,
remote_id: Uuid,
) -> Result<Vec<RemoteRepoRef>, Box<dyn Error>>
pub async fn get_remote_repos( &self, remote_id: Uuid, ) -> Result<Vec<RemoteRepoRef>, Box<dyn Error>>
The repos linked to a remote (the codebase’s members).
Sourcepub async fn list_projects(
&self,
) -> Result<Vec<ProjectListItem>, Box<dyn Error>>
pub async fn list_projects( &self, ) -> Result<Vec<ProjectListItem>, Box<dyn Error>>
List all projects. GET /api/v1/projects.
Sourcepub async fn get_project(
&self,
id: Uuid,
) -> Result<ProjectDetail, Box<dyn Error>>
pub async fn get_project( &self, id: Uuid, ) -> Result<ProjectDetail, Box<dyn Error>>
Full detail for a project. GET /api/v1/projects/{id}.
Sourcepub async fn resolve_project(
&self,
git_url: &str,
) -> Result<ResolveProjectOutcome, Box<dyn Error>>
pub async fn resolve_project( &self, git_url: &str, ) -> Result<ResolveProjectOutcome, Box<dyn Error>>
Resolve a git URL to its project, distinguishing “no project” (a
genuine domain 404 — see [is_domain_error_body]) from “ambiguous,
multiple candidate projects” (409). A bare 404 with no domain-error
body is surfaced as Err instead of None (see resolve_remote’s
doc comment for why). GET /api/v1/projects/resolve?git_url=.