public static IServiceCollection AddGitHubClient(this IServiceCollection services) { services.AddSingleton <IGitHubOptions, GitHubOptions>(sp => { IConfiguration configuration = sp.GetRequiredService <IConfiguration>(); GitHubOptions options = new(); configuration.GetSection(nameof(GitHubOptions)).Bind(options); return(options); }); services.AddSingleton <IGitHubClient, GitHubClient>(sp => { IGitHubOptions options = sp.GetRequiredService <IGitHubOptions>(); GitHubClient githubClient = new(new ProductHeaderValue(nameof(AivenEcommerce))); Credentials basicAuth = new(options.Token); githubClient.Credentials = basicAuth; return(githubClient); }); services.AddSingleton <IGitHubService, GitHubService>(); return(services); }
public GitHubClient(IGitHubOptions options) { octoClient = new OctoClient(ProductHeader); this.options = options; LoadCredentials(); }
public SaleDetailRepository(IGitHubOptions options, IGitHubService githubService, ICachedRepository cachedRepository) : base(githubService, options.SaleDetailRepositoryId, "saledetails") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public ProductImageRepository(IGitHubService githubService, IGitHubOptions options, ICachedRepository cachedRepository) : base(githubService, options.ProductImageRepositoryId, "products") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public AddressRepository(IGitHubService githubService, IGitHubOptions options, ICachedRepository cachedRepository) : base(githubService, options.AddressRepositoryId, "addresses") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public CouponCodeRepository(IGitHubService githubService, IGitHubOptions options, ICachedRepository cachedRepository) : base(githubService, options.CouponCodeRepositoryId, "couponcodes") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public CustomerRepository(IGitHubOptions options, IGitHubService githubService, ICachedRepository cachedRepository) : base(githubService, options.CustomerRepositoryId, "customers") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public WishListRepository(IGitHubService githubService, IGitHubOptions options, ICachedRepository cachedRepository) : base(githubService, options.WishListRepositoryId, "wishlists") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }
public DeliveryRepository(IGitHubService githubService, IGitHubOptions options, ICachedRepository cachedRepository) : base(githubService, options.DeliveryRepositoryId, "deliveries") { _cachedRepository = cachedRepository ?? throw new ArgumentNullException(nameof(cachedRepository)); }