-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_baike_entity_update.go
286 lines (246 loc) · 18 KB
/
api_baike_entity_update.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// 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"
)
// UpdateBaikeEntity 通过此接口更新已有的词条, 无需经过词典管理员审核, 直接写入词库。
//
// 因此, 调用该接口时应当慎重操作。
// 为了更好地提升接口文档的的易理解性, 我们对文档进行了升级, 请尽快迁移至[新版本>>](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/lingo-v1/entity/update)
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/entity/update
// new doc: https://open.feishu.cn/document/server-docs/baike-v1/entity/update
//
// Deprecated
func (r *BaikeService) UpdateBaikeEntity(ctx context.Context, request *UpdateBaikeEntityReq, options ...MethodOptionFunc) (*UpdateBaikeEntityResp, *Response, error) {
if r.cli.mock.mockBaikeUpdateBaikeEntity != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Baike#UpdateBaikeEntity mock enable")
return r.cli.mock.mockBaikeUpdateBaikeEntity(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Baike",
API: "UpdateBaikeEntity",
Method: "PUT",
URL: r.cli.openBaseURL + "/open-apis/baike/v1/entities/:entity_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(updateBaikeEntityResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockBaikeUpdateBaikeEntity mock BaikeUpdateBaikeEntity method
func (r *Mock) MockBaikeUpdateBaikeEntity(f func(ctx context.Context, request *UpdateBaikeEntityReq, options ...MethodOptionFunc) (*UpdateBaikeEntityResp, *Response, error)) {
r.mockBaikeUpdateBaikeEntity = f
}
// UnMockBaikeUpdateBaikeEntity un-mock BaikeUpdateBaikeEntity method
func (r *Mock) UnMockBaikeUpdateBaikeEntity() {
r.mockBaikeUpdateBaikeEntity = nil
}
// UpdateBaikeEntityReq ...
type UpdateBaikeEntityReq struct {
EntityID string `path:"entity_id" json:"-"` // 实体词 ID, 示例值: "enterprise_40217521"
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值: open_id, 可选值有: open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。[了解更多: 如何获取 Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid), union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的, 在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID, 应用开发商可以把同个用户在多个应用中的身份关联起来。[了解更多: 如何获取 Union ID?](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id), user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内, 一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。[了解更多: 如何获取 User ID?](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id), 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
MainKeys []*UpdateBaikeEntityReqMainKey `json:"main_keys,omitempty"` // 词条名, 最大长度: `1`
Aliases []*UpdateBaikeEntityReqAliase `json:"aliases,omitempty"` // 别名, 最大长度: `10`
Description *string `json:"description,omitempty"` // 纯文本格式词条释义。注: description 和 rich_text 至少有一个, 否则会报错: 1540001, 示例值: "词典是飞书提供的一款知识管理工具, 通过飞书词典可以帮助企业将分散的知识信息进行聚合, 并通过UGC的方式, 促进企业知识的保鲜和流通", 最大长度: `5000` 字符
RelatedMeta *UpdateBaikeEntityReqRelatedMeta `json:"related_meta,omitempty"` // 更多相关信息
OuterInfo *UpdateBaikeEntityReqOuterInfo `json:"outer_info,omitempty"` // 外部系统关联数据
RichText *string `json:"rich_text,omitempty"` // 富文本格式(当填写富文本内容时, description字段将会失效可不填写), 支持的格式参考[飞书词典指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/overview)中的释义部分, 示例值: "<b>加粗</b><i>斜体</i><p><a href=\"https://feishu.cn\">链接</a></p><p><span>词典是飞书提供的一款知识管理工具, 通过飞书词典可以帮助企业将分散的知识信息进行聚合, 并通过UGC的方式, 促进企业知识的保鲜和流通</span></p>", 最大长度: `5000` 字符
}
// UpdateBaikeEntityReqAliase ...
type UpdateBaikeEntityReqAliase struct {
Key string `json:"key,omitempty"` // 名称的值, 示例值: "飞书词典"
DisplayStatus *UpdateBaikeEntityReqAliaseDisplayStatus `json:"display_status,omitempty"` // 名称展示范围
}
// UpdateBaikeEntityReqAliaseDisplayStatus ...
type UpdateBaikeEntityReqAliaseDisplayStatus struct {
AllowHighlight bool `json:"allow_highlight,omitempty"` // 对应名称是否在消息/云文档高亮, 示例值: true
AllowSearch bool `json:"allow_search,omitempty"` // 对应名称是否在搜索结果中展示, 示例值: true
}
// UpdateBaikeEntityReqMainKey ...
type UpdateBaikeEntityReqMainKey struct {
Key string `json:"key,omitempty"` // 名称的值, 示例值: "飞书词典"
DisplayStatus *UpdateBaikeEntityReqMainKeyDisplayStatus `json:"display_status,omitempty"` // 名称展示范围
}
// UpdateBaikeEntityReqMainKeyDisplayStatus ...
type UpdateBaikeEntityReqMainKeyDisplayStatus struct {
AllowHighlight bool `json:"allow_highlight,omitempty"` // 对应名称是否在消息/云文档高亮, 示例值: true
AllowSearch bool `json:"allow_search,omitempty"` // 对应名称是否在搜索结果中展示, 示例值: true
}
// UpdateBaikeEntityReqOuterInfo ...
type UpdateBaikeEntityReqOuterInfo struct {
Provider string `json:"provider,omitempty"` // 外部系统(不能包含中横线 "-"), 示例值: "星云", 长度范围: `2` ~ `32` 字符
OuterID string `json:"outer_id,omitempty"` // 词条在外部系统中对应的唯一 ID(不能包含中横线 "-"), 示例值: "client_653267498d", 长度范围: `1` ~ `64` 字符
}
// UpdateBaikeEntityReqRelatedMeta ...
type UpdateBaikeEntityReqRelatedMeta struct {
Users []*UpdateBaikeEntityReqRelatedMetaUser `json:"users,omitempty"` // 相关联系人
Chats []*UpdateBaikeEntityReqRelatedMetaChat `json:"chats,omitempty"` // 相关服务中的相关公开群
Docs []*UpdateBaikeEntityReqRelatedMetaDoc `json:"docs,omitempty"` // 相关云文档
Oncalls []*UpdateBaikeEntityReqRelatedMetaOncall `json:"oncalls,omitempty"` // 相关服务中的相关值班号
Links []*UpdateBaikeEntityReqRelatedMetaLink `json:"links,omitempty"` // 相关链接
Abbreviations []*UpdateBaikeEntityReqRelatedMetaAbbreviation `json:"abbreviations,omitempty"` // 相关词条
Classifications []*UpdateBaikeEntityReqRelatedMetaClassification `json:"classifications,omitempty"` // 当前词条所属分类, 词条只能属于二级分类, 且每个一级分类下只能选择一个二级分类。
Images []*UpdateBaikeEntityReqRelatedMetaImage `json:"images,omitempty"` // 上传的图片, 最大长度: `10`
}
// UpdateBaikeEntityReqRelatedMetaAbbreviation ...
type UpdateBaikeEntityReqRelatedMetaAbbreviation struct {
ID *string `json:"id,omitempty"` // 相关词条 ID, 示例值: "enterprise_51527260"
}
// UpdateBaikeEntityReqRelatedMetaChat ...
type UpdateBaikeEntityReqRelatedMetaChat struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID, 示例值: "格式请看请求体示例"
}
// UpdateBaikeEntityReqRelatedMetaClassification ...
type UpdateBaikeEntityReqRelatedMetaClassification struct {
ID string `json:"id,omitempty"` // 二级分类 ID, 示例值: "704960692637761"
FatherID *string `json:"father_id,omitempty"` // 对应一级分类 ID, 示例值: "704960692637777"
}
// UpdateBaikeEntityReqRelatedMetaDoc ...
type UpdateBaikeEntityReqRelatedMetaDoc struct {
Title *string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题, 示例值: "飞书词典帮助中心"
URL *string `json:"url,omitempty"` // 链接地址, 示例值: "https://www.feishu.cn/hc/zh-CN", 正则校验: `(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:.;]+[-A-Za-z0-9+&@#/%=~_|]`
}
// UpdateBaikeEntityReqRelatedMetaImage ...
type UpdateBaikeEntityReqRelatedMetaImage struct {
Token string `json:"token,omitempty"` // 通过文件接口上传图片后, 获得的图片 token, 示例值: "boxbcEcmKiDia3evgqWTpvdc7jc"
}
// UpdateBaikeEntityReqRelatedMetaLink ...
type UpdateBaikeEntityReqRelatedMetaLink struct {
Title *string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题, 示例值: "飞书词典帮助中心"
URL *string `json:"url,omitempty"` // 链接地址, 示例值: "https://www.feishu.cn/hc/zh-CN", 正则校验: `(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:.;]+[-A-Za-z0-9+&@#/%=~_|]`
}
// UpdateBaikeEntityReqRelatedMetaOncall ...
type UpdateBaikeEntityReqRelatedMetaOncall struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID, 示例值: "格式请看请求体示例"
}
// UpdateBaikeEntityReqRelatedMetaUser ...
type UpdateBaikeEntityReqRelatedMetaUser struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID, 示例值: "格式请看请求体示例"
Title *string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题, 示例值: "飞书词典帮助中心"
}
// UpdateBaikeEntityResp ...
type UpdateBaikeEntityResp struct {
Entity *UpdateBaikeEntityRespEntity `json:"entity,omitempty"` // 词条信息
}
// UpdateBaikeEntityRespEntity ...
type UpdateBaikeEntityRespEntity struct {
ID string `json:"id,omitempty"` // 词条 ID (需要更新某个词条时填写, 若是创建新词条可不填写)
MainKeys []*UpdateBaikeEntityRespEntityMainKey `json:"main_keys,omitempty"` // 词条名
Aliases []*UpdateBaikeEntityRespEntityAliase `json:"aliases,omitempty"` // 别名
Description string `json:"description,omitempty"` // 纯文本格式词条释义。注: description 和 rich_text 至少有一个, 否则会报错: 1540001
CreateTime string `json:"create_time,omitempty"` // 词条创建时间
UpdateTime string `json:"update_time,omitempty"` // 词条最近更新时间
RelatedMeta *UpdateBaikeEntityRespEntityRelatedMeta `json:"related_meta,omitempty"` // 更多相关信息
Statistics *UpdateBaikeEntityRespEntityStatistics `json:"statistics,omitempty"` // 当前词条收到的反馈数据
OuterInfo *UpdateBaikeEntityRespEntityOuterInfo `json:"outer_info,omitempty"` // 外部系统关联数据
RichText string `json:"rich_text,omitempty"` // 富文本格式(当填写富文本内容时, description字段将会失效可不填写), 支持的格式参考[飞书词典指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/overview)中的释义部分
}
// UpdateBaikeEntityRespEntityAliase ...
type UpdateBaikeEntityRespEntityAliase struct {
Key string `json:"key,omitempty"` // 名称的值
DisplayStatus *UpdateBaikeEntityRespEntityAliaseDisplayStatus `json:"display_status,omitempty"` // 名称展示范围
}
// UpdateBaikeEntityRespEntityAliaseDisplayStatus ...
type UpdateBaikeEntityRespEntityAliaseDisplayStatus struct {
AllowHighlight bool `json:"allow_highlight,omitempty"` // 对应名称是否在消息/云文档高亮
AllowSearch bool `json:"allow_search,omitempty"` // 对应名称是否在搜索结果中展示
}
// UpdateBaikeEntityRespEntityMainKey ...
type UpdateBaikeEntityRespEntityMainKey struct {
Key string `json:"key,omitempty"` // 名称的值
DisplayStatus *UpdateBaikeEntityRespEntityMainKeyDisplayStatus `json:"display_status,omitempty"` // 名称展示范围
}
// UpdateBaikeEntityRespEntityMainKeyDisplayStatus ...
type UpdateBaikeEntityRespEntityMainKeyDisplayStatus struct {
AllowHighlight bool `json:"allow_highlight,omitempty"` // 对应名称是否在消息/云文档高亮
AllowSearch bool `json:"allow_search,omitempty"` // 对应名称是否在搜索结果中展示
}
// UpdateBaikeEntityRespEntityOuterInfo ...
type UpdateBaikeEntityRespEntityOuterInfo struct {
Provider string `json:"provider,omitempty"` // 外部系统(不能包含中横线 "-")
OuterID string `json:"outer_id,omitempty"` // 词条在外部系统中对应的唯一 ID(不能包含中横线 "-")
}
// UpdateBaikeEntityRespEntityRelatedMeta ...
type UpdateBaikeEntityRespEntityRelatedMeta struct {
Users []*UpdateBaikeEntityRespEntityRelatedMetaUser `json:"users,omitempty"` // 相关联系人
Chats []*UpdateBaikeEntityRespEntityRelatedMetaChat `json:"chats,omitempty"` // 相关服务中的相关公开群
Docs []*UpdateBaikeEntityRespEntityRelatedMetaDoc `json:"docs,omitempty"` // 相关云文档
Oncalls []*UpdateBaikeEntityRespEntityRelatedMetaOncall `json:"oncalls,omitempty"` // 相关服务中的相关值班号
Links []*UpdateBaikeEntityRespEntityRelatedMetaLink `json:"links,omitempty"` // 相关链接
Abbreviations []*UpdateBaikeEntityRespEntityRelatedMetaAbbreviation `json:"abbreviations,omitempty"` // 相关词条
Classifications []*UpdateBaikeEntityRespEntityRelatedMetaClassification `json:"classifications,omitempty"` // 当前词条所属分类, 词条只能属于二级分类, 且每个一级分类下只能选择一个二级分类。
Images []*UpdateBaikeEntityRespEntityRelatedMetaImage `json:"images,omitempty"` // 上传的图片
}
// UpdateBaikeEntityRespEntityRelatedMetaAbbreviation ...
type UpdateBaikeEntityRespEntityRelatedMetaAbbreviation struct {
ID string `json:"id,omitempty"` // 相关词条 ID
}
// UpdateBaikeEntityRespEntityRelatedMetaChat ...
type UpdateBaikeEntityRespEntityRelatedMetaChat struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID
Title string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题
URL string `json:"url,omitempty"` // 链接地址
}
// UpdateBaikeEntityRespEntityRelatedMetaClassification ...
type UpdateBaikeEntityRespEntityRelatedMetaClassification struct {
ID string `json:"id,omitempty"` // 二级分类 ID
Name string `json:"name,omitempty"` // 二级分类名称
FatherID string `json:"father_id,omitempty"` // 对应一级分类 ID
}
// UpdateBaikeEntityRespEntityRelatedMetaDoc ...
type UpdateBaikeEntityRespEntityRelatedMetaDoc struct {
Title string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题
URL string `json:"url,omitempty"` // 链接地址
}
// UpdateBaikeEntityRespEntityRelatedMetaImage ...
type UpdateBaikeEntityRespEntityRelatedMetaImage struct {
Token string `json:"token,omitempty"` // 通过文件接口上传图片后, 获得的图片 token
}
// UpdateBaikeEntityRespEntityRelatedMetaLink ...
type UpdateBaikeEntityRespEntityRelatedMetaLink struct {
Title string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题
URL string `json:"url,omitempty"` // 链接地址
}
// UpdateBaikeEntityRespEntityRelatedMetaOncall ...
type UpdateBaikeEntityRespEntityRelatedMetaOncall struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID
Title string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题
URL string `json:"url,omitempty"` // 链接地址
}
// UpdateBaikeEntityRespEntityRelatedMetaUser ...
type UpdateBaikeEntityRespEntityRelatedMetaUser struct {
ID string `json:"id,omitempty"` // 对应相关信息 ID
Title string `json:"title,omitempty"` // 对应相关信息的描述, 如相关联系人的描述、相关链接的标题
URL string `json:"url,omitempty"` // 链接地址
}
// UpdateBaikeEntityRespEntityStatistics ...
type UpdateBaikeEntityRespEntityStatistics struct {
LikeCount int64 `json:"like_count,omitempty"` // 累计点赞
DislikeCount int64 `json:"dislike_count,omitempty"` // 当前词条版本收到的负反馈数量
}
// updateBaikeEntityResp ...
type updateBaikeEntityResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *UpdateBaikeEntityResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}