http_messaging.proto 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2021 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package messaging;
  16. import "google/api/annotations.proto";
  17. import "google/protobuf/empty.proto";
  18. service Messaging {
  19. rpc GetMessage(GetMessageRequest) returns (Message) {
  20. option (google.api.http) = {
  21. get: "/v1/{name=messages/*}"
  22. };
  23. }
  24. rpc SearchMessage(SearchMessageRequest) returns (Message) {
  25. option (google.api.http) = {
  26. get:"/v1/messages/filter/{message_id}"
  27. };
  28. }
  29. rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
  30. option (google.api.http) = {
  31. put: "/v1/messages/{message_id}"
  32. body: "message"
  33. };
  34. }
  35. rpc PatchMessage(PatchMessageRequest) returns (Message) {
  36. option (google.api.http) = {
  37. patch: "/v1/messages/{message_id}"
  38. body: "*"
  39. };
  40. }
  41. }
  42. message GetMessageRequest {
  43. string name = 1; // Mapped to URL path.
  44. }
  45. message Message {
  46. string text = 1; // The resource content.
  47. }
  48. message SearchMessageRequest {
  49. message SubMessage {
  50. string subfield = 1;
  51. }
  52. string message_id = 1; // Mapped to URL path.
  53. int64 revision = 2; // Mapped to URL query parameter `revision`.
  54. SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
  55. }
  56. message UpdateMessageRequest {
  57. string message_id = 1; // mapped to the URL
  58. Message message = 2; // mapped to the body
  59. }
  60. message PatchMessageRequest {
  61. string message_id = 1;
  62. string text = 2;
  63. }