webhook_service.proto 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. syntax = "proto3";
  2. package memos.api.v1;
  3. import "api/v1/memo_service.proto";
  4. import "google/api/annotations.proto";
  5. import "google/api/client.proto";
  6. import "google/protobuf/empty.proto";
  7. import "google/protobuf/field_mask.proto";
  8. import "google/protobuf/timestamp.proto";
  9. option go_package = "gen/api/v1";
  10. service WebhookService {
  11. // CreateWebhook creates a new webhook.
  12. rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
  13. option (google.api.http) = {
  14. post: "/api/v1/webhooks"
  15. body: "*"
  16. };
  17. }
  18. // GetWebhook returns a webhook by id.
  19. rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
  20. option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
  21. option (google.api.method_signature) = "id";
  22. }
  23. // ListWebhooks returns a list of webhooks.
  24. rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
  25. option (google.api.http) = {get: "/api/v1/webhooks"};
  26. }
  27. // UpdateWebhook updates a webhook.
  28. rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
  29. option (google.api.http) = {
  30. patch: "/api/v1/webhooks/{webhook.id}"
  31. body: "webhook"
  32. };
  33. option (google.api.method_signature) = "webhook,update_mask";
  34. }
  35. // DeleteWebhook deletes a webhook by id.
  36. rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
  37. option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
  38. option (google.api.method_signature) = "id";
  39. }
  40. }
  41. message Webhook {
  42. int32 id = 1;
  43. // The name of the creator.
  44. string creator = 2;
  45. google.protobuf.Timestamp create_time = 3;
  46. google.protobuf.Timestamp update_time = 4;
  47. string name = 5;
  48. string url = 6;
  49. }
  50. message CreateWebhookRequest {
  51. string name = 1;
  52. string url = 2;
  53. }
  54. message GetWebhookRequest {
  55. int32 id = 1;
  56. }
  57. message ListWebhooksRequest {
  58. // The name of the creator.
  59. string creator = 2;
  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. // The name of the creator.
  75. // Format: users/{user}
  76. string creator = 3;
  77. google.protobuf.Timestamp create_time = 4;
  78. Memo memo = 5;
  79. }