Created
June 28, 2020 15:48
-
-
Save smaglio81/fb6793f38eacc5367f4856756c522c09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Atlassian.Jira; | |
using Microsoft.ApplicationInsights.Extensibility; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Http.Features; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.DependencyInjection.Extensions; | |
namespace YourProject | |
{ | |
public static class IServiceCollectionExtensions | |
{ | |
public static IServiceCollection AddSaEnterpriseAzDPullRequestsWeb( | |
this IServiceCollection services, | |
Action<AzDPullRequestOptions> configure = null | |
) | |
{ | |
services.TryAddTransient<JiraOAuthDelegatingHandler>(); | |
services.TryAddScoped<IAtlassianOAuthenticator, AtlassianOAuthenticator>(); | |
services.AddHttpClient(); | |
services.TryAddTransient<HttpClient>(s => | |
{ | |
var factory = s.GetService<IHttpClientFactory>(); | |
return factory.CreateClient(); | |
}); | |
services.AddHttpClient<IJiraDevInfoHttpClient, JiraDevInfoHttpClient>() | |
.AddHttpMessageHandler<JiraOAuthDelegatingHandler>(); | |
return services; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment