1@namespace("keybase.1")
2
3protocol favorite {
4  import idl "common.avdl";
5
6  enum FolderType {
7    UNKNOWN_0,
8    PRIVATE_1,
9    PUBLIC_2,
10    TEAM_3
11  }
12
13  enum FolderConflictType {
14    NONE_0,
15    IN_CONFLICT_1,
16    IN_CONFLICT_AND_STUCK_2,
17    CLEARED_CONFLICT_3
18}
19
20  enum ConflictStateType {
21    NormalView_1,
22    ManualResolvingLocalView_2
23  }
24
25  record FolderNormalView {
26    // Set to true if we're trying to automatically resolve conflict in this
27    // folder. Whether or not there's a local view version of this TLF doesn't
28    // affect this.
29    boolean resolvingConflict;
30    // Set to true if we tried to automatically resolve conflict in this folder
31    // and failed. Whether or not there's a local view version of this TLF
32    // doesn't affect this.
33    boolean stuckInConflict;
34    array<Path> localViews;
35  }
36
37  record FolderConflictManualResolvingLocalView {
38    Path normalView;
39  }
40
41  variant ConflictState switch (ConflictStateType conflictStateType) {
42    case NormalView: FolderNormalView;
43    case ManualResolvingLocalView: FolderConflictManualResolvingLocalView;
44  }
45
46  /**
47    Folder represents a favorite top-level folder in kbfs.
48    This type is likely to change significantly as all the various parts are
49    connected and tested.
50    */
51  record Folder {
52    string name;              // patrick,max or chris,maxtaco@twitter#strib
53    boolean private;          // (DEPRECATED) in /keybase/private or /keybase/public?
54    boolean created;          // this folder was just created by this user
55    FolderType folderType;    // what type of folder is this?
56
57    // supply the team ID of the underlying team if known. optional so that
58    // the frontend doesn't need to be changed to support it.
59    @jsonkey("team_id") @mpackkey("team_id")
60    union { null, TeamID } teamID;
61
62    // TODO: decide if we need to include an ID here
63
64    @jsonkey("reset_members") @mpackkey("reset_members")
65    array<User> resetMembers;
66
67    union { null, Time } mtime;
68
69    union { null, ConflictState } conflictState;
70
71    union { null, FolderSyncConfig } syncConfig; // only set in some simplefs RPC responses
72  }
73
74  // FolderHandle identifies a Folder/Tlf.
75  record FolderHandle {
76    string name;
77    FolderType folderType;
78    boolean created;          // this folder was just created by this user
79  }
80
81  // Each of your TLFs is in one of 3 states with respect to favoriting. Either
82  // you've favorited it, or you've ignored it, or you haven't done either of
83  // those things yet ("new"). The favorite/list endpoint returns 3 lists,
84  // representing all the TLFs you have in each of those 3 states, and we
85  // marshall that result into this struct.
86  record FavoritesResult {
87    array<Folder> favoriteFolders;
88    array<Folder> ignoredFolders;
89    array<Folder> newFolders;
90  }
91
92  /**
93    Adds a folder to a user's list of favorite folders.
94    */
95  void favoriteAdd(int sessionID, FolderHandle folder);
96
97  /**
98    Removes a folder from a user's list of favorite folders.
99    */
100  void favoriteIgnore(int sessionID, FolderHandle folder);
101
102  /**
103    Returns all of a user's favorite folders.
104    */
105  FavoritesResult getFavorites(int sessionID);
106}
107