129 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			129 lines
		
	
	
		
			3.4 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";
 | |
| 
 | |
| import "account.proto";
 | |
| 
 | |
| // RingService provides methods to send various types of notifications.
 | |
| service RingService {
 | |
|   // 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 user.
 | |
|   rpc SendPushNotificationToUser(SendPushNotificationToUserRequest) returns (google.protobuf.Empty) {}
 | |
| 
 | |
|   // Sends a push notification to a list of users.
 | |
|   rpc SendPushNotificationToUsers(SendPushNotificationToUsersRequest) returns (google.protobuf.Empty) {}
 | |
| 
 | |
|   // Unsubscribes a device from push notifications.
 | |
|   rpc UnsubscribePushNotifications(UnsubscribePushNotificationsRequest) returns (google.protobuf.Empty) {}
 | |
| 
 | |
|   // Gets the WebSocket connection status for a device or user.
 | |
|   rpc GetWebsocketConnectionStatus(GetWebsocketConnectionStatusRequest) returns (GetWebsocketConnectionStatusResponse) {}
 | |
| }
 | |
| 
 | |
| // 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;
 | |
|   bytes 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;
 | |
|   optional bytes meta = 5;
 | |
|   optional string action_uri = 6;
 | |
|   bool is_silent = 7;
 | |
|   bool is_savable = 8;
 | |
| }
 | |
| 
 | |
| message SendPushNotificationToUserRequest {
 | |
|   string user_id = 1;
 | |
|   PushNotification notification = 2;
 | |
| }
 | |
| 
 | |
| message SendPushNotificationToUsersRequest {
 | |
|   repeated string user_ids = 1;
 | |
|   PushNotification notification = 2;
 | |
| }
 | |
| 
 | |
| message UnsubscribePushNotificationsRequest {
 | |
|   string device_id = 1;
 | |
| }
 | |
| 
 | |
| message GetWebsocketConnectionStatusRequest {
 | |
|   oneof id {
 | |
|     string device_id = 1;
 | |
|     string user_id = 2;
 | |
|   }
 | |
| }
 | |
| 
 | |
| message GetWebsocketConnectionStatusResponse {
 | |
|   bool is_connected = 1;
 | |
| }
 | |
| 
 | |
| 
 | |
| service RingHandlerService {
 | |
|   rpc ReceiveWebSocketPacket(ReceiveWebSocketPacketRequest) returns (google.protobuf.Empty) {}
 | |
| }
 | |
| 
 | |
| message ReceiveWebSocketPacketRequest {
 | |
|   WebSocketPacket packet = 1;
 | |
|   Account account = 2;
 | |
|   string device_id = 3;
 | |
| }
 |