111 lines
3.1 KiB
Protocol Buffer
111 lines
3.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package proto;
|
|
|
|
option csharp_namespace = "DysonNetwork.Shared.Proto";
|
|
|
|
import "google/protobuf/struct.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/wrappers.proto";
|
|
|
|
// PusherService provides methods to send various types of notifications.
|
|
service PusherService {
|
|
// Sends an email.
|
|
rpc SendEmail(SendEmailRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Pushes a packet to a user via WebSocket.
|
|
rpc PushWebSocketPacket(PushWebSocketPacketRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Pushes a packet to a list of users via WebSocket.
|
|
rpc PushWebSocketPacketToUsers(PushWebSocketPacketToUsersRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Pushes a packet to a device via WebSocket.
|
|
rpc PushWebSocketPacketToDevice(PushWebSocketPacketToDeviceRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Pushes a packet to a list of devices via WebSocket.
|
|
rpc PushWebSocketPacketToDevices(PushWebSocketPacketToDevicesRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Sends a push notification to a device.
|
|
rpc SendPushNotification(SendPushNotificationRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Sends a push notification to a list of devices.
|
|
rpc SendPushNotificationToDevices(SendPushNotificationToDevicesRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Sends a push notification to a user.
|
|
rpc SendPushNotificationToUser(SendPushNotificationToUserRequest) returns (google.protobuf.Empty) {}
|
|
|
|
// Sends a push notification to a list of users.
|
|
rpc SendPushNotificationToUsers(SendPushNotificationToUsersRequest) returns (google.protobuf.Empty) {}
|
|
}
|
|
|
|
// Represents an email message.
|
|
message EmailMessage {
|
|
string to_name = 1;
|
|
string to_address = 2;
|
|
string subject = 3;
|
|
string body = 4;
|
|
}
|
|
|
|
message SendEmailRequest {
|
|
EmailMessage email = 1;
|
|
}
|
|
|
|
// Represents a WebSocket packet.
|
|
message WebSocketPacket {
|
|
string type = 1;
|
|
google.protobuf.Value data = 2;
|
|
google.protobuf.StringValue error_message = 3;
|
|
}
|
|
|
|
message PushWebSocketPacketRequest {
|
|
string user_id = 1;
|
|
WebSocketPacket packet = 2;
|
|
}
|
|
|
|
message PushWebSocketPacketToUsersRequest {
|
|
repeated string user_ids = 1;
|
|
WebSocketPacket packet = 2;
|
|
}
|
|
|
|
message PushWebSocketPacketToDeviceRequest {
|
|
string device_id = 1;
|
|
WebSocketPacket packet = 2;
|
|
}
|
|
|
|
message PushWebSocketPacketToDevicesRequest {
|
|
repeated string device_ids = 1;
|
|
WebSocketPacket packet = 2;
|
|
}
|
|
|
|
// Represents a push notification.
|
|
message PushNotification {
|
|
string topic = 1;
|
|
string title = 2;
|
|
string subtitle = 3;
|
|
string body = 4;
|
|
map<string, google.protobuf.Value> meta = 5;
|
|
optional string action_uri = 6;
|
|
bool is_silent = 7;
|
|
bool is_savable = 8;
|
|
}
|
|
|
|
message SendPushNotificationRequest {
|
|
string device_id = 1;
|
|
PushNotification notification = 2;
|
|
}
|
|
|
|
message SendPushNotificationToDevicesRequest {
|
|
repeated string device_ids = 1;
|
|
PushNotification notification = 2;
|
|
}
|
|
|
|
message SendPushNotificationToUserRequest {
|
|
string user_id = 1;
|
|
PushNotification notification = 2;
|
|
}
|
|
|
|
message SendPushNotificationToUsersRequest {
|
|
repeated string user_ids = 1;
|
|
PushNotification notification = 2;
|
|
}
|