Copyright | (c) Owen Shepherd 2022 |
---|---|
License | MIT |
Maintainer | owen@owen.cafe |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data ApiError
- type ApiResult = Either ApiError
- fetchCompanyList :: (MonadThrow m, MonadIO m) => SimFinContext -> m (Either ApiError [CompanyListingRow])
- performRequest :: (MonadIO m, FromJSON a) => SimFinContext -> ByteString -> [QueryParam] -> m (ApiResult a)
Documentation
Represents all the types of error the server returns, and that we can encounter on our side.
DecodeError ByteString String | Can't turn ByteString into JSON |
ParseError Value String | Can't turn JSON into result type |
Other Text | Server returned '{"error": "..."}' along with a non-200 status code. This could in theory be parsed into machine-readable format, with variants such as `InvalidApiKey | RateLimited | ...`, but the API doesn't guarantee error message stability. |
type ApiResult = Either ApiError Source #
The result of calling fetch* is either an error or a successful result.
fetchCompanyList :: (MonadThrow m, MonadIO m) => SimFinContext -> m (Either ApiError [CompanyListingRow]) Source #
Fetch a list of company tickers and SimFin ids. This is the only endpoint common to free and paid customers.
performRequest :: (MonadIO m, FromJSON a) => SimFinContext -> ByteString -> [QueryParam] -> m (ApiResult a) Source #
Make a request, all fetch* functions call this.