-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_drive_permission_owner_transfer.go
84 lines (74 loc) · 4.73 KB
/
api_drive_permission_owner_transfer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// TransferDriveOwnerPermission 该接口用于根据云文档 token 和用户信息转移文件的所有者。
//
// 个人文件夹下的文件转移所有者完成后, 默认会移动到新所有者的空间下
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/permission-member/transfer_owner
// new doc: https://open.feishu.cn/document/server-docs/docs/permission/permission-member/transfer_owner
func (r *DriveService) TransferDriveOwnerPermission(ctx context.Context, request *TransferDriveOwnerPermissionReq, options ...MethodOptionFunc) (*TransferDriveOwnerPermissionResp, *Response, error) {
if r.cli.mock.mockDriveTransferDriveOwnerPermission != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#TransferDriveOwnerPermission mock enable")
return r.cli.mock.mockDriveTransferDriveOwnerPermission(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Drive",
API: "TransferDriveOwnerPermission",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/drive/v1/permissions/:token/members/transfer_owner",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(transferDriveOwnerPermissionResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockDriveTransferDriveOwnerPermission mock DriveTransferDriveOwnerPermission method
func (r *Mock) MockDriveTransferDriveOwnerPermission(f func(ctx context.Context, request *TransferDriveOwnerPermissionReq, options ...MethodOptionFunc) (*TransferDriveOwnerPermissionResp, *Response, error)) {
r.mockDriveTransferDriveOwnerPermission = f
}
// UnMockDriveTransferDriveOwnerPermission un-mock DriveTransferDriveOwnerPermission method
func (r *Mock) UnMockDriveTransferDriveOwnerPermission() {
r.mockDriveTransferDriveOwnerPermission = nil
}
// TransferDriveOwnerPermissionReq ...
type TransferDriveOwnerPermissionReq struct {
Token string `path:"token" json:"-"` // 文件的 token, 示例值: "doccnBKgoMyY5OMbUG6FioTXuBe"
Type string `query:"type" json:"-"` // 文件类型, 需要与文件的 token 相匹配, 示例值: doc, 可选值有: doc: 文档, sheet: 电子表格, file: 云空间文件, wiki: 知识库节点, bitable: 多维表格, docx: 新版文档, mindnote: 思维笔记, minutes: 妙记, slides: 幻灯片
NeedNotification *bool `query:"need_notification" json:"-"` // 是否需要通知新的文件所有者, 示例值: true, 默认值: `true`
RemoveOldOwner *bool `query:"remove_old_owner" json:"-"` // 转移后是否需要移除原文件所有者的权限, 示例值: false, 默认值: `false`
StayPut *bool `query:"stay_put" json:"-"` // 仅当文件在个人文件夹下, 此参数才会生效。如果设为`false`, 系统会将该内容移至新所有者的空间下。如果设为`true`, 则留在原位置, 示例值: false, 默认值: `false`
OldOwnerPerm *string `query:"old_owner_perm" json:"-"` // 仅当 remove_old_owner = false 时, 此参数才会生效 保留原文件所有者指定的权限角色, 示例值: view, 默认值: `full_access`
MemberType string `json:"member_type,omitempty"` // 文件所有者的 ID 类型, 示例值: "openid", 可选值有: email: 飞书邮箱, openid: 开放平台ID, userid: 用户自定义ID
MemberID string `json:"member_id,omitempty"` // 文件所有者的 ID, 与文件所有者的 ID 类型需要对应, 示例值: "ou_67e5ecb64ce1c0bd94612c17999db411"
}
// TransferDriveOwnerPermissionResp ...
type TransferDriveOwnerPermissionResp struct {
}
// transferDriveOwnerPermissionResp ...
type transferDriveOwnerPermissionResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *TransferDriveOwnerPermissionResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}