Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreMessageActivity"/> class.
 /// </summary>
 /// <param name="notificationRepo">Sending notification data repository.</param>
 /// <param name="templateDataRepository">Channel data repository.</param>
 /// <param name="cardCreator">The adaptive card creator.</param>
 public StoreMessageActivity(
     ISendingNotificationDataRepository notificationRepo,
     ITemplateDataRepository templateDataRepository,
     AdaptiveCardCreator cardCreator)
 {
     this.sendingNotificationDataRepository = notificationRepo ?? throw new ArgumentNullException(nameof(notificationRepo));
     this.templateDataRepository            = templateDataRepository ?? throw new ArgumentNullException(nameof(templateDataRepository));
     this.adaptiveCardCreator = cardCreator ?? throw new ArgumentNullException(nameof(cardCreator));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageUpdateService"/> class.
 /// </summary>
 /// <param name="botOptions">The bot options.</param>
 /// <param name="adaptiveCardCreator">The adaptiveCardCreator.</param>
 /// <param name="templateDataRepository">The template data repository.</param>
 /// <param name="botAdapter">The bot adapter.</param>
 public MessageUpdateService(
     IOptions <BotOptions> botOptions,
     AdaptiveCardCreator adaptiveCardCreator,
     ITemplateDataRepository templateDataRepository,
     BotFrameworkHttpAdapter botAdapter)
 {
     this.microsoftAppId         = botOptions?.Value?.UserAppId ?? throw new ArgumentNullException(nameof(botOptions));
     this.adaptiveCardCreator    = adaptiveCardCreator ?? throw new ArgumentNullException(nameof(adaptiveCardCreator));
     this.templateDataRepository = templateDataRepository ?? throw new ArgumentNullException(nameof(templateDataRepository));
     this.botAdapter             = botAdapter ?? throw new ArgumentNullException(nameof(botAdapter));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorTeamsActivityHandler"/> class.
 /// </summary>
 /// <param name="teamsFileUpload">File upload service.</param>
 /// <param name="userDataService">User data service.</param>
 /// <param name="appSettingsService">App Settings service.</param>
 /// <param name="notificationDataRepository">Notification data repository service that deals with the table storage in azure.</param>
 /// <param name="channelDataRepository">ChannelDataRepository.</param>
 /// <param name="adaptiveCardCreator">adaptiveCardCreator .</param>
 /// <param name="templateDataRepository">templateD ataRepository.</param>
 /// <param name="localizer">Localization service.</param>
 public AuthorTeamsActivityHandler(
     TeamsFileUpload teamsFileUpload,
     IUserDataService userDataService,
     IAppSettingsService appSettingsService,
     INotificationDataRepository notificationDataRepository,
     IChannelDataRepository channelDataRepository,
     AdaptiveCardCreator adaptiveCardCreator,
     ITemplateDataRepository templateDataRepository,
     IStringLocalizer <Strings> localizer)
 {
     this.userDataService            = userDataService ?? throw new ArgumentNullException(nameof(userDataService));
     this.teamsFileUpload            = teamsFileUpload ?? throw new ArgumentNullException(nameof(teamsFileUpload));
     this.appSettingsService         = appSettingsService ?? throw new ArgumentNullException(nameof(appSettingsService));
     this.notificationDataRepository = notificationDataRepository ?? throw new ArgumentNullException(nameof(notificationDataRepository));
     this.adaptiveCardCreator        = adaptiveCardCreator ?? throw new ArgumentNullException(nameof(adaptiveCardCreator));
     this.templateDataRepository     = templateDataRepository ?? throw new ArgumentNullException(nameof(templateDataRepository));
     this.channelDataRepository      = channelDataRepository ?? throw new ArgumentNullException(nameof(channelDataRepository));
     this.localizer = localizer ?? throw new ArgumentNullException(nameof(localizer));
 }
        /// <summary>
        /// Create a new channel.
        /// </summary>
        /// <param name="templateRepository">The repository.</param>
        /// <param name="template"> model class instance passed in from Web API.</param>
        /// <returns>The newly created templates's id.</returns>
        public static async Task <string> CreateTemplateAsync(
            this ITemplateDataRepository templateRepository,
            Template template)
        {
            var newId = templateRepository.TableRowKeyGenerator.CreateNewKeyOrderingOldestToMostRecent();

            var templateEntity = new TemplateDataEntity
            {
                PartitionKey = TemplateDataTableNames.TemplatePartition,
                RowKey       = newId,
                TemplateID   = newId,
                TemplateName = template.TemplateName,
                TemplateJSON = template.TemplateJSON,
            };

            await templateRepository.CreateOrUpdateAsync(templateEntity);

            return(newId);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DraftNotificationPreviewService"/> class.
        /// </summary>
        /// <param name="botOptions">The bot options.</param>
        /// <param name="adaptiveCardCreator">Adaptive card creator service.</param>
        /// <param name="companyCommunicatorBotAdapter">Bot framework http adapter instance.</param>
        /// <param name="templateDataRepository">The template data repository.</param>
        /// <param name="sendQueue">The service bus queue for the data queue.</param>
        public DraftNotificationPreviewService(
            IOptions <BotOptions> botOptions,
            AdaptiveCardCreator adaptiveCardCreator,
            CompanyCommunicatorBotAdapter companyCommunicatorBotAdapter,
            ITemplateDataRepository templateDataRepository,
            ISendQueue sendQueue)
        {
            var options = botOptions ?? throw new ArgumentNullException(nameof(botOptions));

            this.botAppId = options.Value.AuthorAppId;
            if (string.IsNullOrEmpty(this.botAppId))
            {
                throw new ApplicationException("AuthorAppId setting is missing in the configuration.");
            }

            this.sendQueue                     = sendQueue ?? throw new ArgumentNullException(nameof(sendQueue));
            this.adaptiveCardCreator           = adaptiveCardCreator ?? throw new ArgumentNullException(nameof(adaptiveCardCreator));
            this.templateDataRepository        = templateDataRepository ?? throw new ArgumentNullException(nameof(templateDataRepository));
            this.companyCommunicatorBotAdapter = companyCommunicatorBotAdapter ?? throw new ArgumentNullException(nameof(companyCommunicatorBotAdapter));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TemplateController"/> class.
 /// </summary>
 /// <param name="templateDataRepository">template data repository instance.</param>
 public TemplateController(
     ITemplateDataRepository templateDataRepository)
 {
     this.templateDataRepository = templateDataRepository ?? throw new ArgumentNullException(nameof(templateDataRepository));
 }