-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp_folders.go
More file actions
47 lines (40 loc) · 1.26 KB
/
app_folders.go
File metadata and controls
47 lines (40 loc) · 1.26 KB
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
package main
// CreateFolder создаёт новую папку.
func (a *App) CreateFolder(name, icon string) error {
return a.core.CreateFolder(name, icon)
}
// GetFolders возвращает список папок.
func (a *App) GetFolders() ([]*FolderInfo, error) {
coreFolders, err := a.core.GetFolders()
if err != nil {
return nil, err
}
result := make([]*FolderInfo, len(coreFolders))
for i, f := range coreFolders {
result[i] = &FolderInfo{
ID: f.ID,
Name: f.Name,
Icon: f.Icon,
ChatIDs: f.ChatIDs,
Position: f.Position,
UnreadCount: f.UnreadCount,
}
}
return result, nil
}
// UpdateFolder обновляет папку.
func (a *App) UpdateFolder(id, name, icon string) error {
return a.core.UpdateFolder(id, name, icon)
}
// DeleteFolder удаляет папку.
func (a *App) DeleteFolder(id string) error {
return a.core.DeleteFolder(id)
}
// AddChatToFolder добавляет чат в папку.
func (a *App) AddChatToFolder(folderID, chatID string) error {
return a.core.AddChatToFolder(folderID, chatID)
}
// RemoveChatFromFolder удаляет чат из папки.
func (a *App) RemoveChatFromFolder(folderID, chatID string) error {
return a.core.RemoveChatFromFolder(folderID, chatID)
}