• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4//
5// Sync protocol datatype extension for push notifications..
6
7// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
8// any fields in this file.
9
10syntax = "proto2";
11
12option optimize_for = LITE_RUNTIME;
13option retain_unknown_fields = true;
14
15package sync_pb;
16
17import "synced_notification_render.proto";
18
19// This message allows clients to identify a notification they have created.
20message SyncedNotificationIdentifier {
21  // The application that the notification is a part of.
22  optional string app_id = 1;
23
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;
27}
28
29message 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;
33
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;
40
41  // Only set this in the system-creator case.
42  optional string app_id = 3;
43}
44
45message SyncedNotificationRecipients {
46  repeated int64 gaia_id = 1;
47
48  // For now, only support gaia id recipients.  Add more recipient types via
49  // 'repeated Type other_type = X' when necessary.
50}
51
52message SyncedNotification {
53  // A secondary type that is isolated within the same app_id.
54  //
55  // NOTE: For ASBE support purposes this must be in the format [A-Za-z_]+.
56  optional string type = 1;
57
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;
62
63  // The creator of the notification.
64  optional SyncedNotificationCreator creator = 3;
65
66  // Client specific data.
67  optional MapData client_data = 4;
68}
69
70message CoalescedSyncedNotification {
71  // An opaque string key used to identify individual coalesced notifications.
72  optional string key = 1;
73
74  optional string app_id = 2;
75
76  // All the notifications that are grouped together.
77  repeated SyncedNotification notification = 3;
78
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;
82
83  // Read state will be per coalesced notification.
84  enum ReadState {
85    UNREAD = 1;
86    READ = 2;
87    DISMISSED = 3;
88  }
89  optional ReadState read_state = 5;
90
91  // The time when the LATEST notification of the coalesced notification is
92  // created (in milliseconds since the linux epoch).
93  optional uint64 creation_time_msec = 6;
94
95  enum Priority {
96    LOW = 1;
97    STANDARD = 2;
98    HIGH = 3;
99    // We will most likely add at least one more priority in the near future.
100  };
101  optional Priority priority = 7;
102}
103
104message SyncedNotificationList {
105  repeated CoalescedSyncedNotification coalesced_notification = 1;
106}
107
108// MapData, Data, and ListData are used to sending aribitrary payloads
109// between instances of applications using Synced Notifications.  The
110// schema atop MapData will be defined by the client application.
111message MapData {
112  message Entry {
113    optional string key = 1;
114    optional Data value = 2;
115  };
116  repeated Entry entry = 1;
117};
118
119message Data {
120  optional bool boolean_value = 1;
121  optional int32 int_value = 2;
122  optional double float_value = 3;
123  optional string string_value = 4;
124  optional ListData list_value = 5;
125  optional MapData map_value = 6;
126};
127
128message ListData {
129  repeated Data value = 1;
130};