webhook_service.proto 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. syntax = "proto3";
  2. package memos.api.v1;
  3. import "api/v1/common.proto";
  4. import "api/v1/memo_service.proto";
  5. import "google/api/annotations.proto";
  6. import "google/api/client.proto";
  7. import "google/protobuf/empty.proto";
  8. import "google/protobuf/field_mask.proto";
  9. import "google/protobuf/timestamp.proto";
  10. option go_package = "gen/api/v1";
  11. service WebhookService {
  12. // CreateWebhook creates a new webhook.
  13. rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
  14. option (google.api.http) = {
  15. post: "/api/v1/webhooks"
  16. body: "*"
  17. };
  18. }
  19. // GetWebhook returns a webhook by id.
  20. rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
  21. option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
  22. option (google.api.method_signature) = "id";
  23. }
  24. // ListWebhooks returns a list of webhooks.
  25. rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
  26. option (google.api.http) = {get: "/api/v1/webhooks"};
  27. }
  28. // UpdateWebhook updates a webhook.
  29. rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
  30. option (google.api.http) = {
  31. patch: "/api/v1/webhooks/{webhook.id}"
  32. body: "webhook"
  33. };
  34. option (google.api.method_signature) = "webhook,update_mask";
  35. }
  36. // DeleteWebhook deletes a webhook by id.
  37. rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
  38. option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
  39. option (google.api.method_signature) = "id";
  40. }
  41. }
  42. message Webhook {
  43. int32 id = 1;
  44. int32 creator_id = 2;
  45. google.protobuf.Timestamp create_time = 3;
  46. google.protobuf.Timestamp update_time = 4;
  47. RowStatus row_status = 5;
  48. string name = 6;
  49. string url = 7;
  50. }
  51. message CreateWebhookRequest {
  52. string name = 1;
  53. string url = 2;
  54. }
  55. message GetWebhookRequest {
  56. int32 id = 1;
  57. }
  58. message ListWebhooksRequest {
  59. int32 creator_id = 1;
  60. }
  61. message ListWebhooksResponse {
  62. repeated Webhook webhooks = 1;
  63. }
  64. message UpdateWebhookRequest {
  65. Webhook webhook = 1;
  66. google.protobuf.FieldMask update_mask = 2;
  67. }
  68. message DeleteWebhookRequest {
  69. int32 id = 1;
  70. }
  71. message WebhookRequestPayload {
  72. string url = 1;
  73. string activity_type = 2;
  74. int32 creator_id = 3;
  75. google.protobuf.Timestamp create_time = 4;
  76. Memo memo = 5;
  77. }