-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_drive_folder_create.go
83 lines (73 loc) · 3.81 KB
/
api_drive_folder_create.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
// 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"
)
// CreateDriveFolder 该接口用于在用户云空间指定文件夹中创建一个空文件夹。
//
// 使用限制:
// - 该接口不支持并发创建, 且调用频率上限为 5QPS 以及 10000次/天。否则会返回 1061045 错误码, 可通过稍后重试解决。
// - 云空间中根目录或文件夹的单层节点上限为 1500 个。超过此限制时, 接口将返回 1062507 错误码。可通过新建节点到其它节点中解决。
// - 云空间中所有层级的节点总和的上限为 40 万个。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/create_folder
// new doc: https://open.feishu.cn/document/server-docs/docs/drive-v1/folder/create_folder
func (r *DriveService) CreateDriveFolder(ctx context.Context, request *CreateDriveFolderReq, options ...MethodOptionFunc) (*CreateDriveFolderResp, *Response, error) {
if r.cli.mock.mockDriveCreateDriveFolder != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#CreateDriveFolder mock enable")
return r.cli.mock.mockDriveCreateDriveFolder(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Drive",
API: "CreateDriveFolder",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/drive/v1/files/create_folder",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(createDriveFolderResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockDriveCreateDriveFolder mock DriveCreateDriveFolder method
func (r *Mock) MockDriveCreateDriveFolder(f func(ctx context.Context, request *CreateDriveFolderReq, options ...MethodOptionFunc) (*CreateDriveFolderResp, *Response, error)) {
r.mockDriveCreateDriveFolder = f
}
// UnMockDriveCreateDriveFolder un-mock DriveCreateDriveFolder method
func (r *Mock) UnMockDriveCreateDriveFolder() {
r.mockDriveCreateDriveFolder = nil
}
// CreateDriveFolderReq ...
type CreateDriveFolderReq struct {
Name string `json:"name,omitempty"` // 文件夹名称, 示例值: "产品优化项目"
FolderToken string `json:"folder_token,omitempty"` // 父文件夹的 token。该参数非必填。参数为空时, 表示在根目录下创建文件夹。你可参考[获取文件夹中的文件清单](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file/list)获取某个文件夹的 token。了解更多, 参考[文件夹概述](https://open.feishu.cn/document/ukTMukTMukTM/ugTNzUjL4UzM14CO1MTN/folder-overview), 示例值: "fldbcO1UuPz8VwnpPx5a92abcef"
}
// CreateDriveFolderResp ...
type CreateDriveFolderResp struct {
Token string `json:"token,omitempty"` // 新建的文件夹的 token
URL string `json:"url,omitempty"` // 新建的文件夹的 URL 链接
}
// createDriveFolderResp ...
type createDriveFolderResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *CreateDriveFolderResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}