81 lines
2.2 KiB
Protocol Buffer
81 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package notify.v1;
|
|
|
|
import "notify/v1/types.proto";
|
|
|
|
message SendNotificationRequest {
|
|
Payload payload = 1;
|
|
Service service = 2;
|
|
}
|
|
|
|
// SendAttachmentResponse is sent when message is successful.
|
|
message SendNotificationResponse {
|
|
// notification_id is the snowflake id of the message.
|
|
//
|
|
// Guaranteed to be unique even on distributed environment.
|
|
//
|
|
// notification_id can be used in `SendAttachment` rpc to
|
|
// attach binary data to the message.
|
|
string notification_id = 1;
|
|
}
|
|
|
|
message Payload {
|
|
string message = 1;
|
|
Level level = 2;
|
|
optional int64 code = 3;
|
|
// details adds context to the message.
|
|
//
|
|
// like timestamps, invalid inputs,
|
|
// request payloads, backend response, etc.
|
|
//
|
|
// Anything that can enrich why this message
|
|
// appears will help.
|
|
//
|
|
// DO NOT INCLUDE BINARIES LIKE IMAGES, PDFS, DOCS, IN
|
|
// THIS PAYLOAD. USE `SendAttachment` rpc
|
|
// to attach binary values instead since they are designed
|
|
// for streaming. Server and Client RAM
|
|
// can be eaten alive if you failed to do so since GRPC
|
|
// handles via whole messages.
|
|
oneof details {
|
|
// Sends JSON as details.
|
|
bytes d_json = 4;
|
|
string d_text = 5;
|
|
}
|
|
oneof error {
|
|
bytes e_json = 6;
|
|
string e_text = 7;
|
|
}
|
|
string id = 8;
|
|
}
|
|
|
|
message Service {
|
|
// The name of the service that is sending the notification.
|
|
//
|
|
// This is used to identify the service that is sending the notification.
|
|
//
|
|
// The value of name should be related to the product or service.
|
|
// e.g. `sbn-frontend`, `sbn-cron-job`, `payment-frontend`, `robo-frontend`.
|
|
//
|
|
// `name`, `type`, and `environment` combination are used to select which channel the
|
|
// discord notification is sent.
|
|
string name = 1;
|
|
string type = 2;
|
|
Environment environment = 3;
|
|
optional string version = 4;
|
|
// domain specifies whose message this belongs to.
|
|
//
|
|
// It's not required to be set, but setting this field
|
|
// will help zen to categorize messages when building
|
|
// reports.
|
|
ServiceDomain domain = 5;
|
|
repeated Attribute attributes = 6;
|
|
}
|
|
|
|
enum ServiceDomain {
|
|
SERVICE_DOMAIN_UNSPECIFIED = 0;
|
|
SERVICE_DOMAIN_FRONTEND = 1;
|
|
SERVICE_DOMAIN_BACKEND = 2;
|
|
}
|