meegle/project/
api.rs

1use super::types::*;
2use crate::client::{AuthType, Client};
3use crate::error::ApiResult;
4
5pub trait ProjectApi {
6    // 获取指定用户有权限访问空间和插件安装的空间的交集
7    fn list_projects(
8        &self,
9        request: ListProjectRequest,
10        auth: AuthType,
11    ) -> impl std::future::Future<Output = ApiResult<ListProjectResponse>> + Send;
12
13    // 获取查询空间和插件安装空间交集的空间详情信息
14    fn get_projects_detail(
15        &self,
16        request: GetProjectDetailRequest,
17        auth: AuthType,
18    ) -> impl std::future::Future<Output = ApiResult<GetProjectDetailResponse>> + Send;
19}
20
21impl ProjectApi for Client {
22    async fn list_projects(
23        &self,
24        request: ListProjectRequest,
25        auth: AuthType,
26    ) -> ApiResult<ListProjectResponse> {
27        Ok(self.post("projects", request, auth).await?)
28    }
29
30    async fn get_projects_detail(
31        &self,
32        request: GetProjectDetailRequest,
33        auth: AuthType,
34    ) -> ApiResult<GetProjectDetailResponse> {
35        Ok(self.post("projects/detail", request, auth).await?)
36    }
37}