Exemple #1
0
        public async Task <IEnumerable <SlackUser> > GetUsers()
        {
            IChannelClient client = _connectionFactory.CreateChannelClient();
            var            users  = await client.GetUsers(SlackKey);

            return(users.Select(u => u.ToSlackUser()));
        }
        public async Task <IEnumerable <SlackUser> > GetUsers()
        {
            IChannelClient client = this._connectionFactory.CreateChannelClient();
            var            users  = await client.GetUsers(this.SlackKey);

            //TODO: Update user cache
            return(users.Select(u => u.ToSlackUser()));
        }
Exemple #3
0
 public AlexaController(IConfiguration config, ILogger <AlexaController> logger,
                        IAlexaClient client, IChannelClient channelClient)
 {
     _config        = config;
     _logger        = logger;
     _client        = client;
     _channelClient = channelClient;
 }
        public async Task ArchiveChannel(string channelName)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            IChannelClient client = this._connectionFactory.CreateChannelClient();
            await client.ArchiveChannel(this.SlackKey, channelName);
        }
Exemple #5
0
        public LiveNowDialog(string dialogId, IChannelClient client) : base(dialogId)
        {
            _client = client;

            var steps = new WaterfallStep[]
            {
                GetLiveStreamsStepAsync,
            };

            AddDialog(new WaterfallDialog(Constants.LiveNow, steps));
        }
Exemple #6
0
        public async Task <IEnumerable <SlackChatHub> > GetChannels()
        {
            IChannelClient client   = _connectionFactory.CreateChannelClient();
            var            channels = await client.GetChannels(SlackKey);

            var groups = await client.GetGroups(SlackKey);

            var fromChannels = channels.Select(c => c.ToChatHub());
            var fromGroups   = groups.Select(g => g.ToChatHub());

            return(fromChannels.Concat(fromGroups));
        }
        public static Attachment Create(IChannelClient client)
        {
            var adaptiveCard = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0));
            var container    = new AdaptiveContainer();

            container.Items.Add(new AdaptiveTextBlock
            {
                Text = "Which tags do you wish to search for?",
                HorizontalAlignment = AdaptiveHorizontalAlignment.Center,
                Weight = AdaptiveTextWeight.Bolder,
                Size   = AdaptiveTextSize.Medium,
            });

            var choices   = new List <AdaptiveChoice>();
            var tagsInUse = client.GetTagsInUse().Result;

            foreach (var tag in tagsInUse)
            {
                var choice = new AdaptiveChoice
                {
                    Title = tag.Name,
                    Value = tag.Id.ToString(),
                };

                choices.Add(choice);
            }

            container.Items.Add(new AdaptiveChoiceSetInput
            {
                Id            = "tags",
                Style         = AdaptiveChoiceInputStyle.Expanded,
                Choices       = choices,
                IsMultiSelect = true,
                Value         = "US",
            });

            adaptiveCard.Body.Add(container);
            adaptiveCard.Actions.Add(new AdaptiveSubmitAction
            {
                Id    = "tags-submit",
                Title = "Submit",
                Type  = "Action.Submit",
            });

            var attachment = new Attachment
            {
                Content     = adaptiveCard,
                ContentType = "application/vnd.microsoft.card.adaptive",
            };

            return(attachment);
        }
        public async Task <IEnumerable <SlackChatHub> > GetChannels()
        {
            IChannelClient client = this._connectionFactory.CreateChannelClient();

            var channelsTask = client.GetChannels(this.SlackKey);
            var groupsTask   = client.GetGroups(this.SlackKey);
            await Task.WhenAll(channelsTask, groupsTask);

            var fromChannels = channelsTask.Result.Select(c => c.ToChatHub());
            var fromGroups   = groupsTask.Result.Select(g => g.ToChatHub());

            return(fromChannels.Concat(fromGroups));
        }
Exemple #9
0
        public DiscoveryDialog(string dialogId, IChannelClient client) : base(dialogId)
        {
            _client = client;

            var steps = new WaterfallStep[]
            {
                GetUsersInterestsStepAsync,
                GetStreamersStepAsync,
            };

            AddDialog(new WaterfallDialog(Constants.DiscoverIntent, steps));
            AddDialog(new TextPrompt(Constants.TagsPrompt));
        }
