-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_drive_wiki_space_get.go
94 lines (83 loc) · 3.82 KB
/
api_drive_wiki_space_get.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
85
86
87
88
89
90
91
92
93
94
// 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"
)
// GetWikiSpace 此接口用于根据知识空间ID来查询知识空间的信息。
//
// 空间类型(type):
// - 个人空间: 归个人管理。一人仅可拥有一个个人空间, 无法添加其他管理员。
// - 团队空间: 归团队(多人)管理, 可添加多个管理员。
// 空间可见性(visibility):
// - 公开空间: 租户所有用户可见, 默认为成员权限。无法额外添加成员, 但可以添加管理员。
// - 私有空间: 仅对知识空间管理员、成员可见, 需要手动添加管理员、成员。
// 本接口要求知识库权限:
// - 需要为知识空间成员(管理员)
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/get
// new doc: https://open.feishu.cn/document/server-docs/docs/wiki-v2/space/get
func (r *DriveService) GetWikiSpace(ctx context.Context, request *GetWikiSpaceReq, options ...MethodOptionFunc) (*GetWikiSpaceResp, *Response, error) {
if r.cli.mock.mockDriveGetWikiSpace != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetWikiSpace mock enable")
return r.cli.mock.mockDriveGetWikiSpace(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Drive",
API: "GetWikiSpace",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/wiki/v2/spaces/:space_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getWikiSpaceResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockDriveGetWikiSpace mock DriveGetWikiSpace method
func (r *Mock) MockDriveGetWikiSpace(f func(ctx context.Context, request *GetWikiSpaceReq, options ...MethodOptionFunc) (*GetWikiSpaceResp, *Response, error)) {
r.mockDriveGetWikiSpace = f
}
// UnMockDriveGetWikiSpace un-mock DriveGetWikiSpace method
func (r *Mock) UnMockDriveGetWikiSpace() {
r.mockDriveGetWikiSpace = nil
}
// GetWikiSpaceReq ...
type GetWikiSpaceReq struct {
SpaceID string `path:"space_id" json:"-"` // 知识空间id, 示例值: "6870403571079249922"
}
// GetWikiSpaceResp ...
type GetWikiSpaceResp struct {
Space *GetWikiSpaceRespSpace `json:"space,omitempty"` // 知识空间
}
// GetWikiSpaceRespSpace ...
type GetWikiSpaceRespSpace struct {
Name string `json:"name,omitempty"` // 知识空间名称
Description string `json:"description,omitempty"` // 知识空间描述
SpaceID string `json:"space_id,omitempty"` // 知识空间id
SpaceType string `json:"space_type,omitempty"` // 表示知识空间类型(团队空间 或 个人空间), 可选值有: team: 团队空间, person: 个人空间
Visibility string `json:"visibility,omitempty"` // 表示知识空间可见性(公开空间 或 私有空间), 可选值有: public: 公开空间, private: 私有空间
}
// getWikiSpaceResp ...
type getWikiSpaceResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetWikiSpaceResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}