addressbook.proto 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>
  5. *
  6. * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy of this
  9. * software and associated documentation files (the "Software"), to deal in the Software
  10. * without restriction, including without limitation the rights to use, copy, modify,
  11. * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
  12. * to permit persons to whom the Software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in all copies
  16. * or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  19. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  20. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  21. * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. */
  25. syntax="proto3";
  26. package qtprotobuf.examples;
  27. message PhoneNumber {
  28. uint32 countryCode = 1;
  29. uint64 number = 2;
  30. }
  31. message Address {
  32. uint64 zipCode = 1;
  33. string streetAddress1 = 2;
  34. string streetAddress2 = 3;
  35. string state = 4;
  36. uint32 country = 5;
  37. }
  38. message Job {
  39. string title = 1;
  40. Address officeAddress = 2;
  41. }
  42. message Contact {
  43. enum PhoneType {
  44. Home = 0;
  45. Work = 1;
  46. Mobile = 2;
  47. Other = 3;
  48. };
  49. string firstName = 1;
  50. string lastName = 2;
  51. string middleName = 3;
  52. repeated PhoneNumber phones = 4;
  53. Address address = 5;
  54. Job job = 6;
  55. }
  56. message Contacts {
  57. repeated Contact list = 1;
  58. }
  59. message CallStatus {
  60. enum Status {
  61. Invalid = 0;
  62. Inactive = 1;
  63. Active = 2;
  64. Ended = 3;
  65. };
  66. Status status = 1;
  67. PhoneNumber phoneNumber = 2;
  68. }
  69. message ListFrame {
  70. sint32 start = 1;
  71. sint32 end = 2;
  72. }
  73. message None {
  74. }
  75. service AddressBook {
  76. rpc addContact(Contact) returns (Contacts) {}
  77. rpc removeContact(Contact) returns (Contacts) {}
  78. rpc contacts(ListFrame) returns (stream Contacts) {}
  79. rpc callStatus(None) returns (stream CallStatus) {}
  80. rpc makeCall(PhoneNumber) returns (CallStatus) {}
  81. rpc endCall(None) returns (None) {}
  82. rpc navigateTo(Address) returns (None) {}
  83. }