2023-11-24 23:04:36 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2024-04-28 00:44:29 +08:00
|
|
|
package memos.api.v1;
|
2023-11-24 23:04:36 +08:00
|
|
|
|
2024-04-28 00:44:29 +08:00
|
|
|
import "api/v1/common.proto";
|
2023-11-24 23:04:36 +08:00
|
|
|
import "google/api/annotations.proto";
|
2024-02-06 20:55:27 +08:00
|
|
|
import "google/api/client.proto";
|
2024-04-27 23:14:58 +08:00
|
|
|
import "google/protobuf/empty.proto";
|
2023-11-24 23:04:36 +08:00
|
|
|
import "google/protobuf/field_mask.proto";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
2024-04-28 00:44:29 +08:00
|
|
|
option go_package = "gen/api/v1";
|
2023-11-24 23:04:36 +08:00
|
|
|
|
|
|
|
service WebhookService {
|
2024-02-01 21:26:09 +08:00
|
|
|
// CreateWebhook creates a new webhook.
|
2024-04-27 23:14:58 +08:00
|
|
|
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
2023-11-24 23:04:36 +08:00
|
|
|
option (google.api.http) = {
|
2024-04-28 00:44:29 +08:00
|
|
|
post: "/api/v1/webhooks"
|
2023-11-24 23:04:36 +08:00
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2024-02-01 21:26:09 +08:00
|
|
|
// GetWebhook returns a webhook by id.
|
2024-04-27 23:14:58 +08:00
|
|
|
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
2024-04-28 00:44:29 +08:00
|
|
|
option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
|
2024-02-06 20:55:27 +08:00
|
|
|
option (google.api.method_signature) = "id";
|
2023-11-24 23:04:36 +08:00
|
|
|
}
|
2024-02-01 21:26:09 +08:00
|
|
|
// ListWebhooks returns a list of webhooks.
|
2023-11-24 23:04:36 +08:00
|
|
|
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
|
2024-04-28 00:44:29 +08:00
|
|
|
option (google.api.http) = {get: "/api/v1/webhooks"};
|
2023-11-24 23:04:36 +08:00
|
|
|
}
|
2024-02-01 21:26:09 +08:00
|
|
|
// UpdateWebhook updates a webhook.
|
2024-04-27 23:14:58 +08:00
|
|
|
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
|
2023-11-24 23:04:36 +08:00
|
|
|
option (google.api.http) = {
|
2024-04-28 00:44:29 +08:00
|
|
|
patch: "/api/v1/webhooks/{webhook.id}"
|
2024-02-06 20:55:27 +08:00
|
|
|
body: "webhook"
|
2023-11-24 23:04:36 +08:00
|
|
|
};
|
2024-02-06 20:55:27 +08:00
|
|
|
option (google.api.method_signature) = "webhook,update_mask";
|
2023-11-24 23:04:36 +08:00
|
|
|
}
|
2024-02-01 21:26:09 +08:00
|
|
|
// DeleteWebhook deletes a webhook by id.
|
2024-04-27 23:14:58 +08:00
|
|
|
rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
|
2024-04-28 00:44:29 +08:00
|
|
|
option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
|
2024-02-06 20:55:27 +08:00
|
|
|
option (google.api.method_signature) = "id";
|
2023-11-24 23:04:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message Webhook {
|
|
|
|
int32 id = 1;
|
|
|
|
|
|
|
|
int32 creator_id = 2;
|
|
|
|
|
|
|
|
google.protobuf.Timestamp created_time = 3;
|
|
|
|
|
|
|
|
google.protobuf.Timestamp updated_time = 4;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|