meegle/role/
api.rs

1use super::types::*;
2use crate::client::{AuthType, Client};
3use crate::error::ApiResult;
4
5pub trait RoleApi {
6    /// 获取流程角色配置详情
7    /// 该接口用于获取指定工作项类型下所有"角色与人员"的相关配置信息,对应的平台功能介绍详见常见问题:角色管理。
8    /// 对应的权限申请在权限管理-流程角色分类下,相关功能介绍详见权限管理。
9    fn get_role_config(
10        &self,
11        request: GetRoleConfigRequest,
12        auth: AuthType,
13    ) -> impl std::future::Future<Output = ApiResult<GetRoleConfigResponse>> + Send;
14}
15
16impl RoleApi for Client {
17    async fn get_role_config(
18        &self,
19        request: GetRoleConfigRequest,
20        auth: AuthType,
21    ) -> ApiResult<GetRoleConfigResponse> {
22        Ok(self
23            .get(
24                &format!(
25                    "{}/flow_roles/{}",
26                    request.project_key, request.work_item_type_key
27                ),
28                auth,
29            )
30            .await?)
31    }
32}