public TwitterService(GitHubActionContext gitHubActionContext)
 {
     _credentials = new TwitterCredentials(gitHubActionContext.GetParameter(Parameters.TwitterConsumerId),
                                           gitHubActionContext.GetParameter(Parameters.TwitterConsumerSecret),
                                           gitHubActionContext.GetParameter(Parameters.TwitterAccessToken),
                                           gitHubActionContext.GetParameter(Parameters.TwitterAccessTokenSecret));
 }
        static async Task Main(string[] args)
        {
            GitHubActionContext actionContext = new GitHubActionContext(args);

            actionContext.LoadParameters();

            HandlerRequestContext handlerRequestContext = new HandlerRequestContext();

            var serviceProvider = new ServiceCollection()
                                  .AddLogging(x => x.AddConsole())
                                  .AddGitHubClient(actionContext)
                                  .AddSingleton(actionContext)
                                  .AddSingleton(handlerRequestContext)
                                  .AddSingleton <IJobApplicationService, JobApplicationService>()
                                  .AddSingleton <IEventService, EventService>()
                                  .AddSingleton <ITwitterService, TwitterService>()
                                  .AddSingleton <IObjectScheduledService, ObjectScheduledService>()
                                  .AddSingleton <IIdentityService, IdentityService>()
                                  .AddSingleton <IEasyCronService, EasyCronService>()
                                  .AddHttpClientServices()
                                  .AddMediatR(typeof(Program))
                                  .BuildServiceProvider();

            var jobApplicationService = serviceProvider.GetService <IJobApplicationService>();

            await jobApplicationService.ExecuteJob();
        }
Exemplo n.º 3
0
 public JobApplicationService(ILoggerFactory loggerFactory, GitHubActionContext gitHubActionContext, HandlerRequestContext handlerRequestContext, IMediator mediator, IObjectScheduledService objectScheduledService, IEasyCronService easyCronService)
 {
     _logger = loggerFactory.CreateLogger <JobApplicationService>();
     _gitHubActionContext   = gitHubActionContext;
     _handlerRequestContext = handlerRequestContext;
     _mediator = mediator;
     _objectScheduledService = objectScheduledService;
     _easyCronService        = easyCronService;
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            GitHubActionContext actionContext = new GitHubActionContext(args);

            actionContext.LoadParameters();

            string value = actionContext.GetParameter(Parameters.WhoToGreet);

            Console.WriteLine($"Hello {value}!");
        }
Exemplo n.º 5
0
 public EasyCronService(HttpClient httpclient, GitHubActionContext gitHubActionContext, ILoggerFactory loggerFactory)
 {
     _httpClient           = httpclient;
     _logger               = loggerFactory.CreateLogger <EasyCronService>();
     _easyCronClientSecret = gitHubActionContext.GetParameter(Parameters.EasyCronClientSecret);
 }
Exemplo n.º 6
0
 public OcrService(HttpClient httpClient, GitHubActionContext gitHubActionContext)
 {
     _httpClient          = httpClient;
     _gitHubActionContext = gitHubActionContext;
 }
Exemplo n.º 7
0
 public IdentityService(IHttpClientFactory _httpClientFactory, GitHubActionContext gitHubActionContext, ILoggerFactory loggerFactory)
 {
     _httpClient           = _httpClientFactory.CreateClient();
     _identityClientSecret = gitHubActionContext.GetParameter(Parameters.IdentityClientSecret);
     _logger = loggerFactory.CreateLogger <IdentityService>();
 }
Exemplo n.º 8
0
        public static IServiceCollection AddGitHubClient(this IServiceCollection services, GitHubActionContext gitHubActionContext)
        {
            string       token        = gitHubActionContext.GetParameter(Parameters.GitHubAccessToken);
            GitHubClient githubClient = new GitHubClient(new ProductHeaderValue(nameof(LatinoNETOnline)));
            Credentials  basicAuth    = new Credentials(token);

            githubClient.Credentials = basicAuth;

            services.AddSingleton <IGitHubClient, GitHubClient>(service => githubClient);
            services.AddSingleton <IGitHubService, GitHubService>();

            return(services);
        }