private static IServiceCollection ConfigureCommonServices(this IServiceCollection services)
 {
     services.AddHttpClient <IHttpClientProxy, HttpClientProxy>()
     .AddPolicyHandler(GetRetryPolicy());;
     services.AddTransient <IWebexTeamsApiService, WebexTeamsApiService>();
     services.AddTransient <IChatHelper, WebexTeamsChatHelper>();
     services.AddTransient <IWebhookHelper, WebexTeamsChatHelper>();
     services.AddTransient <IMessageHandler, WebexTeamsMessageHandler>();
     services.AddTransient <IPersonHandler, WebexTeamsPersonHandler>();
     services.AddTransient <IRoomHandler, WebexTeamsRoomHandler>();
     services.AddTransient <IWebexTeamsMessageParser, WebexTeamsMessageParser>();
     services.AddTransient <IWebexTeamsWebhookHandler, WebexTeamsWebhookHandler>();
     services.AddSingleton(WebexTeamsMapperFactory.CreateMapper());
     return(services);
 }
        public static WebexTeamsChatHelper CreateWebexTeamsChatHelper(WebexTeamsSettings settings)
        {
            var httpClient = new HttpClient {
                BaseAddress = new Uri("https://api.ciscospark.com/v1")
            };
            var httpClientProxy = new HttpClientProxy(httpClient, new OptionsWrapper <WebexTeamsSettings>(settings));
            var apiService      = new WebexTeamsApiService(httpClientProxy);

            var mapper        = WebexTeamsMapperFactory.CreateMapper();
            var messageParser = new WebexTeamsMessageParser(mapper);

            var messageHandler = new WebexTeamsMessageHandler(apiService, messageParser, mapper);
            var personHandler  = new WebexTeamsPersonHandler(apiService, mapper);
            var roomHandler    = new WebexTeamsRoomHandler(apiService, mapper);

            var webhooks = new WebexTeamsWebhookHandler(apiService, new OptionsWrapper <WebexTeamsSettings>(settings),
                                                        mapper, messageParser);

            return(new WebexTeamsChatHelper(messageHandler, personHandler, roomHandler, webhooks));
        }