Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserPrivatePostController"/> class.
 /// </summary>
 /// <param name="logger">Sends logs to the Application Insights service.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 /// <param name="userPrivatePostStorageProvider">User private post storage provider dependency injection.</param>
 /// <param name="postSearchService">The team post search service dependency injection.</param>
 public UserPrivatePostController(
     ILogger <UserPrivatePostController> logger,
     TelemetryClient telemetryClient,
     IUserPrivatePostStorageProvider userPrivatePostStorageProvider,
     IPostSearchService postSearchService)
     : base(telemetryClient)
 {
     this.logger = logger;
     this.userPrivatePostStorageProvider = userPrivatePostStorageProvider;
     this.postSearchService = postSearchService;
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessagingExtensionHelper"/> class.
 /// </summary>
 /// <param name="localizer">The current cultures' string localizer.</param>
 /// <param name="teamPostSearchService">The team post search service dependency injection.</param>
 /// <param name="options">A set of key/value application configuration properties for activity handler.</param>
 /// <param name="postTypeHelper">Handles the post types based on the post type id.</param>
 public MessagingExtensionHelper(
     IStringLocalizer <Strings> localizer,
     IPostSearchService teamPostSearchService,
     IOptions <GoodReadsActivityHandlerOptions> options,
     PostTypeHelper postTypeHelper)
 {
     this.localizer             = localizer;
     this.teamPostSearchService = teamPostSearchService;
     this.postTypeHelper        = postTypeHelper;
     this.options = options ?? throw new ArgumentNullException(nameof(options));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TeamPreferenceController"/> class.
 /// </summary>
 /// <param name="logger">Used to perform logging of errors and information.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 /// <param name="teamPreferenceStorageHelper">Helper to create model for adding team preference and filtering unique tags.</param>
 /// <param name="teamPreferenceStorageProvider">Provider having methods to add and get team preferences from database.</param>
 /// <param name="teamPostSearchService">Search service for fetching posts as per criteria.</param>
 public TeamPreferenceController(
     ILogger <TeamPreferenceController> logger,
     TelemetryClient telemetryClient,
     ITeamPreferenceStorageHelper teamPreferenceStorageHelper,
     ITeamPreferenceStorageProvider teamPreferenceStorageProvider,
     IPostSearchService teamPostSearchService)
     : base(telemetryClient)
 {
     this.logger = logger;
     this.teamPreferenceStorageHelper   = teamPreferenceStorageHelper;
     this.teamPreferenceStorageProvider = teamPreferenceStorageProvider;
     this.teamPostSearchService         = teamPostSearchService;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostController"/> class.
 /// </summary>
 /// <param name="logger">Sends logs to the Application Insights service.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 /// <param name="postStorageHelper">Helper for creating models and filtering posts as per criteria.</param>
 /// <param name="postStorageProvider">Provides methods for add, update and delete post operations from database.</param>
 /// <param name="postSearchService">Post search service for fetching post with search criteria and filters.</param>
 public PostController(
     ILogger <TeamPostController> logger,
     TelemetryClient telemetryClient,
     IPostStorageHelper postStorageHelper,
     IPostStorageProvider postStorageProvider,
     IPostSearchService postSearchService)
     : base(telemetryClient)
 {
     this.logger              = logger;
     this.postStorageHelper   = postStorageHelper;
     this.postStorageProvider = postStorageProvider;
     this.postSearchService   = postSearchService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserVoteController"/> class.
 /// </summary>
 /// <param name="logger">Used to perform logging of errors and information.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 /// <param name="userVoteStorageProvider">Provider for working with user vote data in storage.</param>
 /// <param name="postStorageProvider">Provider to fetch posts from storage.</param>
 /// <param name="postSearchService">Search service instance for fetching posts using filters and search queries.</param>
 public UserVoteController(
     ILogger <TeamPostController> logger,
     TelemetryClient telemetryClient,
     IUserVoteStorageProvider userVoteStorageProvider,
     IPostStorageProvider postStorageProvider,
     IPostSearchService postSearchService)
     : base(telemetryClient)
 {
     this.logger = logger;
     this.userVoteStorageProvider = userVoteStorageProvider;
     this.postStorageProvider     = postStorageProvider;
     this.postSearchService       = postSearchService;
     this.retryPolicy             = Policy.Handle <StorageException>(ex => ex.RequestInformation.HttpStatusCode == StatusCodes.Status412PreconditionFailed)
                                    .WaitAndRetryAsync(Backoff.LinearBackoff(TimeSpan.FromMilliseconds(250), 25));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DigestNotificationHelper"/> class.
 /// </summary>
 /// <param name="logger">Instance to send logs to the Application Insights service.</param>
 /// <param name="localizer">The current cultures' string localizer.</param>
 /// <param name="botOptions">A set of key/value application configuration properties for bot.</param>
 /// <param name="adapter">Bot adapter.</param>
 /// <param name="teamPreferenceStorageProvider">Storage provider for team preference.</param>
 /// <param name="teamPostSearchService">The team post search service dependency injection.</param>
 /// <param name="teamPostStorageHelper">Team post storage helper dependency injection.</param>
 /// <param name="teamTagStorageProvider">Provider to fetch tab configuration for team.</param>
 /// <param name="options">A set of key/value application configuration properties.</param>
 public DigestNotificationHelper(
     ILogger <DigestNotificationHelper> logger,
     IStringLocalizer <Strings> localizer,
     IOptions <BotSettings> botOptions,
     IBotFrameworkHttpAdapter adapter,
     ITeamPreferenceStorageProvider teamPreferenceStorageProvider,
     IPostSearchService teamPostSearchService,
     IPostStorageHelper teamPostStorageHelper,
     ITeamTagStorageProvider teamTagStorageProvider,
     IOptions <GoodReadsActivityHandlerOptions> options)
 {
     this.logger     = logger;
     this.localizer  = localizer;
     this.botOptions = botOptions ?? throw new ArgumentNullException(nameof(botOptions));
     this.adapter    = adapter;
     this.teamPreferenceStorageProvider = teamPreferenceStorageProvider;
     this.teamPostSearchService         = teamPostSearchService;
     this.teamTagStorageProvider        = teamTagStorageProvider;
     this.teamPostStorageHelper         = teamPostStorageHelper;
     this.options     = options;
     this.retryPolicy = Policy.Handle <Exception>()
                        .WaitAndRetryAsync(Backoff.DecorrelatedJitterBackoffV2(TimeSpan.FromMilliseconds(this.botOptions.Value.MedianFirstRetryDelay), this.botOptions.Value.RetryCount));
 }