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
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Sync protocol datatype extension for push notifications..
// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
// any fields in this file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
option retain_unknown_fields = true;
package sync_pb;
import "synced_notification_render.proto";
// This message allows clients to identify a notification they have created.
message SyncedNotificationIdentifier {
// The application that the notification is a part of.
optional string app_id = 1;
// Notifications with the same coalescing key (isolated to the same app_id)
// will be grouped together when fetched.
optional string coalescing_key = 2;
}
message SyncedNotificationCreator {
// The gaia id of the creator. If a notification does not have a clear
// creator, skip this and follow the directions below to use a system creator.
optional int64 gaia_id = 1;
// Indicates that the creator is a "system" creator. Example of these are
// notifications sent to the user where the addressee is "Google", such as the
// "You have violated our TOS, and have 3 days to fix it or you'll lose your
// account" notifications. If is_system is set, gaia_id must not be set and
// instead the app_id field must be set.
optional bool is_system = 2;
// Only set this in the system-creator case.
optional string app_id = 3;
}
message SyncedNotificationRecipients {
repeated int64 gaia_id = 1;
// For now, only support gaia id recipients. Add more recipient types via
// 'repeated Type other_type = X' when necessary.
}
message SyncedNotification {
// A secondary type that is isolated within the same app_id.
//
// NOTE: For ASBE support purposes this must be in the format [A-Za-z_]+.
optional string type = 1;
// Whatever string the client entered during creation. If no external_id is
// specified, the notification can no longer be identified individually for
// fetching/deleting, etc...
optional string external_id = 2;
// The creator of the notification.
optional SyncedNotificationCreator creator = 3;
// Client specific data.
optional MapData client_data = 4;
}
message CoalescedSyncedNotification {
// An opaque string key used to identify individual coalesced notifications.
optional string key = 1;
optional string app_id = 2;
// All the notifications that are grouped together.
repeated SyncedNotification notification = 3;
// Data that is used directly by endpoints to render notifications in the case
// where no "native" app can handle the notification.
optional SyncedNotificationRenderInfo render_info = 4;
// Read state will be per coalesced notification.
enum ReadState {
UNREAD = 1;
READ = 2;
DISMISSED = 3;
SEEN = 4;
}
optional ReadState read_state = 5;
// The time when the LATEST notification of the coalesced notification is
// created (in milliseconds since the linux epoch).
// This is called updated_version in the server side protobuf.
optional uint64 creation_time_msec = 6;
enum Priority {
INVISIBLE = 1;
LOW = 2;
HIGH = 3;
// We will most likely add at least one more priority in the near future.
};
optional Priority priority = 7;
// Security token that is to be used when making a PerformUserAction request
// when any user action within this coalesced notification is triggered.
optional string user_action_token = 8;
// This field corresponds to catchup_version in entity, which represents the
// version entity was last modified. Note that the
// Entity.last_modified_version will be actually the last creation version.
// See comments in updated_version.
optional uint64 last_modified_version = 9;
// Clients should use this field to order the notifications. Currently this is
// calculated from (priority, updated_version) pair.
optional uint64 sort_version = 10;
}
message SyncedNotificationList {
repeated CoalescedSyncedNotification coalesced_notification = 1;
}
// MapData, Data, and ListData are used to sending aribitrary payloads
// between instances of applications using Synced Notifications. The
// schema atop MapData will be defined by the client application.
message MapData {
message Entry {
optional string key = 1;
optional Data value = 2;
};
repeated Entry entry = 1;
};
message Data {
optional bool boolean_value = 1;
optional int32 int_value = 2;
optional double float_value = 3;
optional string string_value = 4;
optional ListData list_value = 5;
optional MapData map_value = 6;
};
message ListData {
repeated Data value = 1;
};
// The RenderContext encapsulates data about the device that is displaying the
// notification. In the future, RenderContext might include data like the
// location of the user.
message RenderContext {
// The type of the device. This will be used to decide the resolution as well
// as the size of the image returned with the response.
// The server will try to find the closest matching resource to use.
// The android densities are from
// http://developer.android.com/guide/practices/screens_support.html
enum DeviceType {
UNKNOWN = 0;
IOS_NON_RETINA = 1;
IOS_RETINA = 2;
ANDROID_MDPI = 3;
ANDROID_HDPI = 4;
ANDROID_XHDPI = 5;
ANDROID_TVDPI = 6;
DESKTOP_NON_RETINA = 7;
DESKTOP_RETINA = 8;
ANDROID_XXHDPI = 9;
CHROME_1X = 10;
CHROME_2X = 11;
}
optional DeviceType device_type = 1;
// The locale to render the notifications in.
optional string language_code = 2;
};
// List of AppIds and whether to treat the list as a Whitelist or Blacklist.
message AppList {
enum Type {
// Specified app_ids are supported.
WHITELIST = 1;
// Specified app_ids are not supported.
BLACKLIST = 2;
}
// Whether to treat the app_id list as a Whitelist or Blacklist.
optional Type type = 1 [default = WHITELIST];
// List of AppIds.
repeated string app_id = 2;
};
message ServerContext {
// render_context encapsulates data about the device that is displaying the
// notifications.
optional RenderContext render_context = 1;
// List of AppIds and whether it is a blacklist or whitelist.
// This field needs to be set only when the set of apps enabled on a client
// changes. In the server response, this field will get cleared.
optional AppList app_list = 2;
// The view that the device has registered with. It is obtained from guns
// based on the app_list specified above.
optional string view_id = 3;
};
|