101 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
| syntax = "proto3";
 | |
| 
 | |
| package proto;
 | |
| 
 | |
| option csharp_namespace = "DysonNetwork.Shared.Proto";
 | |
| 
 | |
| import "google/protobuf/timestamp.proto";
 | |
| import "google/protobuf/wrappers.proto";
 | |
| import "google/protobuf/empty.proto";
 | |
| 
 | |
| import 'account.proto';
 | |
| 
 | |
| // Message Definitions
 | |
| 
 | |
| message Realm {
 | |
|     string id = 1;
 | |
|     string name = 2;
 | |
| }
 | |
| 
 | |
| message RealmMember {
 | |
|     string account_id = 1;
 | |
|     string realm_id = 2;
 | |
|     int32 role = 3;
 | |
|     optional google.protobuf.Timestamp joined_at = 4;
 | |
|     optional google.protobuf.Timestamp leave_at = 5;
 | |
|     optional Account account = 6;
 | |
|     optional Realm realm = 7;
 | |
| }
 | |
| 
 | |
| // Service Definitions
 | |
| 
 | |
| service RealmService {
 | |
|     // Get realm by id or slug
 | |
|     rpc GetRealm(GetRealmRequest) returns (Realm) {}
 | |
|     // Get realm batch by ids
 | |
|     rpc GetRealmBatch(GetRealmBatchRequest) returns (GetRealmBatchResponse) {}
 | |
|     // Get realms for a user
 | |
|     rpc GetUserRealms(GetUserRealmsRequest) returns (GetUserRealmsResponse) {}
 | |
|     // Get public realms
 | |
|     rpc GetPublicRealms(google.protobuf.Empty) returns (GetPublicRealmsResponse) {}
 | |
|     // Send invitation notification
 | |
|     rpc SendInviteNotify(SendInviteNotifyRequest) returns (google.protobuf.Empty) {}
 | |
|     // Check if member has required role
 | |
|     rpc IsMemberWithRole(IsMemberWithRoleRequest) returns (google.protobuf.BoolValue) {}
 | |
|     // Load account for a member
 | |
|     rpc LoadMemberAccount(LoadMemberAccountRequest) returns (RealmMember) {}
 | |
|     // Load accounts for members
 | |
|     rpc LoadMemberAccounts(LoadMemberAccountsRequest) returns (LoadMemberAccountsResponse) {}
 | |
| }
 | |
| 
 | |
| // Request/Response Messages
 | |
| 
 | |
| message GetRealmRequest {
 | |
|     oneof query {
 | |
|         string id = 1;
 | |
|         string slug = 2;
 | |
|     }
 | |
| }
 | |
| 
 | |
| message GetUserRealmsRequest {
 | |
|     string account_id = 1;
 | |
| }
 | |
| 
 | |
| message GetRealmBatchRequest {
 | |
|     repeated string ids = 1;
 | |
| }
 | |
| 
 | |
| message GetRealmBatchResponse {
 | |
|     repeated Realm realms = 1;
 | |
| }
 | |
| 
 | |
| message GetUserRealmsResponse {
 | |
|     repeated string realm_ids = 1;
 | |
| }
 | |
| 
 | |
| message GetPublicRealmsResponse {
 | |
|     repeated Realm realms = 1;
 | |
| }
 | |
| 
 | |
| message SendInviteNotifyRequest {
 | |
|     RealmMember member = 1;
 | |
| }
 | |
| 
 | |
| message IsMemberWithRoleRequest {
 | |
|     string realm_id = 1;
 | |
|     string account_id = 2;
 | |
|     repeated int32 required_roles = 3;
 | |
| }
 | |
| 
 | |
| message LoadMemberAccountRequest {
 | |
|     RealmMember member = 1;
 | |
| }
 | |
| 
 | |
| message LoadMemberAccountsRequest {
 | |
|     repeated RealmMember members = 1;
 | |
| }
 | |
| 
 | |
| message LoadMemberAccountsResponse {
 | |
|     repeated RealmMember members = 1;
 | |
| }
 |