objectiveai_api/functions/profiles/retrieval_client/
objectiveai.rs1use crate::ctx;
4use std::sync::Arc;
5
6pub struct ObjectiveAiClient {
8 pub client: Arc<objectiveai::HttpClient>,
10}
11
12impl ObjectiveAiClient {
13 pub fn new(client: Arc<objectiveai::HttpClient>) -> Self {
15 Self { client }
16 }
17}
18
19#[async_trait::async_trait]
20impl<CTXEXT> super::Client<CTXEXT> for ObjectiveAiClient
21where
22 CTXEXT: Send + Sync + 'static,
23{
24 async fn list_profiles(
25 &self,
26 _ctx: ctx::Context<CTXEXT>,
27 ) -> Result<
28 objectiveai::functions::profiles::response::ListProfile,
29 objectiveai::error::ResponseError,
30 > {
31 objectiveai::functions::profiles::list_profiles(&self.client)
32 .await
33 .map_err(|e| objectiveai::error::ResponseError::from(&e))
34 }
35
36 async fn get_profile_usage(
37 &self,
38 _ctx: ctx::Context<CTXEXT>,
39 owner: &str,
40 repository: &str,
41 commit: Option<&str>,
42 ) -> Result<
43 objectiveai::functions::profiles::response::UsageProfile,
44 objectiveai::error::ResponseError,
45 > {
46 objectiveai::functions::profiles::get_profile_usage(&self.client, owner, repository, commit)
47 .await
48 .map_err(|e| objectiveai::error::ResponseError::from(&e))
49 }
50}