public InventoryRepository( IGoogleSheetsService sheetsService, IBookRowMapper bookRowMapper) { this.sheetsService = sheetsService; this.bookRowMapper = bookRowMapper; }
public SalesRepository( IGoogleSheetsService sheetsService, ISaleRowMapper saleRowMapper) { this.sheetsService = sheetsService; this.saleRowMapper = saleRowMapper; }
public ClanLoader( IOptions <ClanListOptions> options, IGoogleSheetsService googleSheets) { this.options = options; this.googleSheets = googleSheets; }
public GoogleSheetsLogger(IServiceProvider serviceProvider, IConfiguration configuration) { this._configuration = configuration; this._dateTimeHelper = serviceProvider.GetService <IDateTimeHelper>(); this._googleSheetsService = serviceProvider.GetService <IGoogleSheetsService>(); this._sheetsId = this._configuration["Google:Sheets:Id"]; }
public GoogleSheetsLogger(IServiceProvider serviceProvider, IConfiguration configuration) { _configuration = configuration; _dateTimeHelper = serviceProvider.GetService <IDateTimeHelper>(); _googleSheetsService = serviceProvider.GetService <IGoogleSheetsService>(); _sheetsId = _configuration["Google:Sheets:Id"]; _interval = int.Parse(_configuration["Google:Sheets:Interval"]); }
public RoutesController(IIOServiceContext context, IHttpContextAccessor httpContextAccessor, IHttpClientFactory clientFactory, IGoogleSheetsService googleSheetsService, IVtexApiService vtexApiService, ISheetsCatalogImportRepository SheetsCatalogImportRepository) { this._context = context ?? throw new ArgumentNullException(nameof(context)); this._httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); this._clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); this._googleSheetsService = googleSheetsService ?? throw new ArgumentNullException(nameof(googleSheetsService)); this._vtexApiService = vtexApiService ?? throw new ArgumentNullException(nameof(vtexApiService)); this._sheetsCatalogImportRepository = SheetsCatalogImportRepository ?? throw new ArgumentNullException(nameof(SheetsCatalogImportRepository)); }
public GoogleSheetsUpdater(IServiceProvider serviceProvider, IConfiguration configuration) { this._configuration = configuration; this._googleSheetsService = serviceProvider.GetService <IGoogleSheetsService>(); this._sheetsId = this._configuration["Google:Sheets:Id"]; Console.WriteLine($"Target Sheets ID: {this._sheetsId}"); }
public HomeController( ApplicationDbContext db, ILogger <HomeController> logger, IGoogleSheetsService googleSheets) { this.db = db; this.logger = logger; this.googleSheets = googleSheets; }
/// <summary> /// Creates a new instance of a GoogleSheets connection. /// </summary> /// <param name="provider">The Google Sheets service provider. See <see cref="SheetsServiceProvider"/> for a default implementation.</param> public GoogleSheets(IGoogleSheetsService provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } SheetsService = provider; }
public CoverageLogTests() { this._stubGoogleSheetsService = Substitute.For <IGoogleSheetsService>(); this._stubConfiguration = Substitute.For <IConfiguration>(); this._stubDateTimeHelper = Substitute.For <IDateTimeHelper>(); this._stubServiceProvider = Substitute.For <IServiceProvider>(); this._stubServiceProvider.GetService <IGoogleSheetsService>().Returns(this._stubGoogleSheetsService); this._stubServiceProvider.GetService <IDateTimeHelper>().Returns(this._stubDateTimeHelper); }
public Application(IOptions <ApplicationConfig> applicationConfig, IOptions <GoogleServiceConfig> googleConfig, IDatabaseInfoService dbInfo, IGoogleSheetsService googleSheets) { _applicationConfig = applicationConfig.Value; _googleServiceConfig = googleConfig.Value; _dbInfo = dbInfo; _googleSheets = googleSheets; }
public Application(IOptions <ApplicationConfig> applicationConfig, IOptions <GoogleServiceConfig> googleConfig, IPgInfoService pgInfo, IGoogleSheetsService googleSheets) { _applicationConfig = applicationConfig.Value; _googleServiceConfig = googleConfig.Value; _pgInfo = pgInfo; _googleSheets = googleSheets; }
public GoogleSheetUpdaterTest() { this._stubFileHelper = Substitute.For <IFileHelper>(); this._stubConfiguration = Substitute.For <IConfiguration>(); this._stubGoogleSheetsService = Substitute.For <IGoogleSheetsService>(); this._stubServiceProvider = Substitute.For <IServiceProvider>(); this._stubServiceProvider.GetService <IFileHelper>().Returns(this._stubFileHelper); this._stubServiceProvider.GetService <IConfiguration>().Returns(this._stubConfiguration); this._stubServiceProvider.GetService <IGoogleSheetsService>().Returns(this._stubGoogleSheetsService); }
public GoogleSheetsUpdater(IServiceProvider serviceProvider, IConfiguration configuration) { _configuration = configuration; _googleSheetsService = serviceProvider.GetService <IGoogleSheetsService>(); _coverageReader = serviceProvider.GetService <ICoverageReader>(); _sheetsId = _configuration["Google:Sheets:Id"]; _interval = int.Parse(_configuration["Google:Sheets:Interval"]); Console.WriteLine($"Target Sheets ID: {_sheetsId}"); }
public WeightSubmitService( IServiceScopeFactory scopeFactory, ILogger <WeightSubmitService> logger, IOptions <WeightSubmitOptions> submitOptions, IGoogleSheetsService googleSheets, IOptions <WeightResultOptions> resultDatabase, IClanLoader clanLoader) { this.scopeFactory = scopeFactory; this.logger = logger; this.submitOptions = submitOptions; this.googleSheets = googleSheets; this.resultDatabase = resultDatabase; this.clanLoader = clanLoader; }
public ClansController( ApplicationDbContext db, IClashApi api, ILogger <ClansController> logger, IGoogleSheetsService googleSheets, IClanLoader clanLoader, IOptions <WeightResultOptions> resultDatabase, WeightSubmitService submitService ) { this.db = db; this.api = api; this.logger = logger; this.googleSheets = googleSheets; this.clanLoader = clanLoader; this.resultDatabase = resultDatabase; this.submitService = submitService; }
private static void DuplicateCoverageLog(IServiceProvider serviceProvider, IGoogleSheetsService googleSheetsService, string sourceId, string targetId) { var dateTimeHelper = serviceProvider.GetService <IDateTimeHelper>(); var now = dateTimeHelper.Now; var sheetName = now.ToString("yyyy"); //// Read var firstRow = 1; var maxRow = string.Empty; var startColumn = "A"; var endColumn = "BH"; var range = $"{sheetName}!{startColumn}{firstRow}:{endColumn}{maxRow}"; Console.WriteLine($"Source Range: {range}"); var sourceList = googleSheetsService.GetValues(sourceId, range); //// Write var targetRange = $"{sheetName}!{startColumn}{firstRow}:{endColumn}{sourceList.Count + 1}"; Console.WriteLine($"Target Range: {targetRange}"); googleSheetsService.SetValue(targetId, targetRange, sourceList); }
private static void DuplicateCoverage(IGoogleSheetsService googleSheetsService, string sourceId, string targetId) { var sheetName = "Coverage"; //// Read var firstRow = 2; var maxRow = string.Empty; var startColumn = "A"; var endColumn = "J"; var range = $"{sheetName}!{startColumn}{firstRow}:{endColumn}{maxRow}"; Console.WriteLine($"Source Range: {range}"); var sourceList = googleSheetsService.GetValues(sourceId, range); var methodList = Program.SheetRangeToEntityList(sourceList); //// Write endColumn = "H"; var targetRange = $"{sheetName}!{startColumn}{firstRow}:{endColumn}{sourceList.Count + 1}"; Console.WriteLine($"Target Range: {targetRange}"); var targetList = Program.EntityListToSheetRange(methodList); googleSheetsService.SetValue(targetId, targetRange, targetList); }
public Query(IGoogleSheetsService googleSheetsService, ISheetsCatalogImportRepository sheetsCatalogImportRepository) { Name = "Query"; FieldAsync <BooleanGraphType>( "haveToken", resolve: async context => { Token token = await googleSheetsService.GetGoogleToken(); return(token != null && !string.IsNullOrEmpty(token.RefreshToken)); } ); /// query Reviews($searchTerm: String, $from: Int, $to: Int, $orderBy: String, $status: Boolean) FieldAsync <StringGraphType>( "getOwnerEmail", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "accountName", Description = "Account Name" } ), resolve: async context => { string email = string.Empty; string accountName = context.GetArgument <string>("accountName"); Token token = await googleSheetsService.GetGoogleToken(); if (token != null) { string productsFolderId = string.Empty; FolderIds folderIds = await sheetsCatalogImportRepository.LoadFolderIds(accountName); if (folderIds != null) { if (!string.IsNullOrEmpty(folderIds.FolderOwner)) { email = folderIds.FolderOwner; } else { productsFolderId = folderIds.ProductsFolderId; ListFilesResponse listFilesResponse = await googleSheetsService.ListSheetsInFolder(productsFolderId); if (listFilesResponse != null) { var owners = listFilesResponse.Files.Select(o => o.Owners.Distinct()).FirstOrDefault(); if (owners != null) { email = owners.Select(o => o.EmailAddress).FirstOrDefault(); } } } } } return(email); } ); FieldAsync <StringGraphType>( "sheetLink", resolve: async context => { return(await googleSheetsService.GetSheetLink()); } ); }
public Mutation(IGoogleSheetsService googleSheetsService, ISheetsCatalogImportRepository sheetsCatalogImportRepository, IVtexApiService vtexApiService) { Name = "Mutation"; Field <BooleanGraphType>( "revokeToken", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "accountName", Description = "Account Name" } ), resolve: context => { bool revoked = googleSheetsService.RevokeGoogleAuthorizationToken().Result; if (revoked) { string accountName = context.GetArgument <string>("accountName"); sheetsCatalogImportRepository.SaveFolderIds(null, accountName); } return(revoked); }); Field <StringGraphType>( "googleAuthorize", resolve: context => { return(googleSheetsService.GetAuthUrl()); }); Field <StringGraphType>( "createSheet", resolve: context => { var created = googleSheetsService.CreateSheet(); vtexApiService.SetBrandList(); return(created); }); Field <StringGraphType>( "processSheet", resolve: context => { return(vtexApiService.ProcessSheet()); }); Field <StringGraphType>( "clearSheet", resolve: context => { var cleared = vtexApiService.ClearSheet(); var catalogAndBrand = vtexApiService.SetBrandList(); return(!string.IsNullOrWhiteSpace(cleared.Result) && catalogAndBrand.Result); }); Field <StringGraphType>( "addImages", resolve: context => { return(vtexApiService.AddImagesToSheet()); }); Field <StringGraphType>( "exportProducts", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "exportQuery", Description = "Export Query" } ), resolve: context => { string query = context.GetArgument <string>("exportQuery"); return(vtexApiService.ExportToSheet(query)); }); }
public GoogleSheetsController(IGoogleSheetsService googleSheetsService) { _googleSheetsService = googleSheetsService; }
/// <summary> /// Конструктор. /// </summary> /// <param name="googleSheets"></param> public GoogleSheetsController(IGoogleSheetsService googleSheets) { _googleSheets = googleSheets; }
public GoogleSheetsReader(IServiceProvider serviceProvider, IConfiguration configuration) { this._googleSheetsService = serviceProvider.GetService <IGoogleSheetsService>(); this._sheetsId = configuration["Google:Sheets:Id"]; }