Exemple #10
0
 public GenericChannel(
     IChannelClient client,
     IPacketBuffer buffer,
     MqttConfiguration configuration)
 {
     _client = client;
     _client.PreferedReceiveBufferSize = configuration.BufferSize;
     _client.PreferedSendBufferSize    = configuration.BufferSize;
     _buffer             = buffer;
     _receiver           = new ReplaySubject <byte[]>(window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs));
     _sender             = new ReplaySubject <byte[]>(window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs));
     _streamSubscription = SubscribeStream();
 }
        //TODO: Cache newly created channel, and return if already exists
        public async Task <SlackChatHub> JoinDirectMessageChannel(string user)
        {
            if (string.IsNullOrEmpty(user))
            {
                throw new ArgumentNullException(nameof(user));
            }

            IChannelClient client  = this._connectionFactory.CreateChannelClient();
            Channel        channel = await client.JoinDirectMessageChannel(this.SlackKey, user);

            return(new SlackChatHub
            {
                Id = channel.Id,
                Name = channel.Name,
                Type = SlackChatHubType.DM
            });
        }
        public WhenNextDialog(string dialogId, IStatePropertyAccessor <UserSelections> userSelectionsState,
                              IChannelClient client) : base(dialogId)
        {
            UserSelectionsState = userSelectionsState;
            _client             = client;

            var whenNextSteps = new WaterfallStep[]
            {
                GetUsersTimezoneStepAsync,
                GetStreamerNameStepAsync,
                GetStreamerInfoStepAsync,
            };

            AddDialog(new WaterfallDialog(Constants.WhenNextIntent, whenNextSteps));
            AddDialog(new SetTimezoneDialog(Constants.SetTimezoneIntent, UserSelectionsState));
            AddDialog(new TextPrompt(Constants.StreamerNamePrompt));
        }
        public async Task <SlackChatHub> CreateChannel(string channelName)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            IChannelClient client  = this._connectionFactory.CreateChannelClient();
            Channel        channel = await client.CreateChannel(this.SlackKey, channelName);

            return(new SlackChatHub
            {
                Id = channel.Id,
                Name = channel.Name,
                Type = SlackChatHubType.Channel
            });
        }
        public ChatBoxBot(ConversationState conversationState, UserState userState, IChannelClient client,
                          QnAMaker qna, LuisRecognizer luis, ILoggerFactory loggerFactory)
        {
            _userState        = userState;
            _converationState = conversationState;
            QnA        = qna;
            Recognizer = luis;
            ConversationDialogState = _converationState.CreateProperty <DialogState>($"{nameof(ChatBox)}.ConversationDialogState");
            UserSelectionsState     = _userState.CreateProperty <UserSelections>($"{nameof(ChatBox)}.UserSelectionsState");

            _logger  = loggerFactory.CreateLogger <ChatBoxBot>();
            _dialogs = new DialogSet(ConversationDialogState);
            _dialogs.Add(new WhenNextDialog(Constants.WhenNextIntent, UserSelectionsState, client));
            _dialogs.Add(new SetTimezoneDialog(Constants.SetTimezoneIntent, UserSelectionsState));
            _dialogs.Add(new LiveNowDialog(Constants.LiveNow, client));
            _dialogs.Add(new DiscoveryDialog(Constants.DiscoverIntent, client));
        }
        public async Task <SlackPurpose> SetChannelPurpose(string channelName, string purpose)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            if (string.IsNullOrEmpty(purpose))
            {
                throw new ArgumentNullException(nameof(purpose));
            }

            IChannelClient client     = this._connectionFactory.CreateChannelClient();
            string         purposeSet = await client.SetPurpose(this.SlackKey, channelName, purpose);

            return(new SlackPurpose
            {
                ChannelName = channelName,
                Purpose = purposeSet
            });
        }
        public async Task <SlackTopic> SetChannelTopic(string channelName, string topic)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            if (string.IsNullOrEmpty(topic))
            {
                throw new ArgumentNullException(nameof(topic));
            }

            IChannelClient client   = this._connectionFactory.CreateChannelClient();
            string         topicSet = await client.SetTopic(this.SlackKey, channelName, topic);

            return(new SlackTopic
            {
                ChannelName = channelName,
                Topic = topicSet
            });
        }
Exemple #17
0
 private void Initialize(IPictureparkServiceSettings settings, HttpClient httpClient)
 {
     Output               = new OutputClient(settings, httpClient);
     OutputFormat         = new OutputFormatClient(settings, httpClient);
     BusinessProcess      = new BusinessProcessClient(settings, httpClient);
     DocumentHistory      = new DocumentHistoryClient(settings, httpClient);
     JsonSchema           = new JsonSchemaClient(settings, httpClient);
     ContentPermissionSet = new ContentPermissionSetClient(settings, httpClient);
     SchemaPermissionSet  = new SchemaPermissionSetClient(settings, httpClient);
     Share          = new ShareClient(settings, httpClient);
     User           = new UserClient(settings, httpClient);
     UserRole       = new UserRoleClient(settings, httpClient);
     Info           = new InfoClient(settings, httpClient);
     Schema         = new SchemaClient(Info, BusinessProcess, settings, httpClient);
     Transfer       = new TransferClient((BusinessProcessClient)BusinessProcess, settings, httpClient);
     ListItem       = new ListItemClient((BusinessProcessClient)BusinessProcess, settings, httpClient);
     LiveStream     = new LiveStreamClient(settings, httpClient);
     Content        = new ContentClient((BusinessProcessClient)BusinessProcess, settings, httpClient);
     Profile        = new ProfileClient(settings, httpClient);
     SchemaTransfer = new SchemaTransferClient(settings, httpClient);
     Channel        = new ChannelClient(settings, httpClient);
 }