/// <summary>
 /// Initializes a new instance of the <see cref="TaskModuleActivity"/> class.
 /// </summary>
 /// <param name="configurationProvider">Configuration Provider.</param>
 /// <param name="qnaServiceProvider">QnA service provider.</param>
 /// <param name="logger">Instance to send logs to the Application Insights service.</param>
 /// <param name="qnaPairServiceFacade">Instance of QnA pair service class to call add/update/get QnA pair.</param>
 public TaskModuleActivity(
     Common.Providers.IConfigurationDataProvider configurationProvider,
     IQnaServiceProvider qnaServiceProvider,
     ILogger <TaskModuleActivity> logger,
     IQnAPairServiceFacade qnaPairServiceFacade)
 {
     this.configurationProvider = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
     this.qnaServiceProvider    = qnaServiceProvider ?? throw new ArgumentNullException(nameof(qnaServiceProvider));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.qnaPairServiceFacade = qnaPairServiceFacade ?? throw new ArgumentNullException(nameof(qnaPairServiceFacade));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConversationService"/> class.
 /// </summary>
 /// <param name="configurationProvider">Configuration Provider.</param>
 /// <param name="logger">Instance to send logs to the Application Insights service.</param>
 /// <param name="qnaPairServiceFacade">Instance of QnA pair service class to call add/update/get QnA pair.</param>
 /// <param name="ticketsProvider">Instance of Ticket provider helps in fetching and storing information in storage table.</param>
 /// <param name="notificationService">Notifies in expert's Team chat.</param>
 public ConversationService(
     Common.Providers.IConfigurationDataProvider configurationProvider,
     IQnAPairServiceFacade qnaPairServiceFacade,
     ITicketsProvider ticketsProvider,
     INotificationService notificationService,
     ILogger <ConversationService> logger)
 {
     this.configurationProvider = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
     this.ticketsProvider       = ticketsProvider ?? throw new ArgumentNullException(nameof(ticketsProvider));
     this.notificationService   = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.qnaPairServiceFacade = qnaPairServiceFacade ?? throw new ArgumentNullException(nameof(qnaPairServiceFacade));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="QnAPairServiceFacade"/> class.
        /// </summary>
        /// <param name="configurationProvider">Configuration Provider.</param>
        /// <param name="activityStorageProvider">Activity storage provider.</param>
        /// <param name="qnaServiceProvider">QnA service provider.</param>
        /// <param name="botSettings">Represents a set of key/value application configuration properties for FaqPlusPlus bot.</param>ram>
        /// <param name="logger">Instance to send logs to the Application Insights service.</param>
        public QnAPairServiceFacade(
            Common.Providers.IConfigurationDataProvider configurationProvider,
            IQnaServiceProvider qnaServiceProvider,
            IActivityStorageProvider activityStorageProvider,
            IOptionsMonitor<BotSettings> botSettings,
            ILogger<QnAPairServiceFacade> logger)
        {
            this.configurationProvider = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
            this.qnaServiceProvider = qnaServiceProvider ?? throw new ArgumentNullException(nameof(qnaServiceProvider));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
            this.activityStorageProvider = activityStorageProvider ?? throw new ArgumentNullException(nameof(activityStorageProvider));
            if (botSettings == null)
            {
                throw new ArgumentNullException(nameof(botSettings));
            }

            this.options = botSettings.CurrentValue;
            this.appBaseUri = this.options.AppBaseUri;
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessagingExtensionActivity"/> class.
        /// </summary>
        /// <param name="configurationProvider">Configuration Provider.</param>
        /// <param name="activityStorageProvider">Activity storage provider.</param>
        /// <param name="qnaServiceProvider">Question and answer maker service provider.</param>
        /// <param name="searchService">SearchService dependency injection.</param>
        /// <param name="botAdapter">Bot adapter dependency injection.</param>
        /// <param name="memoryCache">IMemoryCache dependency injection.</param>
        /// <param name="knowledgeBaseSearchService">KnowledgeBaseSearchService dependency injection.</param>
        /// <param name="optionsAccessor">A set of key/value application configuration properties for FaqPlusPlus bot.</param>
        /// <param name="logger">Instance to send logs to the Application Insights service.</param>
        /// <param name="ticketsProvider">Instance of Ticket provider helps in fetching and storing information in storage table.</param>
        /// <param name="notificationService">Notifies in expert's Team chat.</param>
        public MessagingExtensionActivity(
            Common.Providers.IConfigurationDataProvider configurationProvider,
            IQnaServiceProvider qnaServiceProvider,
            IActivityStorageProvider activityStorageProvider,
            ISearchService searchService,
            BotFrameworkAdapter botAdapter,
            IMemoryCache memoryCache,
            IKnowledgeBaseSearchService knowledgeBaseSearchService,
            IOptionsMonitor <BotSettings> optionsAccessor,
            ILogger <MessagingExtensionActivity> logger,
            ITicketsProvider ticketsProvider,
            INotificationService notificationService)
        {
            this.configurationProvider   = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
            this.qnaServiceProvider      = qnaServiceProvider ?? throw new ArgumentNullException(nameof(qnaServiceProvider));
            this.activityStorageProvider = activityStorageProvider ?? throw new ArgumentNullException(nameof(activityStorageProvider));
            this.searchService           = searchService ?? throw new ArgumentNullException(nameof(searchService));
            this.botAdapter  = botAdapter ?? throw new ArgumentNullException(nameof(botAdapter));
            this.accessCache = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache));
            this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
            this.knowledgeBaseSearchService = knowledgeBaseSearchService ?? throw new ArgumentNullException(nameof(knowledgeBaseSearchService));
            this.ticketsProvider            = ticketsProvider ?? throw new ArgumentNullException(nameof(ticketsProvider));
            this.notificationService        = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
            if (optionsAccessor == null)
            {
                throw new ArgumentNullException(nameof(optionsAccessor));
            }

            this.options    = optionsAccessor.CurrentValue;
            this.appId      = this.options.ExpertAppId;
            this.appBaseUri = this.options.AppBaseUri;
            this.accessCacheExpiryInDays = this.options.AccessCacheExpiryInDays;
            if (this.accessCacheExpiryInDays <= 0)
            {
                this.accessCacheExpiryInDays = DefaultAccessCacheExpiryInDays;
                this.logger.LogInformation($"Configuration option is not present or out of range for AccessCacheExpiryInDays and the default value is set to: {this.accessCacheExpiryInDays}", SeverityLevel.Information);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BotCommandResolver"/> class.
        /// </summary>
        /// <param name="configurationProvider">Configuration Provider.</param>
        /// <param name="activityStorageProvider">Activity storage provider.</param>
        /// <param name="qnaServiceProvider">QnA service provider.</param>
        /// <param name="logger">Instance to send logs to the Application Insights service.</param>
        /// <param name="qnaPairService">Instance of QnA pair service class to call add/update/get QnA pair.</param>
        /// <param name="botSettings">Represents a set of key/value application configuration properties for FaqPlusPlus bot.</param>
        /// <param name="conversationService">Conversation service to send adaptive card in personal and teams chat.</param>
        public BotCommandResolver(
            Common.Providers.IConfigurationDataProvider configurationProvider,
            IQnaServiceProvider qnaServiceProvider,
            IActivityStorageProvider activityStorageProvider,
            IQnAPairServiceFacade qnaPairService,
            IOptionsMonitor <BotSettings> botSettings,
            ILogger <BotCommandResolver> logger,
            IConversationService conversationService)
        {
            this.configurationProvider   = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
            this.qnaServiceProvider      = qnaServiceProvider ?? throw new ArgumentNullException(nameof(qnaServiceProvider));
            this.activityStorageProvider = activityStorageProvider ?? throw new ArgumentNullException(nameof(activityStorageProvider));
            this.logger              = logger ?? throw new ArgumentNullException(nameof(logger));
            this.qnaPairService      = qnaPairService ?? throw new ArgumentNullException(nameof(qnaPairService));
            this.conversationService = conversationService ?? throw new ArgumentNullException(nameof(conversationService));
            if (botSettings == null)
            {
                throw new ArgumentNullException(nameof(botSettings));
            }

            var options = botSettings.CurrentValue;

            this.appBaseUri = options.AppBaseUri;
        }