Ejemplo n.º 1
0
        public async Task Unsubscribe(params string[] mediaNames)
        {
            if (mediaNames == null || mediaNames.Length < 1)
            {
                await Context.Channel.SendMessageAsync("Nothing to do.");
            }
            var notificationEndpointNotifierIdentifier = GetNotificationEndpointNotifierIdentifier(Context);
            var deleteSubscriptionInstructions         = mediaNames
                                                         .Select(mediaName => new DeleteSubscriptionInstruction(mediaName, notificationEndpointNotifierIdentifier))
                                                         .ToList();
            // TODO: when creating facade call this unscubscribe
            var result = await _subscriptionService.DeleteSubscriptions(deleteSubscriptionInstructions, CancellationToken.None);

            var message = result.Any(r => r.IsFailure)
                ? "Something went wrong."
                : "Successfully unsubscribed.";
            await Context.Channel.SendMessageAsync(message);
        }