addressbook.proto 1.12 KB
Newer Older
temporal's avatar
temporal committed
1
// See README.txt for information and build instructions.
2 3 4 5 6 7 8 9
//
// Note: START and END tags are used in comments to define sections used in
// tutorials.  They are not part of the syntax for Protocol Buffers.
//
// To get an in-depth walkthrough of this file and the related examples, see:
// https://developers.google.com/protocol-buffers/docs/tutorials

// [START declaration]
10
syntax = "proto3";
temporal's avatar
temporal committed
11
package tutorial;
12
// [END declaration]
temporal's avatar
temporal committed
13

14
// [START java_declaration]
temporal's avatar
temporal committed
15 16
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
17 18 19
// [END java_declaration]

// [START csharp_declaration]
20
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
21
// [END csharp_declaration]
temporal's avatar
temporal committed
22

23
// [START messages]
temporal's avatar
temporal committed
24
message Person {
25
  string name = 1;
26
  int32 id = 2;  // Unique ID number for this person.
27
  string email = 3;
temporal's avatar
temporal committed
28 29 30 31 32 33 34 35

  enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
  }

  message PhoneNumber {
36 37
    string number = 1;
    PhoneType type = 2;
temporal's avatar
temporal committed
38 39
  }

40
  repeated PhoneNumber phones = 4;
temporal's avatar
temporal committed
41 42 43 44
}

// Our address book file is just one of these.
message AddressBook {
45
  repeated Person people = 1;
temporal's avatar
temporal committed
46
}
47
// [END messages]