| // 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; |
| }; |