87 lines
2.0 KiB
Protocol Buffer
87 lines
2.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
package email.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
|
|
|
enum EmailPriority {
|
|
EMAIL_PRIORITY_UNSPECIFIED = 0;
|
|
EMAIL_PRIORITY_LOW = 1;
|
|
EMAIL_PRIORITY_NORMAL = 2;
|
|
EMAIL_PRIORITY_HIGH = 3;
|
|
}
|
|
|
|
enum SendStatus {
|
|
SEND_STATUS_UNSPECIFIED = 0;
|
|
SEND_STATUS_QUEUED = 1;
|
|
SEND_STATUS_SENT = 2;
|
|
SEND_STATUS_FAILED = 3;
|
|
}
|
|
|
|
|
|
|
|
message EmailAddress {
|
|
string email = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message Attachment {
|
|
string filename = 1;
|
|
string content_type = 2;
|
|
bytes data = 3;
|
|
string url = 4;
|
|
}
|
|
|
|
|
|
message SendEmailRequest {
|
|
EmailAddress from = 1;
|
|
repeated EmailAddress to = 2;
|
|
repeated EmailAddress cc = 3;
|
|
repeated EmailAddress bcc = 4;
|
|
string subject = 5;
|
|
string text_body = 6;
|
|
string html_body = 7;
|
|
repeated Attachment attachments = 8;
|
|
EmailPriority priority = 9;
|
|
map<string, string> headers = 10;
|
|
string reply_to = 11;
|
|
}
|
|
|
|
message SendEmailResponse {
|
|
string message_id = 1;
|
|
SendStatus status = 2;
|
|
string provider = 3;
|
|
google.protobuf.Timestamp sent_at = 4;
|
|
}
|
|
|
|
message BatchSendEmailRequest {
|
|
repeated SendEmailRequest emails = 1;
|
|
bool fail_fast = 2;
|
|
}
|
|
|
|
message BatchSendEmailResponse {
|
|
repeated SendEmailResponse results = 1;
|
|
int32 success_count = 2;
|
|
int32 failure_count = 3;
|
|
}
|
|
|
|
message GetEmailStatusRequest {
|
|
string message_id = 1;
|
|
}
|
|
|
|
message GetEmailStatusResponse {
|
|
string message_id = 1;
|
|
SendStatus status = 2;
|
|
string error_detail = 3;
|
|
google.protobuf.Timestamp updated_at = 4;
|
|
}
|
|
|
|
|
|
service EmailService {
|
|
rpc SendEmail(SendEmailRequest) returns (SendEmailResponse);
|
|
rpc BatchSendEmail(BatchSendEmailRequest) returns (BatchSendEmailResponse);
|
|
rpc GetEmailStatus(GetEmailStatusRequest) returns (GetEmailStatusResponse);
|
|
rpc StreamBatchStatus(BatchSendEmailRequest)
|
|
returns (stream SendEmailResponse);
|
|
} |