flow-doc-deleted/op/API.md

4963 lines
69 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# IDMesh API
op.api 对 IDMesh API 进行了封装。op.api 会自行对请求进行签名,因此使用前需要先通过 op.api.init 设置开发者账号。
## op.api.init
``` js
/** 注意!!
* 在使用任何 op.api 封装的接口之前,
* 你需要使用 op.api.init 初始化接口
* AK、SK 来自开发者账号
*/
const onSyncTask = async (config, env, op, eventData) => {
op.api.init('<AK>', '<SK>');
op.api.user.disable({ id: '<User_ID>' });
};
```
## api
### user
#### 创建用户
``` js
const { data } = await op.api.user.create(params);
```
POST /v1/users
##### 参数
``` ts
{
// 用户名,唯一,不传后台自动生成
username?: string;
// 密码,不传后台生成默认密码
password?: string;
// 密码状态valid/invalid
password_status?: string;
// 显示名称
display_name?: string;
// 名
firstname?: string;
// 姓
lastname?: string;
// 真实姓名
realname?: string;
// 拼音
pinyin?: string;
// 昵称
nickname?: string;
// 用户类型,不传后台设置系统默认类型
user_type?: string;
// 手机
mobile?: string;
// 邮箱
email?: string;
// 性别
gender?: string;
// 证件类型
cert_type?: string;
// 证件号
cert_number?: string;
// 区域
region?: string;
// 加入时间
work_time?: string;
// 职位
work_title?: string;
// 身份源ID作为创建时记录不做更新
idp_config_id: number;
// 系统扩展属性json对象{"age": 18, "love": "足球"}
sys_ext_props: {
}
// 自由扩展属性json对象
free_ext_props: {
}
// 是否通知默认不传false不通知true通知
is_notify?: boolean;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 返回用户id
data: {
}
}
```
#### 锁定用户(旧)
``` js
const { data } = await op.api.user.disable(params);
```
PATCH /v1/users/{id}/disable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 返回用户id
data?: boolean;
}
```
#### 解锁用户(旧)
``` js
const { data } = await op.api.user.enable(params);
```
PATCH /v1/users/{id}/enable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 返回用户id
data?: boolean;
}
```
#### 批量锁定用户(旧)
``` js
const { data } = await op.api.user.batchDisable(params);
```
POST /v1/jobs/users-disable
##### 参数
``` ts
{
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
effect_rows: number;
}
```
#### 批量解锁用户(旧)
``` js
const { data } = await op.api.user.batchEnable(params);
```
POST /v1/jobs/users-enable
##### 参数
``` ts
{
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
effect_rows: number;
}
```
#### 编辑用户
``` js
const { data } = await op.api.user.modify(params);
```
PATCH /v1/users/{id}
##### 参数
``` ts
{
id: string;
// 用户名,验证唯一
username?: string;
// 显示名称
display_name?: string;
// 名
firstname?: string;
// 姓
lastname?: string;
// 真实姓名
realname?: string;
// 拼音
pinyin?: string;
// 昵称
nickname?: string;
// 手机
mobile?: string;
// 邮箱
email?: string;
// 性别1男0女
gender?: string;
// 证件类型
cert_type?: string;
// 证件号
cert_number?: string;
// 区域
region?: string;
// 加入时间
work_time?: string;
// 职位
work_title?: string;
// 上次登录IP
last_login_ipaddr?: string;
// 上次登录时间
last_login_time?: string;
// 系统扩展信息json对象{"age": 18, "love": "足球"}
sys_ext_props: {
}
// 自由扩展属性json对象
free_ext_props: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 返回用户id
data: {
}
}
```
#### 删除用户
``` js
const { data } = await op.api.user.delete(params);
```
DELETE /v1/users/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 用户id
data: number;
}
```
#### 批量删除用户(旧)
``` js
const { data } = await op.api.user.batchDelete(params);
```
DELETE /v1/users
##### 参数
``` ts
{
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
effect_rows: number;
}
```
#### 查询用户列表
``` js
const { data } = await op.api.user.list(params);
```
GET /v1/users
##### 参数
``` ts
{
page_size?: integer;
page_num?: integer;
search_type?: string;
keyword?: string;
time_modified_from?: string;
time_modified_to?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
data: {
// 用户id标识
id?: number;
// 用户名,唯一
username: string;
// 密码
password: string;
// 显示名称
display_name?: string;
// 名
firstname?: string;
// 姓
lastname?: string;
// 真实姓名
realname?: string;
// 拼音
pinyin?: string;
// 昵称
nickname?: string;
// 用户类型
user_type: string;
// 手机
mobile?: string;
// 邮箱
email?: string;
// 性别
gender?: string;
// 证件类型
cert_type?: string;
// 证件号
cert_number?: string;
// 区域
region?: string;
// 加入时间
work_time?: date;
// 职位
work_title?: string;
// 扩展信息json对象{"age": 18, "love": "足球"}
ext_prop?: json;
// arn
arn?: string;
// 身份源ID
id_provider_connection: number;
// 开发者id
developer_id?: number;
// 租户id
tenant_id?: number;
// 上次登录IP
last_login_ipaddr?: string;
// 上次登录时间
last_login_time?: datetime;
// 创建时间
time_created?: datetime;
// 修改时间
time_modified?: number;
// 状态1正常0禁用
status: string;
}[];
// 总数
total_num?: number;
// 当前页
page_num?: number;
}
```
#### 查询用户详情
``` js
const { data } = await op.api.user.get(params);
```
GET /v1/users/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 用户id标识
id?: number;
// 用户名,唯一
username?: string;
// 密码
password?: string;
// 显示名称
display_name?: string;
// 名
firstname?: string;
// 姓
lastname?: string;
// 真实姓名
realname?: string;
// 拼音
pinyin?: string;
// 昵称
nickname?: string;
// 用户类型
user_type?: string;
// 手机
mobile?: string;
// 邮箱
email?: string;
// 性别
gender?: string;
// 证件类型
cert_type?: string;
// 证件号
cert_number?: string;
// 区域
region?: string;
// 加入时间
work_time?: date;
// 职位
work_title?: string;
// 扩展信息json对象{"age": 18, "love": "足球"}
ext_prop?: json;
// arn
arn?: string;
// 身份源ID
id_provider_connection?: number;
// 开发者id
developer_id?: number;
// 租户id
tenant_id?: number;
// 上次登录IP
last_login_ipaddr?: string;
// 上次登录时间
last_login_time?: datetime;
// 创建时间
time_created?: datetime;
// 修改时间
time_modified?: number;
// 状态1正常0禁用
status?: string;
}
```
#### 修改密码(旧)
``` js
const { data } = await op.api.user.modifyPassword(params);
```
PATCH /v1/users/{id}/passwords
##### 参数
``` ts
{
id: string;
old_password: string;
new_password: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
- Examples
```json
{
"summary": "成功示例",
"value": true
}
```
#### 查询用户存储凭证列表
``` js
const { data } = await op.api.user.getStoredCredentials(params);
```
GET /v1/user-stored-credentials
##### 参数
``` ts
{
user_id?: number;
provider_code?: string;
idp_config_id?: number;
id1?: string;
id2?: string;
metadata?: string;
status?: string;
username?: string;
display_name?: string;
page_size?: integer;
page_num?: integer;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
data: {
id?: integer;
username?: string;
password?: string;
display_name?: string;
firstname?: string;
lastname?: string;
realname?: string;
pinyin?: string;
nickname?: string;
// json对象
avatar: {
}
user_type?: string;
mobile?: string;
email?: string;
gender?: string;
cert_type?: string;
cert_number?: string;
region?: string;
work_time?: null;
work_title?: string;
arn?: string;
idp_config_id?: integer;
developer_id?: integer;
tenant_id?: integer;
last_login_ipaddr?: string;
last_login_time?: null;
time_created?: null;
time_modified?: integer;
status?: string;
// json对象
sys_ext_props: {
}
// json对象
free_ext_props: {
}
}[];
total_num: integer;
page_num: integer;
}
```
#### 创建用户存储凭证
``` js
const { data } = await op.api.user.createStoreCredential(params);
```
POST /v1/user-stored-credentials
##### 参数
``` ts
{
// 社会化身份源code
provider_code: string;
// 社会化登录配置的ID
idp_config_id: number;
// 社会化身份标识1如openid
id1: string;
// 社会化身份标识2如unionid
id2?: string;
// 更多社会化身份标识
metadata?: string;
// 状态
status?: string;
// 昵称
nickname?: string;
// 头像
avatar?: string;
// 真实姓名
realname?: string;
// 手机
mobile?: string;
// 邮箱
email?: string;
// 性别
gender?: string;
id_provider_connection?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// http状态码成功不显示
code?: number;
// 返回错误码
errno: number;
// 返回描述
message: string;
// 返回id标识
data?: string;
}
```
### authentication
### app
#### 创建应用
``` js
const { data } = await op.api.app.create(params);
```
POST /v1/applications
##### 参数
``` ts
{
name: string;
// 1自建应用2模板应用市场应用
type: string;
// 域名
domain_sn: string;
// 不填写则代表自建应用
template_id?: string;
// 1 标准web应用2单页web应用3客户端应用4后端服务
category: string;
descr?: string;
// 格式为http://ip:port/logo.png
logo?: string;
login_url?: string;
redirect_url?: string;
logout_url?: string;
// 1启用0不启用启用后单点登录返回
sub_account_policy?: string;
// kv字典数据
sys_ext_props: {
}
// kv字典数据
free_ext_props: {
}
// 默认 oidc
protocol_type?: string;
// 默认 oidc 相关配置
protocol_prop: {
acs_url?: string;
sp_entity?: string;
response_attr: {
value: string;
attribute: string;
nameFormat: string;
}[];
digest_algorithm?: string;
lifetime_in_seconds?: number;
signature_algorithm?: string;
name_identifier_format?: string;
authn_context_class_ref?: string;
saml_response_signing_key?: string;
saml_response_signing_cert?: string;
saml_response_signing_cert_fingerprint?: string;
}
config_prop: {
status?: string;
tenant_id?: string;
mfa_config: {
}
reg_policy?: string;[];
mfa_enabled?: string;
sso_enabled?: string;
developer_id?: string;
access_policy: {
forget_password?: string;[];
}
allowed_reg_method: {
}
default_reg_method?: string;
allowed_login_method: {
name?: string;
}
default_login_method?: string;
allowed_social_login_provider: {
wechat_scan_qr?: number;
dingding_scan_qr?: number;
}
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 唯一标识
id?: string;
}
```
#### 更新应用基本信息
``` js
const { data } = await op.api.app.modify(params);
```
PATCH /v1/applications/{id}
##### 参数
``` ts
{
id: string;
name?: string;
domain_sn?: string;
// 1自建应用2市场应用
type?: string;
app_id?: string;
app_secret?: string;
category?: string;
descr?: string;
logo?: null;
login_url?: string;
redirect_url?: string;
logout_url?: string;
sub_account_policy?: string;
sys_ext_props: {
}
free_ext_props: {
}
// 状态0禁用1启用
status?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
data?: number;
}
```
#### 查询应用模板列表
``` js
const { data } = await op.api.app.getTemplate(params);
```
GET /v1/application-templates
##### 参数
``` ts
{
name: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
current_page?: number;
data: {
// 唯一标识
id?: string;
// 应用名称
name?: string;
// 应用类型1自建应用2市场应用
type?: string;
// 应用分类
category?: string;
// 应用描述
descr?: string;
// logo路径
logo?: string;
// 登录路径
login_url?: string;
// 重定向路径
redirect_url?: string;
// 登出路径
logout_url?: string;
// 子账号策略1启用2不启用
sub_account_policy?: string;
// 扩展属性
prop: {
}
// 单点登录协议属性
protocol_prop: {
acs_url?: string;
sp_entity?: string;
response_attr: {
value: string;
attribute: string;
nameFormat: string;
}[];
digest_algorithm?: string;
lifetime_in_seconds?: number;
signature_algorithm?: string;
name_identifier_format?: string;
authn_context_class_ref?: string;
saml_response_signing_key?: string;
saml_response_signing_cert?: string;
saml_response_signing_cert_fingerprint?: string;
}
// 应用配置属性
config_prop: {
status?: string;
tenant_id?: string;
mfa_config: {
}
reg_policy?: number;
mfa_enabled?: string;
sso_enabled?: string;
developer_id?: string;
access_policy: {
forget_password?: string;[];
}
allowed_reg_method: {
}
default_reg_method?: string;
allowed_login_method: {
name?: string;
}
default_login_method?: string;
allowed_id_provider: {
wechat_scan_qr?: number;
dingding_scan_qr?: number;
}
}
// 创建事件
time_created?: string;
time_modified?: string;
status?: string;
}[];
total_num?: number;
}
```
#### 查询应用列表
``` js
const { data } = await op.api.app.list(params);
```
GET /v1/applications
##### 参数
``` ts
{
name?: string;
type?: string;
page_sort?: string;
types?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
data: {
// 唯一标识
id?: string;
// 开发者ID
developer_id: string;
// 租户ID
tenant_id: string;
// 应用名称
name?: string;
// 应用类型1自建应用2市场应用
type?: string;
// APPID
app_id?: string;
// 应用分类1 标准web应用2单页web应用3客户端应用4后端服务
category?: string;
// APPSEC开发者用户调用返回
app_secret?: string;
// 应用描述
descr?: string;
// logo路径
logo?: string;
// 登录路径
login_url?: string;
// 应用绑定的唯一域名
domain?: string;
// 重定向url
redirect_url?: string;
// 登出url
logout_url?: string;
// 子账号策略
sub_account_policy?: integer;
// 扩展属性
prop: {
}
// 创建时间
time_created?: string;
// 更新时间
time_modified?: string;
// 状态1启用0禁用
status?: string;
allowed_provider_id: {
config_id: string;
name: string;
provider_type: string;
}[];
}[];
total_num?: number;
current_page?: number;
}
```
#### 按条件查询应用
``` js
const { data } = await op.api.app.getByDomain(params);
```
GET /v1/application
##### 参数
``` ts
{
domain?: string;
domain_sn?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 唯一标识
id?: string;
// 开发者ID
developer_id: string;
// 租户ID
tenant_id: string;
// 应用名称
name?: string;
// 应用类型1自建应用2市场应用
type?: string;
// APPID
app_id?: string;
// 应用分类1 标准web应用2单页web应用3客户端应用4后端服务
category?: string;
// APPSEC开发者用户调用返回
app_secret?: string;
// 应用描述
descr?: string;
// logo路径
logo?: string;
// 登录路径
login_url?: string;
// 应用绑定的唯一域名
domain?: string;
// 应用域名 SN
domain_sn?: string;
// 重定向url
redirect_url?: string;
// 登出url
logout_url?: string;
// 子账号策略
sub_account_policy?: integer;
// 扩展属性
prop: {
}
// 创建时间
time_created?: string;
// 更新时间
time_modified?: string;
// 状态1启用0禁用
status?: string;
config: {
id: string;
app_id: string;
// 格式为:["password", "vercode"]
allowed_login_method?: string;
// 格式为password
default_login_method?: string;
// 格式为:["mobile", "email"]
allowed_reg_method?: string;
// 格式为mobile
default_reg_method?: string;
// permitted,all
access_policy?: string;
reg_policy?: string;
// 格式为:{"wechat_scan_qr": 1, "dingding_scan_qr": 2}
allowed_id_provider: {
id: string;
idp_code: string;
idp_config_id: string;
auth_method_code: string;
auth_method_display_name: string;
}
sso_enabled: boolean;
mfa_enabled: boolean;
mfa_config: {
name: string;
provider_type: string;
config_id: string;
scenarios?: string;[];
}
access_control_enabled: boolean;
time_created: string;
time_modified: string;
// 1启用0禁用
status: string;
}
protocols: {
}[];
}
```
#### 按 ID 查询应用
``` js
const { data } = await op.api.app.get(params);
```
GET /v1/applications/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 唯一标识
id?: string;
// 开发者ID
developer_id: string;
// 租户ID
tenant_id: string;
// 应用名称
name?: string;
// 应用类型1自建应用2市场应用
type?: string;
// APPID
app_id?: string;
// 应用分类1 标准web应用2单页web应用3客户端应用4后端服务
category?: string;
// APPSEC开发者用户调用返回
app_secret?: string;
// 应用描述
descr?: string;
// logo路径
logo?: string;
// 登录路径
login_url?: string;
// 应用绑定的唯一域名
domain?: string;
// 应用域名 SN
domain_sn?: string;
// 重定向url
redirect_url?: string;
// 登出url
logout_url?: string;
// 子账号策略
sub_account_policy?: integer;
// 扩展属性
prop: {
}
// 创建时间
time_created?: string;
// 更新时间
time_modified?: string;
// 状态1启用0禁用
status?: string;
config: {
id: string;
app_id: string;
// 格式为:["password", "vercode"]
allowed_login_method?: string;
// 格式为password
default_login_method?: string;
// 格式为:["mobile", "email"]
allowed_reg_method?: string;
// 格式为mobile
default_reg_method?: string;
// permitted,all
access_policy?: string;
reg_policy?: string;
// 格式为:{"wechat_scan_qr": 1, "dingding_scan_qr": 2}
allowed_id_provider: {
id: string;
idp_code: string;
idp_config_id: string;
auth_method_code: string;
auth_method_display_name: string;
}
sso_enabled: boolean;
mfa_enabled: boolean;
mfa_config: {
name: string;
provider_type: string;
config_id: string;
scenarios?: string;[];
}
access_control_enabled: boolean;
time_created: string;
time_modified: string;
// 1启用0禁用
status: string;
}
protocols: {
}[];
}
```
#### 启用应用
``` js
const { data } = await op.api.app.enable(params);
```
POST /v1/applications/{id}/enable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message: string;
// 操作ID
data: number;
}
```
#### 禁用应用
``` js
const { data } = await op.api.app.disable(params);
```
POST /v1/applications/{id}/disable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
// 操作ID
data?: number;
}
```
#### 删除应用
``` js
const { data } = await op.api.app.delete(params);
```
DELETE /v1/applications/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
// 结果标识true/false
data: {
}
}
```
#### 刷新应用安全码
``` js
const { data } = await op.api.app.createSecrets(params);
```
POST /v1/applications/{id}/secrets
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 操作结果
message?: string;
data: {
// 安全码
appSecret?: string;
// 唯一标识
id?: string;
}
}
```
#### 查询应用配置信息
``` js
const { data } = await op.api.app.getConfig(params);
```
GET /v1/applications/{id}/configs
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 唯一标识
id: string;
// 应用ID
app_id: string;
// 允许的登录方式,格式为:["password", "vercode"]
allowed_login_method?: string;
// 默认登录方式格式为password
default_login_method: string;
// 允许注册方式,格式为:["mobile", "email"]
allowed_reg_method?: string;
// 默认注册方式格式为mobile
default_reg_method: string;
// 应用级访问控制权限,格式为:{"password_recovery": ["email"]}
access_policy?: string;
// 新用户注册策略是否允许自动注册注册验证方式等1是2否,
reg_policy?: string;
// 允许的登录身份提供商,格式为:{"wechat_scan_qr": 1, "dingding_scan_qr": 2}
allowed_id_provider?: string;
// 是否允许SSO
sso_enabled: boolean;
// 是否开启MFA
mfa_enabled?: boolean;
// 开启的MFA配置
mfa_config: {
name: string;
provider_type: string;
config_id: string;
}
// 创建时间
time_created?: string;
// 修改时间
time_modified?: string;
// 状态1启用0禁用
status?: string;
}
```
#### 更新应用配置
``` js
const { data } = await op.api.app.modifyConfig(params);
```
PATCH /v1/applications/{id}/configs
##### 参数
``` ts
{
id: string;
// 允许的登录方式,格式为:["password", "vercode"]
allowed_login_method?: string;
// 默认登录方式格式为password
default_login_method?: string;
// 允许注册方式,格式为:["mobile", "email"]
allowed_reg_method?: string;
// 默认注册方式格式为mobile
default_reg_method?: string;
// 默认登录协议
default_protocol?: string;
// 应用级访问控制权限all: 所有人可访问 permitted: 拒绝未授权访问
access_policy?: string;
reg_policy?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
data?: number;
}
```
#### 禁用应用单点登录
``` js
const { data } = await op.api.app.disableSSO(params);
```
POST /v1/applications/{id}/sso/disable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 启用应用单点登录
``` js
const { data } = await op.api.app.enableSSO(params);
```
POST /v1/applications/{id}/sso/enable
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建应用多因素认证配置
``` js
const { data } = await op.api.app.createMFA(params);
```
POST /v1/applications/{id}/mfa
##### 参数
``` ts
{
id: string;
// 已配置的idp conn id
config_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 删除应用多因素认证配置
``` js
const { data } = await op.api.app.deleteMFA(params);
```
DELETE /v1/applications/{app_id}/mfa/{config_id}
##### 参数
``` ts
{
app_id: string;
config_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建应用认证源
``` js
const { data } = await op.api.app.createIDP(params);
```
POST /v1/applications/{id}/idp
##### 参数
``` ts
{
id: string;
// 已配置的idp conn id
config_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 删除应用认证源
``` js
const { data } = await op.api.app.deleteIDPConfig(params);
```
DELETE /v1/applications/{app_id}/idp/{config_id}
##### 参数
``` ts
{
app_id: string;
config_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 启用应用认证协议
``` js
const { data } = await op.api.app.enableProtocol(params);
```
POST /v1/applications/{app_id}/protocols/{protocol_type}/enable
##### 参数
``` ts
{
app_id: string;
protocol_type: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
data?: number;
}
```
#### 禁用应用认证协议
``` js
const { data } = await op.api.app.disableProtocol(params);
```
POST /v1/applications/{app_id}/protocols/{protocol_type}/disable
##### 参数
``` ts
{
app_id: string;
protocol_type: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询应用认证协议列表
``` js
const { data } = await op.api.app.getProtocols(params);
```
GET /v1/applications/{id}/protocols
##### 参数
``` ts
{
id: string;
status?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}[];
```
#### 查询应用认证协议
``` js
const { data } = await op.api.app.getProtocol(params);
```
GET /v1/applications/{app_id}/protocols/{protocol_type}
##### 参数
``` ts
{
app_id: string;
protocol_type: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 更新应用认证协议
``` js
const { data } = await op.api.app.modifyProtocol(params);
```
PUT /v1/applications/{app_id}/protocols/{protocol_type}
##### 参数
``` ts
{
app_id: string;
protocol_type: string;
// 配置参数
config_content: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建应用子账号
``` js
const { data } = await op.api.app.createAccount(params);
```
POST /v1/applications/{id}/accounts
##### 参数
``` ts
{
id: string;
user_id: string;
username: string;
app_id: string;
acc_name: string;
acc_name_displayed?: string;
acc_source?: string;
acc_password: string;
// 1启用0禁用
acc_status: string;
sys_ext_props: {
}
free_ext_props: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
data?: number;
}
```
#### 更新应用子账号
``` js
const { data } = await op.api.app.modifyAccount(params);
```
PUT /v1/applications/{app_id}/accounts/{id}
##### 参数
``` ts
{
app_id: string;
id: string;
user_id?: string;
app_id?: string;
acc_name?: string;
acc_name_displayed?: string;
acc_source?: string;
acc_password?: string;
// 1启用0禁用
acc_status?: string;
sys_ext_props: {
}
free_ext_props: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
message?: string;
data?: number;
}
```
#### 启用应用子账号
``` js
const { data } = await op.api.app.enableAccount(params);
```
POST /v1/applications/{app_id}/accounts/{id}/enable
##### 参数
``` ts
{
app_id: string;
id: string;
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 禁用应用子账号
``` js
const { data } = await op.api.app.disableAccount(params);
```
POST /v1/applications/{app_id}/accounts/{id}/disable
##### 参数
``` ts
{
app_id: string;
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 删除应用子账号
``` js
const { data } = await op.api.app.deleteAccount(params);
```
DELETE /v1/applications/{app_id}/accounts/{id}
##### 参数
``` ts
{
app_id: string;
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 按 APP ID 查询应用子账号列表
``` js
const { data } = await op.api.app.getAccountsByApp(params);
```
GET /v1/applications/{app_id}/accounts
##### 参数
``` ts
{
app_id: string;
user_id?: string;
acc_status?: string;
acc_name?: string;
page_num?: integer;
page_size?: integer;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
records: {
id: string;
user_id: string;
username: string;
app_id: string;
app_name: string;
acc_name: string;
acc_name_displayed: string;
acc_source: string;
developer_id: string;
tenant_id: string;
acc_password: string;
acc_status: string;
acc_sync_status: string;
acc_prop: {
}
time_created: string;
time_modified: string;
}[];
total?: number;
}
```
#### 查询应用子账号列表
``` js
const { data } = await op.api.app.getAccounts(params);
```
GET /v1/application-accounts
##### 参数
``` ts
{
app_id?: string;
user_id?: string;
acc_status?: string;
acc_name?: string;
page_num?: integer;
page_size?: integer;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
records: {
id: string;
user_id: string;
username: string;
app_id: string;
app_name: string;
acc_name: string;
acc_name_displayed: string;
acc_source: string;
developer_id: string;
tenant_id: string;
acc_password: string;
acc_status: string;
acc_sync_status: string;
acc_prop: {
}
time_created: string;
time_modified: string;
}[];
total?: number;
}
```
#### 按 ID 查询应用子账号
``` js
const { data } = await op.api.app.getAccount(params);
```
GET /v1/applications/{app_id}/accounts/{id}
##### 参数
``` ts
{
app_id: string;
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
user_id: string;
username: string;
app_id: string;
app_name: string;
acc_name: string;
acc_name_displayed: string;
acc_source: string;
developer_id: string;
tenant_id: string;
acc_password: string;
acc_status: string;
acc_sync_status: string;
acc_prop: {
}
time_created: string;
time_modified: string;
}
```
### permission
#### 获取权限列表
``` js
const { data } = await op.api.permission.getPrivileges(params);
```
GET /v1/privileges
##### 参数
``` ts
{
identity_id?: string;
identity_type?: string;
identity_name?: string;
application_id: string;
object_type?: string;
object_code?: string;
affect?: string;
page_num?: string;
page_size?: string;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 数据总数
total_num?: number;
// 当前页数(废弃)
current_page?: number;
data: {
id: number;
identity_type: string;
identity_id: string;
auth_unit_rule_id: string;
application_id: string;
object_type: string;
object_code: string;
affect_scope: string;
affect: string;
time_created: string;
time_modified: string;
}[];
}
```
#### 获取授权单元列表
``` js
const { data } = await op.api.permission.getAuthUnits(params);
```
GET /v1/auth-units
##### 参数
``` ts
{
identity_id?: string;
identity_type?: string;
identity_name?: string;
page_num?: string;
page_size?: string;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 总数量
total_num?: number;
data: {
id: string;
identity_id: string;
identity_name: string;
// user 用户 programmer 编程者node 组织/自定义关系
identity_type: string;
rules: {
id: string;
auth_unit_id: string;
resource: {
id: string;
developer_id: string;
tenant_id: string;
application_id: string;
applicatioin_name: string;
is_global: boolean;
description: string;
type: string;
code: string;
uri?: string;
time_modified: string;
time_created: string;
scope: string;
selected_actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
}
resource_set: {
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
members: {
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}[];
match_all_resources?: boolean;
}
// allow/deny
affect: string;
// 当resource存在时
resource_type?: string;
// 当 resource 存在时表示 resource_code
//
// 当 resource_set存在时表示 resource_set_code
code: string;
description?: string;
application_name: string;
identity_id: string;
identity_type: string;
identity_name: string;
inherited: boolean;
}[];
time_created: string;
time_modified: string;
}[];
}
```
#### 按 ID 查询授权单元
``` js
const { data } = await op.api.permission.getAuthUnit(params);
```
GET /v1/auth-units/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
identity_id: string;
identity_name: string;
// user 用户 programmer 编程者node 组织/自定义关系
identity_type: string;
rules: {
id: string;
auth_unit_id: string;
resource: {
id: string;
developer_id: string;
tenant_id: string;
application_id: string;
applicatioin_name: string;
is_global: boolean;
description: string;
type: string;
code: string;
uri?: string;
time_modified: string;
time_created: string;
scope: string;
selected_actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
}
resource_set: {
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
members: {
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}[];
match_all_resources?: boolean;
}
// allow/deny
affect: string;
// 当resource存在时
resource_type?: string;
// 当 resource 存在时表示 resource_code
//
// 当 resource_set存在时表示 resource_set_code
code: string;
description?: string;
application_name: string;
identity_id: string;
identity_type: string;
identity_name: string;
inherited: boolean;
}[];
time_created: string;
time_modified: string;
}
```
#### 批量创建授权规则
``` js
const { data } = await op.api.permission.createAuthUnitRules(params);
```
POST /v1/batch/auth-unit-rules
##### 参数
``` ts
{
identities: {
identity_id: string;
identity_name: string;
// user 用户 programmer 编程者node 组织/自定义关系
identity_type: string;
}[];
rules: {
resource: {
id: string;
scope: string;
actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
// 当match_all_resources=true时必填
application_id?: string;
// 当match_all_resources=true时必填
application_name?: string;
}
resource_set: {
id: string;
}
application: {
id: string;
}
// allow/deny
affect: string;
// 用于标识应用(尤其是在使用全局资源的场景下)
owner_app_id: string;
}[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 更新授权规则
``` js
const { data } = await op.api.permission.modifyAuthUnit(params);
```
PUT /v1/auth-units/{rid}/rules/{tid}
##### 参数
``` ts
{
rid: string;
tid: string;
resource: {
id: string;
scope: string;
actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
// 当match_all_resources=true时必填
application_id?: string;
// 当match_all_resources=true时必填
application_name?: string;
}
resource_set: {
id: string;
}
application: {
id: string;
}
// allow/deny
affect: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询授权单元下的授权规则列表
``` js
const { data } = await op.api.permission.getAuthUnitsRules(params);
```
GET /v1/auth-units/{rid}/rules
##### 参数
``` ts
{
rid: string;
application_id?: string;
type?: string;
code?: string;
self_only?: string;
resource_id?: string;
resource_match_all_resources?: string;
resource_match_all_actions?: string;
resource_set_id?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
auth_unit_id: string;
resource: {
id: string;
developer_id: string;
tenant_id: string;
application_id: string;
applicatioin_name: string;
is_global: boolean;
description: string;
type: string;
code: string;
uri?: string;
time_modified: string;
time_created: string;
scope: string;
selected_actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
}
resource_set: {
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
members: {
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}[];
match_all_resources?: boolean;
}
// allow/deny
affect: string;
// 当resource存在时
resource_type?: string;
// 当 resource 存在时表示 resource_code
//
// 当 resource_set存在时表示 resource_set_code
code: string;
description?: string;
application_name: string;
identity_id: string;
identity_type: string;
identity_name: string;
inherited: boolean;
}[];
```
#### 查询授权规则列表
``` js
const { data } = await op.api.permission.queryAuthUnitsRules(params);
```
GET /v1/auth-unit-rules
##### 参数
``` ts
{
application_id?: string;
type?: string;
code?: string;
identity_id: string;
identity_type: string;
identity_name?: string;
self_only?: string;
resource_id?: string;
resource_match_all_resources?: string;
resource_match_all_actions?: string;
resource_set_id?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
auth_unit_id: string;
resource: {
id: string;
developer_id: string;
tenant_id: string;
application_id: string;
applicatioin_name: string;
is_global: boolean;
description: string;
type: string;
code: string;
uri?: string;
time_modified: string;
time_created: string;
scope: string;
selected_actions?: string;[];
match_all_actions?: boolean;
match_all_resources?: boolean;
}
resource_set: {
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
members: {
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}[];
match_all_resources?: boolean;
}
// allow/deny
affect: string;
// 当resource存在时
resource_type?: string;
// 当 resource 存在时表示 resource_code
//
// 当 resource_set存在时表示 resource_set_code
code: string;
description?: string;
application_name: string;
identity_id: string;
identity_type: string;
identity_name: string;
inherited: boolean;
}[];
```
#### 批量删除授权规则
``` js
const { data } = await op.api.permission.deleteAuthUnitRules(params);
```
DELETE /v1/batch/auth-unit-rules
##### 参数
``` ts
{
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建资源
``` js
const { data } = await op.api.permission.createResource(params);
```
POST /v1/resources
##### 参数
``` ts
{
// 描述
description?: string;
// 资源代码
code: string;
// 应用id
application_id: number;
// 资源类型data/api/ui
type: string;
// 资源URI, 当type=api/ui 时有效
uri?: string;
actions: {
code: string;
description?: string;
}[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 资源id
resource_id: string;
}
```
#### 更新资源
``` js
const { data } = await op.api.permission.modifyResource(params);
```
PUT /v1/resources/{id}
##### 参数
``` ts
{
id: string;
// 描述
description?: string;
// 资源URI, 当type=api/ui 时有效
uri?: string;
actions: {
// 如果不携带id会认为是新创建的code
id?: string;
code: string;
description?: string;
}[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询资源列表
``` js
const { data } = await op.api.permission.getResources(params);
```
GET /v1/resources
##### 参数
``` ts
{
application_id: string;
type?: string;
code?: string;
include_global?: string;
page_num?: string;
page_size?: string;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 数据总数
total_num?: number;
data: {
// 资源id
id?: string;
// 开发者id
developer_id?: string;
// 租户id
tenant_id?: string;
// 应用id
application_id?: string;
// 描述
description?: string;
// 类型
type?: string;
// 代码
code?: string;
// 修改时间 rfc3339
time_modified?: string;
// 创建时间 rfc3339
time_created?: string;
}[];
}
```
#### 按 ID 查询资源
``` js
const { data } = await op.api.permission.getResource(params);
```
GET /v1/resources/{id}
##### 参数
``` ts
{
id: string;
application_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 资源id
id?: string;
// 开发者id
developer_id?: string;
// 租户id
tenant_id?: string;
// 应用id
application_id?: string;
// 描述
description?: string;
// 类型
type?: string;
// 代码
code?: string;
// 修改时间 rfc3339
time_modified?: string;
// 创建时间 rfc3339
time_created?: string;
}
```
#### 删除资源
``` js
const { data } = await op.api.permission.deleteResources(params);
```
DELETE /v1/batch/resources
##### 参数
``` ts
{
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建资源集合
``` js
const { data } = await op.api.permission.createResourceSet(params);
```
POST /v1/resource-sets
##### 参数
``` ts
{
X-Tenant-id: string;
// 应用id
application_id: string;
// 集合代码
code: string;
// 描述
description?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: number;
}
```
#### 更新资源集合
``` js
const { data } = await op.api.permission.modifyResourceSet(params);
```
PUT /v1/resource-sets/{id}
##### 参数
``` ts
{
X-Tenant-Id: string;
id: string;
// 集合代码
code: string;
// 描述
description: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询资源集合列表
``` js
const { data } = await op.api.permission.getResourceSets(params);
```
GET /v1/resource-sets
##### 参数
``` ts
{
code?: string;
application_id: string;
include_global?: string;
page_num?: string;
page_size?: string;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 数据总数
total_num?: number;
data: {
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
}[];
}
```
#### 按 ID 查询资源集合
``` js
const { data } = await op.api.permission.getResourceSet(params);
```
GET /v1/resource-sets/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
code?: string;
description?: string;
time_modified?: string;
time_created?: string;
}
```
#### 创建资源集合成员
``` js
const { data } = await op.api.permission.createResourceSetMember(params);
```
POST /v1/resource-sets/{id}/members
##### 参数
``` ts
{
id: string;
resource_id: number;
resource_scope: string;
resource_actions?: string;[];
match_all_actions: boolean;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 成员id
member_id: string;
}
```
#### 更新资源集合成员
``` js
const { data } = await op.api.permission.modifyResourceSetMember(params);
```
PUT /v1/resource-sets/{sid}/members/{mid}
##### 参数
``` ts
{
sid: string;
mid: string;
resource_id: number;
resource_scope: string;
ResourceActions: {
// 操作id
id: number;
// 操作代码
code: string;
}[];
match_all_actions: boolean;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询资源集合成员列表
``` js
const { data } = await op.api.permission.getResourceMembers(params);
```
GET /v1/resource-sets/{sid}/members
##### 参数
``` ts
{
sid: string;
resource_code?: string;
resource_type?: string;
page_num?: string;
page_size?: string;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 数据总数
total_num?: number;
data: {
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}[];
}
```
#### 按 ID 查询资源集合成员
``` js
const { data } = await op.api.permission.getResourceMember(params);
```
GET /v1/resource-sets/{sid}/members/{mid}
##### 参数
``` ts
{
sid: string;
mid: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
set_id?: string;
developer_id?: string;
tenant_id?: string;
resource_id?: string;
application_id?: string;
application_name?: string;
is_global?: boolean;
resource_type?: string;
resource_code?: string;
resource_scope?: string;
resource_actions: {
code: string;
description?: string;
}
selected_resource_actions?: string;[];
match_all_resource_actions: boolean;
time_modified?: string;
time_created?: string;
}
```
#### 授权应用
``` js
const { data } = await op.api.permission.authorizeApplications(params);
```
POST /v1/batch/authz-apps
##### 参数
``` ts
{
X-Tenant-Id: string;
identities: {
identity_id: string;
identity_name: string;
// user 用户 programmer 编程者node 组织/自定义关系
identity_type: string;
}[];
application_id: string;
// allow, deny
affect: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 查询已授权应用列表
``` js
const { data } = await op.api.permission.listAuthorizedApplications(params);
```
GET /v1/authz-apps
##### 参数
``` ts
{
X-Tenant-Id: string;
identity_id: string;
identity_type: string;
type?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
developer_id: string;
tenant_id: string;
name: string;
// - 0 默认应用
// - 1 自建应用
// - 2 模板应用
// - 3 组件应用
type: string;
access_policy: string;
decr?: string;
// base64编码
logo: string;
access_url: string;
enabled_protocols?: string;[];
// rfc3339
time_modified: string;
// rfc3339
time_created: string;
}[];
```
### organization
#### 创建组织关系
``` js
const { data } = await op.api.organization.createOrganization(params);
```
POST /v1/core-objects
##### 参数
``` ts
{
object_display_name: string;
// 固定值tree
object_type: string;
// 唯一,不可改,外键关联引用
object_code: string;
object_props: string;
// 是否默认组织关系1是0否
is_default: string;
status: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 创建ID
id?: string;
}
```
#### 查询父节点
``` js
const { data } = await op.api.organization.getNodeParent(params);
```
GET /v1/tree-nodes/{id}/parent
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 节点ID
id?: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}[];
```
#### 删除节点
``` js
const { data } = await op.api.organization.deleteNode(params);
```
DELETE /v1/tree-nodes/{id}
##### 参数
``` ts
{
id: string;
object_code: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
}
```
#### 获取组织关系列表
``` js
const { data } = await op.api.organization.getOrganizations(params);
```
GET /v1/core-objects
##### 参数
``` ts
{
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
object_display_name: string;
// 固定值tree
object_type: string;
// 唯一,不可改,外键关联引用
object_code: string;
object_props: string;
// 是否默认组织关系1是0否
is_default: string;
status: string;
time_created: string;
time_modified: string;
}[];
```
#### 修改组织关系基本信息
``` js
const { data } = await op.api.organization.updateOrganization(params);
```
PATCH /v1/core-objects/{id}
##### 参数
``` ts
{
id: string;
object_display_name: string;
// 固定值tree
object_type: string;
// 唯一,不可改,外键关联引用
object_code: string;
object_props: string;
// 是否默认组织关系1是0否
is_default: string;
status: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
}
```
#### 获取组织关系基本信息
``` js
const { data } = await op.api.organization.getOrganization(params);
```
GET /v1/core-objects/{id}
##### 参数
``` ts
{
id: string;
code: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
object_display_name: string;
// 固定值tree
object_type: string;
// 唯一,不可改,外键关联引用
object_code: string;
object_props: string;
// 是否默认组织关系1是0否
is_default: string;
status: string;
time_created: string;
time_modified: string;
}[];
```
#### 删除组织关系
``` js
const { data } = await op.api.organization.deleteOrganization(params);
```
DELETE /v1/core-objects/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
}
```
#### 添加用户到节点 TODO
``` js
const { data } = await op.api.organization.addUserToNode(params);
```
POST /v1/tree-users
##### 参数
``` ts
{
// 关联扩展信息
relation_data?: string;
// user_id
user_ids?: string;[];
// 用于区分多重关联
relation_type?: string;
// 1是0否
is_default?: string;
node_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
}
```
#### 更新用户节点
``` js
const { data } = await op.api.organization.updateMember(params);
```
PATCH /v1/tree-users/{id}
##### 参数
``` ts
{
id: string;
// 移动节点move, 设置为默认关系as-default
action: string;
// 1是0否
is_default?: string;
// 移动前节点ID
source_node_id?: string;
// 移动后节点ID
dest_node_id?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
}
```
#### 获取与用户关联的组织关系列表
``` js
const { data } = await op.api.organization.getMembers(params);
```
GET /v1/tree-users
##### 参数
``` ts
{
user_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 全局唯一ID
id: string;
// 节点ID
node_id: string;
// 用户ID
user_id: string;
// 所属组织关系路径
path: string;
// 显示名
display_name: string;
// 用户名
username: string;
// 关联类型(用于区分多重关联)
relation_type?: string;
// 关联扩展信息
relation_data?: string;
// 是否默认关系
is_default?: string;
// 创建时间
time_created: string;
// 修改时间
time_modified: string;
// 状态
status: string;
tree_node: {
// 节点ID
id?: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}
}[];
```
#### 获取成员信息列表
``` js
const { data } = await op.api.organization.getNodeMembers(params);
```
GET /v1/tree-nodes/{id}/tree-users
##### 参数
``` ts
{
id: string;
relation_type?: string;
is_default?: string;
display_name?: string;
username?: string;
mode?: string;
page_num?: integer;
page_size?: integer;
page_sort?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 总数
total_num: integer;
// 当前页码
current_page: integer;
data: {
// 用户ID
user_id: string;
// 用户名
username: string;
// 用户显示名
display_name: string;
node_info: {
// 全局唯一ID
id: string;
// 节点ID
node_id: string;
// 用户ID
user_id: string;
// 所属组织关系路径
path: string;
// 显示名
display_name: string;
// 用户名
username: string;
// 关联类型(用于区分多重关联)
relation_type?: string;
// 关联扩展信息
relation_data?: string;
// 是否默认关系
is_default?: string;
// 创建时间
time_created: string;
// 修改时间
time_modified: string;
// 状态
status: string;
}[];
}[];
}
```
#### 批量从组织关系中移除用户-内部使用
``` js
const { data } = await op.api.organization.deleteNodeMembers(params);
```
DELETE /v1/tree-nodes/{node_id}/tree-users
##### 参数
``` ts
{
node_id: string;
ids?: string;[];
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// node_id
id: string;
}
```
#### 从组织关系中移除用户-内部使用
``` js
const { data } = await op.api.organization.deleteMember(params);
```
DELETE /v1/tree-users/{id}
##### 参数
``` ts
{
id: string;
ids?: string;[];
// 节点ID
node_id: string;
// 用户原始ID
user_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
}
```
#### 从节点移除用户
``` js
const { data } = await op.api.organization.deleteMembers(params);
```
DELETE /v1/tree-users
##### 参数
``` ts
{
// 节点ID
node_id: string;
// 用户原始ID
user_id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
}
```
#### 创建节点
``` js
const { data } = await op.api.organization.createNode(params);
```
POST /v1/tree-nodes
##### 参数
``` ts
{
// 节点ID
id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id?: string;
}
```
#### 编辑节点
``` js
const { data } = await op.api.organization.updateNode(params);
```
PATCH /v1/tree-nodes/{id}
##### 参数
``` ts
{
id: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 系统分配的用于处理树型关系的编码
sys_code?: string;
// 节点代码
code?: string;
// 是否指针节点0普通结点1指针结点
is_pointer?: string;
// 操作人ID
operator_id?: number;
// 备注
description?: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
// 指针指向的实体节点
pointer_id?: number;
// 动态节点的条件(如满足某后缀表达式)
condition?: string;
// 源上级节点ID根为0
source_parent_id?: number;
// 目标上级节点ID根为0
dest_parent_id?: number;
// 节点名称
name?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 节点类型OBJ_ID组织角色岗位职级等
object_code?: string;
// ARN
arn?: string;
// 显示顺序
seq?: number;
// 状态
status?: string;
}
```
#### 删除节点 TODO
``` js
const { data } = await op.api.organization.deleteChildrenNodes(params);
```
DELETE /v1/tree-nodes/{id}/children
##### 参数
``` ts
{
id: string;
object_code: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
id: string;
}
```
#### 查询节点信息列表
``` js
const { data } = await op.api.organization.getNodes(params);
```
GET /v1/tree-nodes
##### 参数
``` ts
{
object_code: string;
name?: string;
code?: string;
tag?: string;
time_modified_from?: string;
time_modified_to?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 节点ID
id?: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}[];
```
#### 查询节点信息
``` js
const { data } = await op.api.organization.getNode(params);
```
GET /v1/tree-nodes/{id}
##### 参数
``` ts
{
id: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 节点ID
id?: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}
```
#### 获取子节点列表
``` js
const { data } = await op.api.organization.getChildrenNodes(params);
```
GET /v1/tree-nodes/{id}/children
##### 参数
``` ts
{
id: string;
mode: string;
object_code: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
// 节点ID
id?: string;
// 开发者ID
developer_id?: string;
// 租户ID
tenant_id?: string;
arn?: string;
// 创建时间
time_created?: string;
// 用于定义节点类型目前支持org组织role角色position岗位group
tag?: string;
// 状态
status?: string;
// 是否指针类型
is_pointer?: string;
// 节点code
code: string;
// 节点名字
name: string;
// 抽象权限容器的ARN
perm_namespace_arn?: string;
condition?: string;
// 是否动态节点0普通结点1动态结点
is_dynamic?: string;
// 系统code
sys_code: string;
// 操作者id
operator_id?: string;
// 指针指向的实体节点
pointer_id?: string;
// 序号
seq?: integer;
// 描述
description?: string;
// 最后修改时间
time_modified?: string;
// OBJ_ID组织角色岗位职级等
object_code: string;
// 父节点id
parent_id?: string;
// 额外属性
ext_props: {
}
}[];
```
### storage
#### 获取 Bucket 列表
``` js
const { data } = await op.api.storage.getBuckets(params);
```
GET /v1/buckets
##### 参数
``` ts
{
last?: string;
limit?: integer;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
bucket: string;
// 单位byte
data_size: integer;
object_count: integer;
}[];
```
#### 获取 Object 列表
``` js
const { data } = await op.api.storage.getObjects(params);
```
GET /v1/buckets/{bucket}/objects
##### 参数
``` ts
{
bucket: string;
last?: string;
limit?: integer;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
bucket: string;
key: string;
value: string;
// rfc3339
updated_at: string;
// rfc3339
created_at: string;
}[];
```
#### 获取 Bucket 详情
``` js
const { data } = await op.api.storage.getBucket(params);
```
GET /v1/buckets/{bucket}
##### 参数
``` ts
{
bucket: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
bucket: string;
// 单位byte
data_size: integer;
object_count: integer;
}
```
#### 删除 Bucket
``` js
const { data } = await op.api.storage.deleteBucket(params);
```
DELETE /v1/buckets/{bucket}
##### 参数
``` ts
{
bucket: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 创建 Object
``` js
const { data } = await op.api.storage.saveObject(params);
```
POST /v1/buckets/{bucket}/objects
##### 参数
``` ts
{
bucket: string;
key: string;
value: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
}
```
#### 获取 Object 详情
``` js
const { data } = await op.api.storage.getObject(params);
```
GET /v1/buckets/{bucket}/objects/{key}
##### 参数
``` ts
{
bucket: string;
key: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
bucket: string;
key: string;
value: string;
// rfc3339
updated_at: string;
// rfc3339
created_at: string;
}
```
#### 删除 Object
``` js
const { data } = await op.api.storage.deleteObject(params);
```
DELETE /v1/buckets/{bucket}/objects/{key}
##### 参数
``` ts
{
bucket: string;
key: string;
key_as_prefix?: string;
}
```
##### 响应
- 200 成功
`application/json`
``` ts
{
bucket: string;
key: string;
value: string;
// rfc3339
updated_at: string;
// rfc3339
created_at: string;
}
```