全部產品
Search
文件中心

Drive and Photo Service:分組和成員

更新時間:Dec 22, 2025

本篇介紹分組和成員相關方法。

說明

請求參數中的 options: IPDSRequestConfig 基於 axios 的 request config 封裝,詳情請看:AxiosRequestConfig

createGroup 方法

重要

需要Admin許可權,或者分組管理員。

建立分組。

const result = await client.createGroup(params, options)

舉例

await client.createGroup({
  group_name: 'test',
  description: '',
  is_root: true
})

參數

欄位

類型

必選

說明

params

ICreatGroupReq

團隊名

options

IPDSRequestConfig

請求參數

ICreatGroupReq

欄位

類型

必選

說明

group_name

string

團隊名

description

string

團隊描述

is_root

boolean

是否root

parent_group_id

string

父group 與is_root互斥

返回

欄位

類型

必選

說明

result

IGroupItem

結果

IGroupItem

名稱

位置

必選

說明

domain_id

string

域id

group_id

string

團隊id

group_name

string

團隊名

description

string

團隊描述

created_at

number

建立時間

updated_at

number

更新時間

deleteGroup 方法

重要

需要Admin許可權,或者分組管理員

刪除group。

await client.deleteGroup(params, options)

舉例

await client.deleteGroup({
   group_id: '0cbfe8de7d7645ea835b1b1a91101e4d'
})

參數

欄位

類型

必選

說明

params

Object

請求參數

options

IPDSRequestConfig

請求參數

params

欄位

類型

必選

說明

group_id

string

團隊id

返回

updateGroup 方法

重要

需要Admin許可權,或者分組管理員

更新group。

await client.updateGroup(params, options)

舉例

await client.updateGroup({
   group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
    group_name: 'new_name',
   description: 'test'
})

參數

欄位

類型

必選

說明

params

IUpdateGroupReq

請求參數

options

IPDSRequestConfig

請求參數

IUpdateGroupReq

欄位

類型

必選

說明

group_id

string

團隊id

group_name

string

團隊名稱

description

string

是否root

返回

欄位

類型

必選

說明

result

IGroupItem

結果

getGroup 方法

擷取group資訊。

const result = await client.getGroup(params, options)

舉例

const groupInfo = await client.getGroup({
   group_id: '0cbfe8de7d7645ea835b1b1a91101e4d'
})

參數

欄位

類型

必選

說明

params

Object

請求參數

options

IPDSRequestConfig

請求參數

params

名稱

類型

必選

說明

group_id

string

群id

返回

欄位

類型

必選

說明

result

IGroupItem

結果

listGroups 方法

擷取group資訊

await client.listGroups(params, options)

舉例

await client.listGroups({
   limit: 100,
   marker:''
})

參數

欄位

類型

必選

說明

params

IListReq

請求參數

options

IPDSRequestConfig

請求參數

IListReq

名稱

類型

必選

說明

limit

number

返回資料最大條數,範圍:[1-100],預設:100

marker

string

查詢起始標識

返回

欄位

類型

必選

說明

result

IListRes

結果

IListRes

名稱

位置

必選

說明

items

IGroupItem[]

團隊列表

next_marker

string

下一次查詢的起始標識

searchGroups 方法

搜尋group 結果預設按照updated_at降序輸出。

await client.searchGroups(params, options)
const {items=[]} = await client.listGroups({
   limit: 100,
   marker:'',
   group_name: 'test_group_name'
})

參數

欄位

類型

必選

說明

params

Object

請求參數

options

IPDSRequestConfig

請求參數

params

名稱

類型

必選

說明

limit

number

返回資料最大條數,範圍:[1-100],預設:100

marker

string

查詢起始標識

group_name

string

團隊名稱

返回

欄位

類型

必選

說明

result

IListRes

結果

IListRes

名稱

類型

必選

說明

items

IGroupItem[]

團隊列表

next_marker

string

下一次查詢的起始標識

listGroupMembers 方法

重要

需要Admin許可權,或者分組管理員

列舉一個 group 下的所有子 group或user。

await client.listGroupMembers(params, options)

舉例

await client.listGroupMembers({
   limit: 100,
   marker:'',
   group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
   member_type: 'group'
})

參數

欄位

類型

必選

說明

params

Object

請求參數

options

IPDSRequestConfig

請求參數

params

名稱

類型

必選

說明

limit

number

返回資料最大條數,範圍:[1-100],預設:100

marker

string

查詢起始標識

group_id

string

團隊id

member_type

string

成員類型。取值範圍: 'user' | 'group'

返回

欄位

類型

必選

說明

result

IListGroupMembersRes

結果

IListGroupMembersRes

名稱

類型

說明

user_items

IUserItem[]

使用者列表

group_items

IGroupItem[]

團隊列表

next_marker

string

下一次查詢的起始標識

addGroupMember 方法

重要

需要Admin許可權,或者分組管理員

添加使用者到Group。

const result = await client.addGroupMember(params, options)

舉例

await client.addGroupMember({
  member_id: 'test',
  member_type: 'user', 
  group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
})

參數

欄位

類型

必選

說明

params

IAddGroupMemberReq

請求參數

options

IPDSRequestConfig

請求參數

IAddGroupMemberReq

欄位

類型

必選

說明

group_id

string

群id

member_id

string

使用者id

member_type

string

群成員類型:

1、user:子使用者

這裡僅支援 user,如果要添加 group 請用 createGroup 方法。

返回

removeGroupMember 方法

重要

需要Admin許可權,或者分組管理員

從Group中刪除成員。

await client.removeGroupMember(params, options)

舉例

await client.removeGroupMember({
  member_id: 'test',
  member_type: 'user',
  group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
})

參數

欄位

類型

必選

說明

params

IRemoveGroupMemberReq

請求參數

options

IPDSRequestConfig

請求參數

IRemoveGroupMemberReq

欄位

類型

必選

說明

group_id

string

群id

member_id

string

使用者id

member_type

string

成員類型,當前只能移除使用者,群組移除可以通過刪除群組完成。

  • user

返回