117 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			2.8 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';
 | 
						|
import "file.proto";
 | 
						|
 | 
						|
// Message Definitions
 | 
						|
 | 
						|
message Realm {
 | 
						|
    string id = 1;
 | 
						|
    string name = 2;
 | 
						|
    string slug = 3;
 | 
						|
    bool is_community = 4;
 | 
						|
    bool is_public = 5;
 | 
						|
    string description = 6;
 | 
						|
    optional CloudFile picture = 7;
 | 
						|
    optional CloudFile background = 8;
 | 
						|
    optional VerificationMark verification = 9;
 | 
						|
    string account_id = 10;
 | 
						|
}
 | 
						|
 | 
						|
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) {}
 | 
						|
    // Search public realms
 | 
						|
    rpc SearchRealms(SearchRealmsRequest) 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 SearchRealmsRequest {
 | 
						|
    string query = 1;
 | 
						|
    int32 limit = 2;
 | 
						|
}
 | 
						|
 | 
						|
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;
 | 
						|
}
 |