Home | History | Annotate | Download | only in contacts
      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 // Protocol buffer definitions for the user's contacts.
      6 
      7 syntax = "proto2";
      8 
      9 option optimize_for = LITE_RUNTIME;
     10 
     11 package contacts;
     12 
     13 // A contact, roughly based on the GData Contact kind:
     14 // https://developers.google.com/gdata/docs/2.0/elements#gdContactKind
     15 // All strings are UTF-8 with Unicode byte order marks stripped out.
     16 message Contact {
     17   // Next ID to use: 16
     18 
     19   // Provider-assigned unique identifier.
     20   optional string contact_id = 1;
     21 
     22   // Last time at which this contact was updated within the upstream provider,
     23   // as given by base::Time::ToInternalValue().
     24   optional int64 update_time = 2;
     25 
     26   // Has the contact been deleted recently within the upstream provider?
     27   optional bool deleted = 3 [default = false];
     28 
     29   // Affinity between the user and this contact, in the range [0.0, 1.0].
     30   // Unset if the affinity is unknown.
     31   optional float affinity = 15;
     32 
     33   // Taken from https://developers.google.com/gdata/docs/2.0/elements#gdName.
     34   optional string full_name = 4;
     35   optional string given_name = 5;
     36   optional string additional_name = 6;
     37   optional string family_name = 7;
     38   optional string name_prefix = 8;
     39   optional string name_suffix = 9;
     40 
     41   // Raw photo data as supplied by the provider.  This data is untrusted and
     42   // must be decoded within a sandbox by e.g. ImageDecoder before being used.
     43   // Unset if no photo is available.
     44   optional bytes raw_untrusted_photo = 10;
     45 
     46   // Describes an address-like message's type.
     47   message AddressType {
     48     // Next ID to use: 3
     49     enum Relation {
     50       HOME = 0;
     51       WORK = 1;
     52       MOBILE = 2;
     53       OTHER = 3;
     54     }
     55     optional Relation relation = 1 [default = OTHER];
     56     optional string label = 2;
     57   }
     58 
     59   message EmailAddress {
     60     // Next ID to use: 4
     61     optional string address = 1;
     62     optional AddressType type = 2;
     63     optional bool primary = 3 [default = false];
     64   }
     65   repeated EmailAddress email_addresses = 11;
     66 
     67   message PhoneNumber {
     68     // Next ID to use: 4
     69     optional string number = 1;
     70     optional AddressType type = 2;
     71     optional bool primary = 3 [default = false];
     72   }
     73   repeated PhoneNumber phone_numbers = 12;
     74 
     75   message PostalAddress {
     76     // Next ID to use: 4
     77     optional string address = 1;
     78     optional AddressType type = 2;
     79     optional bool primary = 3 [default = false];
     80   }
     81   repeated PostalAddress postal_addresses = 13;
     82 
     83   message InstantMessagingAddress {
     84     // Next ID to use: 5
     85     optional string address = 1;
     86     // Taken from https://developers.google.com/gdata/docs/2.0/elements#gdIm.
     87     enum Protocol {
     88       AIM = 0;
     89       MSN = 1;
     90       YAHOO = 2;
     91       SKYPE = 3;
     92       QQ = 4;
     93       GOOGLE_TALK = 5;
     94       ICQ = 6;
     95       JABBER = 7;
     96       OTHER = 8;
     97     }
     98     optional Protocol protocol = 2 [default = OTHER];
     99     optional AddressType type = 3;
    100     optional bool primary = 4 [default = false];
    101   }
    102   repeated InstantMessagingAddress instant_messaging_addresses = 14;
    103 }
    104 
    105 // Singleton message used by ContactDatabase to store update-related metadata.
    106 message UpdateMetadata {
    107   // Next ID to use: 3
    108 
    109   // Time at which the last successful update was started, as given by
    110   // base::Time::ToInternalValue().
    111   optional int64 last_update_start_time = 1;
    112 
    113   // Latest time that we've seen in a contact's |update_time| field.  Note that
    114   // the time may have come from a deleted contact that has been discarded.
    115   optional int64 last_contact_update_time = 2;
    116 }
    117