app / de.uniks.codliners.stock_simulator.repository / NewsRepository

NewsRepository

class NewsRepository

Interface for fetching and resetting News.

Types

State

The different states of news fetching.

sealed class State

Constructors

<init>

Constructor that allows repository creation from a Context.

NewsRepository(context: Context)

Interface for fetching and resetting News.

NewsRepository(database: StockAppDatabase)

Properties

news

Lazily initialized LiveData containing an ordered List of all locally stored News.

val news: LiveData<List<News>>

state

The current State of the repository.

val state: LiveData<State>

Functions

fetchNews

Fetches all available news from the IEX API, then stores them in the StockAppDatabase.

suspend fun fetchNews(symbol: String): Unit

resetNews

Deletes all news from the database.

suspend fun resetNews(): Unit