-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathapi_chat_menu_tree_sort.go
135 lines (118 loc) · 9.61 KB
/
api_chat_menu_tree_sort.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
// 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"
)
// SortChatMenuTree 给一个群内的一级菜单排序。
//
// 注意事项:
// - 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。
// - 机器人必须在群里。
// - 操作API后, 将返回群内所有菜单。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/sort
// new doc: https://open.feishu.cn/document/server-docs/group/chat-menu_tree/sort
func (r *ChatService) SortChatMenuTree(ctx context.Context, request *SortChatMenuTreeReq, options ...MethodOptionFunc) (*SortChatMenuTreeResp, *Response, error) {
if r.cli.mock.mockChatSortChatMenuTree != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Chat#SortChatMenuTree mock enable")
return r.cli.mock.mockChatSortChatMenuTree(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Chat",
API: "SortChatMenuTree",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/im/v1/chats/:chat_id/menu_tree/sort",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(sortChatMenuTreeResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockChatSortChatMenuTree mock ChatSortChatMenuTree method
func (r *Mock) MockChatSortChatMenuTree(f func(ctx context.Context, request *SortChatMenuTreeReq, options ...MethodOptionFunc) (*SortChatMenuTreeResp, *Response, error)) {
r.mockChatSortChatMenuTree = f
}
// UnMockChatSortChatMenuTree un-mock ChatSortChatMenuTree method
func (r *Mock) UnMockChatSortChatMenuTree() {
r.mockChatSortChatMenuTree = nil
}
// SortChatMenuTreeReq ...
type SortChatMenuTreeReq struct {
ChatID string `path:"chat_id" json:"-"` // 群ID, 详情参见[群ID 说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-id-description), 注意: 仅支持群模式为`group`的群ID, 示例值: "oc_a0553eda9014c201e6969b478895c230"
ChatMenuTopLevelIDs []string `json:"chat_menu_top_level_ids,omitempty"` // 新的一级菜单的顺序, 进行排序ID列表需要跟群内目前存在的一级菜单ID列表对齐。通过 [获取群菜单](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/get) 接口获取群内菜单详情, 示例值: ["6936075528890826780"]
}
// SortChatMenuTreeResp ...
type SortChatMenuTreeResp struct {
MenuTree *SortChatMenuTreeRespMenuTree `json:"menu_tree,omitempty"` // 排序后群内菜单
}
// SortChatMenuTreeRespMenuTree ...
type SortChatMenuTreeRespMenuTree struct {
ChatMenuTopLevels []*SortChatMenuTreeRespMenuTreeChatMenuTopLevel `json:"chat_menu_top_levels,omitempty"` // 一级菜单列表
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevel ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevel struct {
ChatMenuTopLevelID string `json:"chat_menu_top_level_id,omitempty"` // 一级菜单ID
ChatMenuItem *SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItem `json:"chat_menu_item,omitempty"` // 一级菜单信息
Children []*SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildren `json:"children,omitempty"` // 二级菜单列表
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItem ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItem struct {
ActionType string `json:"action_type,omitempty"` // 菜单类型, 注意, 如果一级菜单有二级菜单时, 则此一级菜单的值必须为NONE, 可选值有: NONE: 无类型, REDIRECT_LINK: 跳转链接类型
RedirectLink *SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItemRedirectLink `json:"redirect_link,omitempty"` // 跳转链接
ImageKey string `json:"image_key,omitempty"` // 图片的key值。通过 [上传图片](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create) 接口上传message类型图片获取image_key, 注意, 如果一级菜单有二级菜单, 则此一级菜单不能有图标。
Name string `json:"name,omitempty"` // 菜单名称, 注意, 一级、二级菜单名称字符数要在1到120范围内
I18nNames *I18nNames `json:"i18n_names,omitempty"` // 菜单国际化名称, 注意, 一级、二级菜单名称字符数要在1到120范围内
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItemRedirectLink ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevelChatMenuItemRedirectLink struct {
CommonURL string `json:"common_url,omitempty"` // 公用跳转链接, 必须以http开头。
IosURL string `json:"ios_url,omitempty"` // IOS端跳转链接, 当该字段不设置时, IOS端会使用common_url。必须以http开头。
AndroidURL string `json:"android_url,omitempty"` // Android端跳转链接, 当该字段不设置时, Android端会使用common_url。必须以http开头。
PcURL string `json:"pc_url,omitempty"` // PC端跳转链接, 当该字段不设置时, PC端会使用common_url。必须以http开头。在PC端点击群菜单后, 如果需要url对应的页面在飞书侧边栏展开, 可以在url前加上https://applink.feishu.cn/client/web_url/open?mode=sidebar-semi&url=, 比如https://applink.feishu.cn/client/web_url/open?mode=sidebar-semi&url=https://open.feishu.cn/
WebURL string `json:"web_url,omitempty"` // Web端跳转链接, 当该字段不设置时, Web端会使用common_url。必须以http开头。
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildren ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildren struct {
ChatMenuSecondLevelID string `json:"chat_menu_second_level_id,omitempty"` // 二级菜单ID
ChatMenuItem *SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItem `json:"chat_menu_item,omitempty"` // 二级菜单信息
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItem ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItem struct {
ActionType string `json:"action_type,omitempty"` // 菜单类型, 注意, 如果一级菜单有二级菜单时, 则此一级菜单的值必须为NONE, 可选值有: NONE: 无类型, REDIRECT_LINK: 跳转链接类型
RedirectLink *SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItemRedirectLink `json:"redirect_link,omitempty"` // 跳转链接
ImageKey string `json:"image_key,omitempty"` // 图片的key值。通过 [上传图片](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create) 接口上传message类型图片获取image_key, 注意, 如果一级菜单有二级菜单, 则此一级菜单不能有图标。
Name string `json:"name,omitempty"` // 菜单名称, 注意, 一级、二级菜单名称字符数要在1到120范围内
I18nNames *I18nNames `json:"i18n_names,omitempty"` // 菜单国际化名称, 注意, 一级、二级菜单名称字符数要在1到120范围内
}
// SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItemRedirectLink ...
type SortChatMenuTreeRespMenuTreeChatMenuTopLevelChildrenChatMenuItemRedirectLink struct {
CommonURL string `json:"common_url,omitempty"` // 公用跳转链接, 必须以http开头。
IosURL string `json:"ios_url,omitempty"` // IOS端跳转链接, 当该字段不设置时, IOS端会使用common_url。必须以http开头。
AndroidURL string `json:"android_url,omitempty"` // Android端跳转链接, 当该字段不设置时, Android端会使用common_url。必须以http开头。
PcURL string `json:"pc_url,omitempty"` // PC端跳转链接, 当该字段不设置时, PC端会使用common_url。必须以http开头。在PC端点击群菜单后, 如果需要url对应的页面在飞书侧边栏展开, 可以在url前加上https://applink.feishu.cn/client/web_url/open?mode=sidebar-semi&url=, 比如https://applink.feishu.cn/client/web_url/open?mode=sidebar-semi&url=https://open.feishu.cn/
WebURL string `json:"web_url,omitempty"` // Web端跳转链接, 当该字段不设置时, Web端会使用common_url。必须以http开头。
}
// sortChatMenuTreeResp ...
type sortChatMenuTreeResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *SortChatMenuTreeResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}