Napokue / shop-titans-spreadsheet-fetcher

Fetches data from the Shop Titans spreadsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Archived

This repository is archived. Support for this program will be as is and will no longer be supported and updated. The program will stay working as long as the spreadsheet of Shop Titans does not change or if the API of Google Sheets does not change.

Table of Contents

Shop-titans-spreadsheet-fetcher

Data fetcher from the Shop Titans spreadsheet. Goal of this project is to provide an API via full typed models to easily work with data from the spreadsheet.

The ultimate goal is to be a building block for other applications that want to consume this data.

Usage

Below an example how to use the library. Be aware, a credential json from Google is needed in order to have access to the Google Sheets API, see Acquiring Google Credential JSON.

using System.IO;
using System.Linq;
using SheetModels.Blueprints;
using SheetServices;

var credentialFile = new FileInfo("path-to-credential-json");
var googleSheetsService = new GoogleSheetsService(credentialFile);            
var spreadsheetFetcher = new SpreadsheetFetcher(googleSheetsService);

// By default all data from the blue prints will be fetched
var bluePrints = spreadsheetFetcher.FetchBluePrints().ToList();

// It is also possible to add a filter to the fetch, the main filter "Item" will always be applied during fetching
var filteredBluePrints = spreadsheetFetcher.FetchBluePrints(BlueprintsFetchFlags.Components).ToList();

// Can be exported to JSON
var bluePrintsToJson = bluePrints.Select(blueprint => blueprint.ToJson()).ToList();

// Can be imported from JSON
var bluePrintsFromJson = bluePrintsToJson.Select(Blueprint.FromJson).ToList();

Packages

This project is split into multiple packages. Each package has its own responsibility.

Package Description NuGet
ShopTitansSpreadsheetFetcher.SheetModels Data models of the sheets. NugetNuget
ShopTitansSpreadsheetFetcher.SheetRanges Ranges that are used to excract models from. NugetNuget
ShopTitansSpreadsheetFetcher.SheetServices Services used to fetch the sheets. NugetNuget

Acquiring Google Credential JSON

The GoogleSheetsService requires a credential JSON, acquired from Google's API Key service. Please refer to Google its excelent guide on how to work with this.

About

Fetches data from the Shop Titans spreadsheet

License:MIT License


Languages

Language:C# 100.0%