Class ScraperService
Global root where all scrapers are registered.
Inheritance
Inherited Members
Namespace: Subsembly.Scraper
Assembly: Subsembly.Scraper.dll
Syntax
public static class ScraperService
Remarks
Use this static class in order to find and get a scraper implementation. A scraper can be sought for its ability to scrape a particular account using FindScraper(JsonObject). This operation is expensive, therefore its should not be used repeatedly.
In order to enable access to account via FinTS you must add a reference to the
Subsembly.Scraper.FinTS
assembly and call ScraperFinTS.Register()
.
Properties
ApiVersion
Provides the version of the Subsembly XS2A API
Declaration
public static Version ApiVersion { get; }
Property Value
Type | Description |
---|---|
System.Version |
Methods
CreateContact(JsonObject)
Create a new scraper contact object for a given account.
Declaration
public static IScraperContact CreateContact(JsonObject jsAcct)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAcct | Account details of the account that shall be scraped. |
Returns
Type | Description |
---|---|
IScraperContact | If no matching scraper is available for the given account, then |
DownloadStatement(out SepaDocument, JsonObject, JsonObject, DateTime)
Declaration
public static ScraperResult DownloadStatement(out SepaDocument aCamtDoc, JsonObject jsCred, JsonObject jsAcct, DateTime tFromDate)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aCamtDoc | |
JsonObject | jsCred | |
JsonObject | jsAcct | |
System.DateTime | tFromDate |
Returns
Type | Description |
---|---|
ScraperResult |
FindScraper(JsonObject)
Finds the first scraper that can handle the given account.
Declaration
public static IScraper FindScraper(JsonObject jsAcct)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAcct |
Returns
Type | Description |
---|---|
IScraper | If a registered scraper was found that can handle the given account, then the
registered instance is returned. If none was found, then |
FindScraper(String)
Finds a registered scraper by its ClassName.
Declaration
public static IScraper FindScraper(string sClassName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sClassName | A name that uniquely identifies a scraper implementation. This is usually the actual class name of the implementation sans the Scraper prefix. |
Returns
Type | Description |
---|---|
IScraper | If a registered scraper with the given class name was found, then the registered
instance is returned. If none was found, then |
FindScrapers(JsonObject)
Returns a list of all scrapers, that can handle the given account.
Declaration
public static ScraperProductInfo[] FindScrapers(JsonObject jsAcct)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAcct |
Returns
Type | Description |
---|---|
ScraperProductInfo[] | List of ScraperProductInfo that support the given account. This
might be an empty array, if there is no scraper, that is capable of handling
the given account. This is never |
GetAllScrapers(ScraperProductType)
Declaration
public static ScraperProductInfo[] GetAllScrapers(ScraperProductType nProductType)
Parameters
Type | Name | Description |
---|---|---|
ScraperProductType | nProductType |
Returns
Type | Description |
---|---|
ScraperProductInfo[] |
GetProductInfo(JsonObject)
Tries to get the account product information for the given account.
Declaration
public static ScraperProductInfo GetProductInfo(JsonObject jsAcct)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsAcct |
Returns
Type | Description |
---|---|
ScraperProductInfo | If no account product information could be determined for the given account,
then |
LoadObject(JsonObject)
Creates and loads a scraper object that was previously saved by SaveObject(IScraperPersist).
Declaration
public static IScraperPersist LoadObject(JsonObject jsState)
Parameters
Type | Name | Description |
---|---|---|
JsonObject | jsState | The persisted state from a previous call to SaveObject(IScraperPersist).
Must not be |
Returns
Type | Description |
---|---|
IScraperPersist | A new object instance initialized with the data from the given JSON object. |
RegisterBuiltInScrapers()
Registers all built-in scrapers.
Declaration
public static void RegisterBuiltInScrapers()
Remarks
It is not really necessary to call this method, as it is called automatically by FindScraper(JsonObject) or FindScraper(String) whenever the list of registered scrapers is empty.
By default the special ScraperFinTS
, which uses FinTS to access bank
accounts, is NOT included in the registered scrapers. If you want this to be
included, the method ScraperFinTS.Register()
must be called after
this method.
RegisterDummyScraper()
Registers and installs the ScraperDummy as the first entry.
Declaration
public static void RegisterDummyScraper()
RegisterScraper(IScraper)
Declaration
public static void RegisterScraper(IScraper aScraper)
Parameters
Type | Name | Description |
---|---|---|
IScraper | aScraper |
SaveObject(IScraperPersist)
Saves a scraper object with its class name, so that it can be loaded by LoadObject(JsonObject).
Declaration
public static JsonObject SaveObject(IScraperPersist aScraperObject)
Parameters
Type | Name | Description |
---|---|---|
IScraperPersist | aScraperObject | THe scraper object that shall be persisted. Must not be |
Returns
Type | Description |
---|---|
JsonObject | A JSON object that contains the persisted state of the object. |