summaryrefslogtreecommitdiffstats
path: root/sync/protocol/synced_notification_data.proto
blob: 72c612d725bdc1b4f7242fcf6ba387a32d917b0f (plain)
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
// 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;
  }
  optional ReadState read_state = 5;

  // The time when the LATEST notification of the coalesced notification is
  // created (in milliseconds since the linux epoch).
  optional uint64 creation_time_msec = 6;

  enum Priority {
    LOW = 1;
    STANDARD = 2;
    HIGH = 3;
    // We will most likely add at least one more priority in the near future.
  };
  optional Priority priority = 7;
}

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