Ejemplo n.º 1
0
 public async Task <SlackResponse> PinMessageToChannel(SlackChannelIdentifier channelIdentifier, string messageTimeStamp)
 {
     using (var response = await SendAsync(new PinMessageToChannelRequest(channelIdentifier, messageTimeStamp)))
     {
         return(await Parse <SlackResponse>(response));
     }
 }
Ejemplo n.º 2
0
 public async Task <SendNotificationResponse> SendNotificationToChannel(SlackChannelIdentifier channelIdentifier, string message)
 {
     using (var response = await SendAsync(new SendNotificationRequest(channelIdentifier, message)))
     {
         return(await Parse <SendNotificationResponse>(response));
     }
 }
Ejemplo n.º 3
0
 // This uses an undocumented API, tread carefully.
 public async Task DeleteChannel(SlackChannelIdentifier channelIdentifier, string token)
 {
     using (var response = await SendAsync(new DeleteChannelRequest(channelIdentifier, token)))
     {
         await Parse <SlackResponse>(response);
     }
 }
Ejemplo n.º 4
0
 public async Task LeaveChannel(SlackChannelIdentifier channelIdentifier)
 {
     using (var response = await SendAsync(new LeaveConversationRequest(channelIdentifier)))
     {
         await Parse <SlackResponse>(response);
     }
 }
Ejemplo n.º 5
0
 public async Task ArchiveChannel(SlackChannelIdentifier channelIdentifier)
 {
     using (var response = await SendAsync(new ArchiveChannelRequest(channelIdentifier)))
     {
         await Parse <SlackResponse>(response);
     }
 }
Ejemplo n.º 6
0
 public async Task RenameChannel(SlackChannelIdentifier channelIdentifier, SlackChannelName channelName)
 {
     using (var response = await SendAsync(new RenameChannelRequest(channelIdentifier, channelName)))
     {
         await Parse <SlackResponse>(response);
     }
 }
Ejemplo n.º 7
0
        public async Task InviteToChannel(string email, SlackChannelIdentifier channelIdentifier)
        {
            var userId = await GetUserId(email);

            using (var response = await SendAsync(new InviteToConversationRequest(channelIdentifier, new [] { userId })))
            {
                await Parse <SlackResponse>(response);
            }
        }
Ejemplo n.º 8
0
        public async Task RemoveFromChannel(string email, SlackChannelIdentifier channelIdentifier)
        {
            var userId = await GetUserId(email);

            using (var response = await SendAsync(new RemoveFromChannelRequest(channelIdentifier, userId)))
            {
                await Parse <SlackResponse>(response);
            }
        }
Ejemplo n.º 9
0
        public Task InviteToChannel(string email, SlackChannelIdentifier channelId)
        {
            if (InvitedToChannel.ContainsKey(channelId) == false)
            {
                InvitedToChannel.Add(channelId, new List <string>());
            }

            InvitedToChannel[channelId].Add(email);

            return(Task.CompletedTask);
        }
Ejemplo n.º 10
0
        public Task RemoveFromChannel(string email, SlackChannelIdentifier channelId)
        {
            if (RemovedFromChannel.ContainsKey(channelId) == false)
            {
                RemovedFromChannel.Add(channelId, new List <string>());
            }

            RemovedFromChannel[channelId].Add(email);

            return(Task.CompletedTask);
        }
Ejemplo n.º 11
0
        public Task <SlackResponse> PinMessageToChannel(SlackChannelIdentifier channelId, string messageTimeStamp)
        {
            if (ChannelsPinnedMessageTimeStamps.ContainsKey(channelId) == false)
            {
                ChannelsPinnedMessageTimeStamps.Add(channelId, new List <string>());
            }

            ChannelsPinnedMessageTimeStamps[channelId].Add(messageTimeStamp);

            return(Task.FromResult(new SlackResponse {
                Ok = true
            }));
        }
Ejemplo n.º 12
0
        public Task <SendNotificationResponse> SendNotificationToChannel(SlackChannelIdentifier channelId, string message)
        {
            if (ChannelsMessages.ContainsKey(channelId) == false)
            {
                ChannelsMessages.Add(channelId, new List <string>());
            }

            ChannelsMessages[channelId].Add(message);

            var sendNotificationResponse = new SendNotificationResponse
            {
                Ok        = true,
                TimeStamp = "1355517523.000005"
            };

            return(Task.FromResult(sendNotificationResponse));
        }
Ejemplo n.º 13
0
        public Task <SendNotificationResponse> SendNotificationToChannel(SlackChannelIdentifier channelId, string message)
        {
            SendNotificationToChannelCalled = true;
            if (_simulateFailOnSendMessage)
            {
                return(Task.FromResult(new SendNotificationResponse
                {
                    Ok = false,
                    Error = "Simulated error sending notification."
                }));
            }

            return(Task.FromResult(new SendNotificationResponse
            {
                Ok = true,
                TimeStamp = "1234"
            }));
        }
        public async Task Handle_will_SendNotificationToChannel_Ded_AND_SendNotificationToChannel_CapabilityId()
        {
            // Arrange
            var capability = Capability.Create(
                Guid.NewGuid(),
                "",
                "slackChannelId",
                ""
                );
            var slackFacadeSpy           = new SlackFacadeSpy();
            var stubCapabilityRepository = new StubCapabilityRepository();
            await stubCapabilityRepository.Add(capability);

            var slackContextAddedToCapabilityDomainEventHandler = new SlackContextAddedToCapabilityDomainEventHandler(
                stubCapabilityRepository,
                slackFacadeSpy,
                new ExternalEventMetaDataStore()
                );

            var contextAddedToCapabilityDomainEvent = ContextAddedToCapabilityDomainEvent.Create(
                capability.Id,
                "",
                "",
                Guid.NewGuid(),
                ""
                );


            // Act
            await slackContextAddedToCapabilityDomainEventHandler
            .HandleAsync(contextAddedToCapabilityDomainEvent);

            // Assert
            var hardCodedDedChannelId = new SlackChannelIdentifier("GFYE9B99Q");

            Assert.NotEmpty(slackFacadeSpy.ChannelsMessages[hardCodedDedChannelId]);
            Assert.NotEmpty(slackFacadeSpy.ChannelsMessages[capability.SlackChannelId.ToString()]);
        }
Ejemplo n.º 15
0
 public Task ArchiveChannel(SlackChannelIdentifier channelIdentifier)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 16
0
 public Task <SlackResponse> PinMessageToChannel(SlackChannelIdentifier channelId, string messageTimeStamp)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 17
0
 public Task RemoveFromChannel(string email, SlackChannelIdentifier channelId)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 18
0
 public Task DeleteChannel(SlackChannelIdentifier channelId, string token)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 19
0
 public Task RenameChannel(SlackChannelIdentifier channelId, SlackChannelName name)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 20
0
 public Task <SendNotificationResponse> SendDelayedNotificationToChannel(SlackChannelIdentifier channelId, string message,
                                                                         long delayTimeInEpoch)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 21
0
 public Task ArchiveChannel(SlackChannelIdentifier channelIdentifier)
 {
     throw new NotImplementedException();
 }