2023-11-24 18:04:36 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
package memos.api.v1;
|
2023-11-24 18:04:36 +03:00
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
import "api/v1/common.proto";
|
2024-06-05 15:53:20 +03:00
|
|
|
import "api/v1/memo_service.proto";
|
2023-11-24 18:04:36 +03:00
|
|
|
import "google/api/annotations.proto";
|
2024-02-06 15:55:27 +03:00
|
|
|
import "google/api/client.proto";
|
2024-04-27 18:14:58 +03:00
|
|
|
import "google/protobuf/empty.proto";
|
2023-11-24 18:04:36 +03:00
|
|
|
import "google/protobuf/field_mask.proto";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
2024-04-27 19:44:29 +03:00
|
|
|
option go_package = "gen/api/v1";
|
2023-11-24 18:04:36 +03:00
|
|
|
|
|
|
|
service WebhookService {
|
2024-02-01 16:26:09 +03:00
|
|
|
// CreateWebhook creates a new webhook.
|
2024-04-27 18:14:58 +03:00
|
|
|
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
2023-11-24 18:04:36 +03:00
|
|
|
option (google.api.http) = {
|
2024-04-27 19:44:29 +03:00
|
|
|
post: "/api/v1/webhooks"
|
2023-11-24 18:04:36 +03:00
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2024-02-01 16:26:09 +03:00
|
|
|
// GetWebhook returns a webhook by id.
|
2024-04-27 18:14:58 +03:00
|
|
|
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
|
2024-02-06 15:55:27 +03:00
|
|
|
option (google.api.method_signature) = "id";
|
2023-11-24 18:04:36 +03:00
|
|
|
}
|
2024-02-01 16:26:09 +03:00
|
|
|
// ListWebhooks returns a list of webhooks.
|
2023-11-24 18:04:36 +03:00
|
|
|
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {get: "/api/v1/webhooks"};
|
2023-11-24 18:04:36 +03:00
|
|
|
}
|
2024-02-01 16:26:09 +03:00
|
|
|
// UpdateWebhook updates a webhook.
|
2024-04-27 18:14:58 +03:00
|
|
|
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
|
2023-11-24 18:04:36 +03:00
|
|
|
option (google.api.http) = {
|
2024-04-27 19:44:29 +03:00
|
|
|
patch: "/api/v1/webhooks/{webhook.id}"
|
2024-02-06 15:55:27 +03:00
|
|
|
body: "webhook"
|
2023-11-24 18:04:36 +03:00
|
|
|
};
|
2024-02-06 15:55:27 +03:00
|
|
|
option (google.api.method_signature) = "webhook,update_mask";
|
2023-11-24 18:04:36 +03:00
|
|
|
}
|
2024-02-01 16:26:09 +03:00
|
|
|
// DeleteWebhook deletes a webhook by id.
|
2024-04-27 18:14:58 +03:00
|
|
|
rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
|
2024-04-27 19:44:29 +03:00
|
|
|
option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
|
2024-02-06 15:55:27 +03:00
|
|
|
option (google.api.method_signature) = "id";
|
2023-11-24 18:04:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message Webhook {
|
|
|
|
int32 id = 1;
|
|
|
|
|
|
|
|
int32 creator_id = 2;
|
|
|
|
|
2024-06-05 15:53:20 +03:00
|
|
|
google.protobuf.Timestamp create_time = 3;
|
2023-11-24 18:04:36 +03:00
|
|
|
|
2024-06-05 15:53:20 +03:00
|
|
|
google.protobuf.Timestamp update_time = 4;
|
2023-11-24 18:04:36 +03:00
|
|
|
|
|
|
|
RowStatus row_status = 5;
|
|
|
|
|
|
|
|
string name = 6;
|
|
|
|
|
|
|
|
string url = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CreateWebhookRequest {
|
|
|
|
string name = 1;
|
|
|
|
|
|
|
|
string url = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetWebhookRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListWebhooksRequest {
|
|
|
|
int32 creator_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListWebhooksResponse {
|
|
|
|
repeated Webhook webhooks = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message UpdateWebhookRequest {
|
|
|
|
Webhook webhook = 1;
|
|
|
|
|
|
|
|
google.protobuf.FieldMask update_mask = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteWebhookRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
}
|
2024-06-05 15:53:20 +03:00
|
|
|
|
|
|
|
message WebhookRequestPayload {
|
|
|
|
string url = 1;
|
|
|
|
|
|
|
|
string activity_type = 2;
|
|
|
|
|
|
|
|
int32 creator_id = 3;
|
|
|
|
|
|
|
|
google.protobuf.Timestamp create_time = 4;
|
|
|
|
|
|
|
|
Memo memo = 5;
|
|
|
|
}
|