using System; using System.Threading.Tasks; using System.Collections.Generic; using Aurora.Proto.Party; using Aurora.Proto.General; using Aurora.Utils; namespace Aurora.Services.Server.Controllers { public partial class RemotePartyController : RemotePartyService.RemotePartyServiceBase { public override Task ListEventSubscriptions( ListEventSubscriptionsRequest request, Grpc.Core.ServerCallContext context) { throw new NotImplementedException(); } public override Task CreateEventSubscription( CreateEventSubscriptionRequest request, Grpc.Core.ServerCallContext context) { Console.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.Parent)); this._eventManager.AddSubscription(Misc.Combine(new string[] { context.Peer, request.Parent }), request.EventSubscription.Type); return Task.FromResult(request.EventSubscription); } public override Task CreateEventSubscriptionList( CreateEventSubscriptionListRequest request, Grpc.Core.ServerCallContext context) { Console.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.Parent)); List eventTypes = new List(); foreach (EventSubscription subscription in request.EventSubscriptions) { eventTypes.Add(subscription.Type); } this._eventManager.AddSubscriptionList(Misc.Combine(new string[] { context.Peer, request.Parent }), eventTypes); CreateEventSubscriptionListResponse resp = new CreateEventSubscriptionListResponse(); resp.EventSubscriptions.AddRange(request.EventSubscriptions); return Task.FromResult(resp); } public override Task DeleteEventSubscription( DeleteEventSubscriptionRequest request, Grpc.Core.ServerCallContext context) { this._eventManager.RemoveSubscription(Misc.Combine(new string[] { context.Peer, request.Parent }), request.Type); return Task.FromResult(new Empty()); } public override Task DeleteAllEventSubscriptions( DeleteAllEventSubscriptionsRequest request, Grpc.Core.ServerCallContext context) { this._eventManager.RemoveAllSubscriptions(Misc.Combine(new string[] { context.Peer, request.Parent })); return Task.FromResult(new Empty()); } } }