Files
EdgeCommon/pkg/rpc/protos/service_message_task.proto
2023-10-12 20:11:34 +08:00

101 lines
2.6 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_message_task.proto";
import "models/rpc_messages.proto";
// 消息发送任务服务
service MessageTaskService {
// 创建消息任务
rpc createMessageTask (CreateMessageTaskRequest) returns (CreateMessageTaskResponse);
// 删除消息任务
rpc deleteMessageTask (DeleteMessageTaskRequest) returns (RPCSuccess);
// 读取消息任务状态
rpc findEnabledMessageTask (FindEnabledMessageTaskRequest) returns (FindEnabledMessageTaskResponse);
// 计算某个状态的消息任务数量
rpc countMessageTasksWithStatus(CountMessageTasksWithStatusRequest) returns (RPCCountResponse);
// 根据状态列出某页任务
rpc listMessageTasksWithStatus(ListMessageTasksWithStatusRequest) returns (ListMessageTasksWithStatusResponse);
// 发送某个消息任务
rpc sendMessageTask(SendMessageTaskRequest) returns (SendMessageTaskResponse);
}
// 创建消息任务
message CreateMessageTaskRequest {
int64 messageRecipientId = 1; // 接收人ID
int64 messageMediaInstanceId = 2; // 媒介实例ID
string user = 3; // 用户标识
string subject = 4; // 标题
string body = 5; // 内容
bool isPrimary = 6; // 是否优先发送
}
message CreateMessageTaskResponse {
int64 messageTaskId = 1; // 消息任务ID
}
// 删除消息任务
message DeleteMessageTaskRequest {
int64 messageTaskId = 1;
}
// 读取消息任务状态
message FindEnabledMessageTaskRequest {
int64 messageTaskId = 1;
}
message FindEnabledMessageTaskResponse {
MessageTask messageTask = 1;
}
// 计算某个状态的消息任务数量
message CountMessageTasksWithStatusRequest {
Status status = 1;
enum Status {
MessageTaskStatusNone = 0;
MessageTaskStatusSending = 1;
MessageTaskStatusSuccess = 2;
MessageTaskStatusFailed = 3;
}
}
// 根据状态列出某页任务
message ListMessageTasksWithStatusRequest {
Status status = 1;
int64 offset = 2;
int64 size = 3;
enum Status {
MessageTaskStatusNone = 0;
MessageTaskStatusSending = 1;
MessageTaskStatusSuccess = 2;
MessageTaskStatusFailed = 3;
}
}
message ListMessageTasksWithStatusResponse {
repeated MessageTask messageTasks = 1;
}
// 发送某个消息任务
// 与创建消息任务放入到后台任务队列不同此API是直接发送
message SendMessageTaskRequest {
int64 messageMediaInstanceId = 1; // 媒介实例ID
string user = 2; // 用户标识
string subject = 3; // 标题
string body = 4; // 内容
}
message SendMessageTaskResponse {
bool isOk = 1; // 是否成功
string error = 2; // 失败时的提示信息
string response = 3; // 发送成功后响应内容
}