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, org_slug: &str, 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”.
Sourcepub async fn list_my_orgs(&self) -> Result<Vec<OrgMembership>, GetMeError>
pub async fn list_my_orgs(&self) -> Result<Vec<OrgMembership>, GetMeError>
List the orgs the authenticated credential belongs to.
GET /api/v1/me/orgs. For a service-account key this is the service
user’s memberships; for a user session, the user’s orgs; for an
org-scoped key, an empty list.
pub async fn list_repos( &self, org_slug: &str, ) -> Result<Vec<RepoListItem>, Box<dyn Error>>
pub async fn get_agent_instructions( &self, org_slug: &str, repo_id: &Uuid, ) -> Result<AgentInstructionsResponse, Box<dyn Error>>
pub async fn verify_commits( &self, org_slug: &str, repo_id: &Uuid, req: CiVerifyRequest, ) -> Result<CiVerifyResponse, Box<dyn Error>>
pub async fn push_commit( &self, org_slug: &str, repo_id: &str, req: &CommitPushRequest, ) -> Result<CommitPushResponse, Box<dyn Error>>
pub async fn stream_event( &self, org_slug: &str, repo_id: &str, req: &StreamEventRequest, ) -> Result<StreamEventResponse, Box<dyn Error>>
Sourcepub async fn stream_event_for_project(
&self,
org_slug: &str,
project_id: Uuid,
repo_id: &str,
req: &StreamEventRequest,
) -> Result<StreamEventResponse, Box<dyn Error>>
pub async fn stream_event_for_project( &self, org_slug: &str, 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, org_slug: &str, repo_id: &Uuid, req: CheckPoliciesRequest, ) -> Result<CheckPoliciesResponse, Box<dyn Error>>
Sourcepub async fn resolve_remote(
&self,
org_slug: &str,
git_url: &str,
) -> Result<Option<ResolveRemoteResponse>, Box<dyn Error>>
pub async fn resolve_remote( &self, org_slug: &str, 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 (404).
Sourcepub async fn get_remote_detail(
&self,
org_slug: &str,
remote_id: Uuid,
) -> Result<RemoteDetail, Box<dyn Error>>
pub async fn get_remote_detail( &self, org_slug: &str, 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,
org_slug: &str,
remote_id: Uuid,
) -> Result<Vec<RemoteRepoRef>, Box<dyn Error>>
pub async fn get_remote_repos( &self, org_slug: &str, 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,
org_slug: &str,
) -> Result<Vec<ProjectListItem>, Box<dyn Error>>
pub async fn list_projects( &self, org_slug: &str, ) -> Result<Vec<ProjectListItem>, Box<dyn Error>>
List the projects in an org. GET /api/v1/orgs/{org}/projects.
Sourcepub async fn get_project(
&self,
org_slug: &str,
id: Uuid,
) -> Result<ProjectDetail, Box<dyn Error>>
pub async fn get_project( &self, org_slug: &str, id: Uuid, ) -> Result<ProjectDetail, Box<dyn Error>>
Full detail for a project. GET /api/v1/orgs/{org}/projects/{id}.
Sourcepub async fn resolve_project(
&self,
org_slug: &str,
git_url: &str,
) -> Result<ResolveProjectOutcome, Box<dyn Error>>
pub async fn resolve_project( &self, org_slug: &str, git_url: &str, ) -> Result<ResolveProjectOutcome, Box<dyn Error>>
Resolve a git URL to its project, distinguishing “no project” (404)
from “ambiguous, multiple candidate projects” (409).
GET /api/v1/orgs/{org}/projects/resolve?git_url=.