Added ListenForNewMailsOptions so that there onEmailReceived has to be set
This commit is contained in:
parent
31ba07d5e9
commit
e0b4550cd3
|
@ -34,7 +34,7 @@ open class EmailsFetcher(
|
|||
protected val log by logger()
|
||||
|
||||
|
||||
open fun listenForNewEmails(account: EmailAccount, options: FetchEmailsOptions) = runBlocking {
|
||||
open fun listenForNewEmails(account: EmailAccount, options: ListenForNewMailsOptions) = runBlocking {
|
||||
try {
|
||||
connect(account) { store ->
|
||||
val folder = store.getFolder(options.emailFolderName)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package net.codinux.invoicing.email
|
||||
|
||||
data class FetchEmailsOptions(
|
||||
open class FetchEmailsOptions(
|
||||
val downloadMessageBody: Boolean = false,
|
||||
val emailFolderName: String = "INBOX",
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package net.codinux.invoicing.email
|
||||
|
||||
open class ListenForNewMailsOptions(
|
||||
downloadMessageBody: Boolean = false,
|
||||
emailFolderName: String = "INBOX",
|
||||
|
||||
onError: ((FetchEmailsError) -> Unit)? = null,
|
||||
onEmailReceived: (EmailWithInvoice) -> Unit
|
||||
) : FetchEmailsOptions(downloadMessageBody, emailFolderName, onError, onEmailReceived) {
|
||||
}
|
Loading…
Reference in New Issue