WealthsimpleDownloader
public final class WealthsimpleDownloader
Main entry point for the library
-
Callback which is called in case the user needs to authenticate. Needs to return username, password, and one time password
Declaration
Swift
public typealias AuthenticationCallback = (@escaping (String, String, String) -> Void) -> Void -
Creates the Downloader instance
After creating, first call the authenticate method.
Declaration
Swift
public init(authenticationCallback: @escaping AuthenticationCallback, credentialStorage: CredentialStorage)Parameters
authenticationCallbackCallback which is called in case the user needs to authenticate. Needs to return username, password, and one time password. Might be called during any call.
credentialStorageA CredentialStore to save API tokens to. Implementation can be empty, in this case the authenticationCallback will be called every time and not only when the refresh token expired
-
Authneticates against the API. Call before calling any other method.
Declaration
Swift
public func authenticate(completion: @escaping (Error?) -> Void)Parameters
completionGets an error in case something went wrong, otherwise nil
-
Get all Accounts the user has access to
Declaration
Swift
public func getAccounts(completion: @escaping (Result<[Account], AccountError>) -> Void)Parameters
completionResult with an array of
Accounts or anAccount.AccountError -
Declaration
Swift
public func getPositions(in account: Account, date: Date?, completion: @escaping (Result<[Position], PositionError>) -> Void)Parameters
accountAccount to retreive positions for
dateDate of which the positions should be downloaded. If not date is provided, not date is sent to the API. The API falls back to the current date.
completionResult with an array of
Positions or anPosition.PositionError -
Get all
Transactionss from oneAccountDeclaration
Swift
public func getTransactions(in account: Account, startDate: Date?, completion: @escaping (Result<[Transaction], TransactionError>) -> Void)Parameters
accountAccount to retreive transactions from
startDateDate from which the transactions are downloaded. If not date is provided, not date is sent to the API. The API falls back to 30 days ago from today.
completionResult with an array of
Transactionss or anTransactions.TransactionsError
View on GitHub
Install in Dash