class QuoteRepository
Repository for accessing and updating Quotes.
State |
The state of a QuoteRepository. sealed class State |
<init> |
Constructor that allows repository creation from a Context. QuoteRepository(context: Context)
Repository for accessing and updating Quotes. QuoteRepository(database: StockAppDatabase) |
state |
The current State of this repository. val state: LiveData<State> |
fetchQuote |
Fetches the Quote and HistoricalPrices for the requested asset from the respective API, then stores them in the StockAppDatabase. suspend fun fetchQuote(id: String, type: Type): Boolean |
historicalPrices |
Returns a LiveData containing a List of HistoricalPrices for the requested id or null if no such HistoricalPrices exists. fun historicalPrices(id: String): LiveData<List<HistoricalPrice>> |
quoteById |
Returns the Quote with the requested id or null if no such Quote exists. fun quoteById(id: String): Quote? |
quoteWithId |
Returns a LiveData containing the Quote with the requested id or null if no such Quote exists. fun quoteWithId(id: String): LiveData<Quote> |
resetQuotes |
Deletes all quotes from the database. suspend fun resetQuotes(): Unit |