1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Sync protocol datatype extension for push notifications..
7 // Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
8 // any fields in this file.
12 option optimize_for = LITE_RUNTIME;
13 option retain_unknown_fields = true;
17 import "synced_notification_render.proto";
19 // This message allows clients to identify a notification they have created.
20 message SyncedNotificationIdentifier {
21 // The application that the notification is a part of.
22 optional string app_id = 1;
24 // Notifications with the same coalescing key (isolated to the same app_id)
25 // will be grouped together when fetched.
26 optional string coalescing_key = 2;
29 message SyncedNotificationCreator {
30 // The gaia id of the creator. If a notification does not have a clear
31 // creator, skip this and follow the directions below to use a system creator.
32 optional int64 gaia_id = 1;
34 // Indicates that the creator is a "system" creator. Example of these are
35 // notifications sent to the user where the addressee is "Google", such as the
36 // "You have violated our TOS, and have 3 days to fix it or you'll lose your
37 // account" notifications. If is_system is set, gaia_id must not be set and
38 // instead the app_id field must be set.
39 optional bool is_system = 2;
41 // Only set this in the system-creator case.
42 optional string app_id = 3;
45 message SyncedNotificationRecipients {
46 repeated int64 gaia_id = 1;
48 // For now, only support gaia id recipients. Add more recipient types via
49 // 'repeated Type other_type = X' when necessary.
52 message SyncedNotification {
53 // A secondary type that is isolated within the same app_id.
55 // NOTE: For ASBE support purposes this must be in the format [A-Za-z_]+.
56 optional string type = 1;
58 // Whatever string the client entered during creation. If no external_id is
59 // specified, the notification can no longer be identified individually for
60 // fetching/deleting, etc...
61 optional string external_id = 2;
63 // The creator of the notification.
64 optional SyncedNotificationCreator creator = 3;
66 // Client specific data.
67 optional MapData client_data = 4;
70 message CoalescedSyncedNotification {
71 // An opaque string key used to identify individual coalesced notifications.
72 optional string key = 1;
74 optional string app_id = 2;
76 // All the notifications that are grouped together.
77 repeated SyncedNotification notification = 3;
79 // Data that is used directly by endpoints to render notifications in the case
80 // where no "native" app can handle the notification.
81 optional SyncedNotificationRenderInfo render_info = 4;
83 // Read state will be per coalesced notification.
90 optional ReadState read_state = 5;
92 // The time when the LATEST notification of the coalesced notification is
93 // created (in milliseconds since the linux epoch).
94 // This is called updated_version in the server side protobuf.
95 optional uint64 creation_time_msec = 6;
101 // We will most likely add at least one more priority in the near future.
103 optional Priority priority = 7;
105 // Security token that is to be used when making a PerformUserAction request
106 // when any user action within this coalesced notification is triggered.
107 optional string user_action_token = 8;
109 // This field corresponds to catchup_version in entity, which represents the
110 // version entity was last modified. Note that the
111 // Entity.last_modified_version will be actually the last creation version.
112 // See comments in updated_version.
113 optional uint64 last_modified_version = 9;
115 // Clients should use this field to order the notifications. Currently this is
116 // calculated from (priority, updated_version) pair.
117 optional uint64 sort_version = 10;
120 message SyncedNotificationList {
121 repeated CoalescedSyncedNotification coalesced_notification = 1;
124 // MapData, Data, and ListData are used to sending aribitrary payloads
125 // between instances of applications using Synced Notifications. The
126 // schema atop MapData will be defined by the client application.
129 optional string key = 1;
130 optional Data value = 2;
132 repeated Entry entry = 1;
136 optional bool boolean_value = 1;
137 optional int32 int_value = 2;
138 optional double float_value = 3;
139 optional string string_value = 4;
140 optional ListData list_value = 5;
141 optional MapData map_value = 6;
145 repeated Data value = 1;
148 // The RenderContext encapsulates data about the device that is displaying the
149 // notification. In the future, RenderContext might include data like the
150 // location of the user.
151 message RenderContext {
152 // The type of the device. This will be used to decide the resolution as well
153 // as the size of the image returned with the response.
154 // The server will try to find the closest matching resource to use.
155 // The android densities are from
156 // http://developer.android.com/guide/practices/screens_support.html
165 DESKTOP_NON_RETINA = 7;
172 optional DeviceType device_type = 1;
174 // The locale to render the notifications in.
175 optional string language_code = 2;
178 // List of AppIds and whether to treat the list as a Whitelist or Blacklist.
181 // Specified app_ids are supported.
183 // Specified app_ids are not supported.
187 // Whether to treat the app_id list as a Whitelist or Blacklist.
188 optional Type type = 1 [default = WHITELIST];
191 repeated string app_id = 2;
194 message ServerContext {
195 // render_context encapsulates data about the device that is displaying the
197 optional RenderContext render_context = 1;
199 // List of AppIds and whether it is a blacklist or whitelist.
200 // This field needs to be set only when the set of apps enabled on a client
201 // changes. In the server response, this field will get cleared.
202 optional AppList app_list = 2;
204 // The view that the device has registered with. It is obtained from guns
205 // based on the app_list specified above.
206 optional string view_id = 3;