-
Notifications
You must be signed in to change notification settings - Fork 1
/
bookmarks.proto
145 lines (123 loc) · 4.98 KB
/
bookmarks.proto
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
syntax = "proto3";
package bookmarks;
import "google/protobuf/timestamp.proto";
import "items.proto";
// _________________________________________________________
// ||-------------------------------------------------------||
// ||.--. .-._ .----. ||
// |||==|____| |H|___ .---.___|""""|_____.--.___ ||
// ||| |====| | |xxx|_ |+++|=-=|_ _|-=+=-|==|---|||
// |||==| | | | | \ | | |_\/_|Black| | ^ |||
// ||| | | | | |\ \ .--. | |=-=|_/\_|-=+=-| | ^ |||
// ||| | | | | |_\ \_( oo )| | | |Magus| | ^ |||
// |||==|====| |H|xxx| \ \ |''| |+++|=-=|""""|-=+=-|==|---|||
// ||`--^----'-^-^---' `-' "" '---^---^----^-----^--^---^||
// ||-------------------------------------------------------||
// ||-------------------------------------------------------||
// || ___ .-.__.-----. .---.||
// || |===| .---. __ .---| |XX|<(*)>|_|^^^|||
// || , /(| |_|III|__|''|__|:x:|=| | |=| Q |||
// || _a'{ / (|===|+| |++| |==| | | |Illum| | R |||
// || '/\\/ _(|===|-| | |''| |:x:|=| |inati| | Y |||
// ||_____ -\{___(| |-| | | | | | | | | | Z |||
// || _(____)|===|+|[I]|DK|''|==|:x:|=|XX|<(*)>|=|^^^|||
// || `---^-^---^--^--'--^---^-^--^-----^-^---^||
// ||-------------------------------------------------------||
// ||_______________________________________________________||
// Credit: https://www.asciiart.eu/
option go_package = "github.com/overmindtech/sdp-go;sdp";
service BookmarksService {
// ListBookmarks returns all bookmarks of the current user. note that this does not include the actual bookmark data, use GetBookmark for that
rpc ListBookmarks(ListBookmarksRequest) returns (ListBookmarkResponse);
// CreateBookmark creates a new bookmark
rpc CreateBookmark(CreateBookmarkRequest) returns (CreateBookmarkResponse);
// GetBookmark returns the bookmark with the given UUID. This can also return snapshots as bookmarks and will strip the stored items from the response.
rpc GetBookmark(GetBookmarkRequest) returns (GetBookmarkResponse);
rpc UpdateBookmark(UpdateBookmarkRequest) returns (UpdateBookmarkResponse);
rpc DeleteBookmark(DeleteBookmarkRequest) returns (DeleteBookmarkResponse);
// a helper method to find all affected apps for a given blast radius snapshot
rpc GetAffectedBookmarks(GetAffectedBookmarksRequest) returns (GetAffectedBookmarksResponse);
}
///////////////////////////////////////////////////////////////////////////////
// bookmark handling
//
// the gateway can store, retrieve, list and delete bookmarks of queries
///////////////////////////////////////////////////////////////////////////////
// a complete Bookmark with user-supplied and machine-supplied values
message Bookmark {
BookmarkMetadata metadata = 1;
BookmarkProperties properties = 2;
}
// The user-editable parts of a Bookmark
message BookmarkProperties {
// user supplied name of this bookmark
string name = 1;
// user supplied description of this bookmark
string description = 2;
// queries that make up the bookmark
repeated Query queries = 3;
// Items that should be excluded from the bookmark's results
repeated Reference excludedItems = 4;
// Whether this bookmark is a system bookmark. System bookmarks are hidden
// from list results and can therefore only be accessed by their UUID.
// Bookmarks created by users are not system bookmarks.
bool isSystem = 5;
}
// Descriptor for a bookmark
message BookmarkMetadata {
// unique id to identify this bookmark
bytes UUID = 1;
// timestamp when this bookmark was created
google.protobuf.Timestamp created = 2;
}
////////////////////////////
// Requests and Responses //
////////////////////////////
// list all bookmarks
message ListBookmarksRequest {
// TODO: pagination
}
message ListBookmarkResponse {
repeated Bookmark bookmarks = 3;
}
// creates a new bookmark
message CreateBookmarkRequest {
BookmarkProperties properties = 1;
}
message CreateBookmarkResponse {
Bookmark bookmark = 1;
}
// gets a specific bookmark
message GetBookmarkRequest {
bytes UUID = 1;
}
message GetBookmarkResponse {
Bookmark bookmark = 1;
}
// updates an existing bookmark
message UpdateBookmarkRequest {
// unique id to identify this bookmark
bytes UUID = 1;
// new attributes for this bookmark
BookmarkProperties properties = 2;
}
message UpdateBookmarkResponse {
Bookmark bookmark = 3;
}
// Delete the bookmark with the specified ID.
message DeleteBookmarkRequest {
// unique id of the bookmark to delete
bytes UUID = 1;
}
message DeleteBookmarkResponse {
}
message GetAffectedBookmarksRequest {
// the snapshot to consider
bytes snapshotUUID = 1;
// the bookmarks to filter
repeated bytes bookmarkUUIDs = 2;
}
message GetAffectedBookmarksResponse {
// the bookmarks that intersected with the snapshot
repeated bytes bookmarkUUIDs = 1;
}