ImapClient
Handles e-receipt parsing from IMAP email accounts (Gmail IMAP, Yahoo, AOL, and custom IMAP providers).
Package: com.microblink.digital
Declaration
class ImapClient(context: Context, callback: InitializeCallback) : Client
class ImapClient(context: Context, threads: Int, callback: InitializeCallback) : Client
Quick Reference
Properties
| Property | Description |
|---|---|
dayCutoff | Search depth in days |
dateCutoff | Specific date boundary, overrides dayCutoff |
searchUntil | Upper boundary for the search period |
countryCode | ISO country code for parsing accuracy |
sendersToSearch | Maps sender email addresses to merchant identifiers |
filterSensitive | Whether to redact sensitive data from results |
useAggregation | Whether to aggregate related emails into a single result |
subProducts | Whether sub-products are included in results |
overrideDate | Override the cutoff date for this client instance |
overrideEndpoint | Override the server-side endpoint for result posting |
Methods
| Method | Description |
|---|---|
link(credentials) | Links an IMAP account |
verify(credentials) | Validates that credentials can authenticate |
logout() | Unlinks and removes stored IMAP credentials |
accounts() | Returns all linked IMAP accounts |
messages(credentials) | Fetches and parses e-receipts |
remoteMessages(credentials) | Queues a remote scrape job |
rawEmails(flag) | Enables raw email content in results |
clearLastCheckedTime() | Resets the last-checked timestamp |
close() | Releases client resources |
Configuration Properties
dayCutoff
var dayCutoff: Int
Search depth in days.
dateCutoff
var dateCutoff: Date?
Specific date boundary, overrides dayCutoff.
searchUntil
var searchUntil: Date?
Upper boundary for the search period.
countryCode
var countryCode: String
ISO country code for parsing accuracy.
sendersToSearch
var sendersToSearch: Map<String, Merchant>?
Maps sender email addresses to merchant identifiers for filtering.
filterSensitive
var filterSensitive: Boolean
Whether to redact sensitive data from results.
useAggregation
var useAggregation: Boolean
Whether to aggregate related emails into a single result.
subProducts
var subProducts: Boolean
Whether sub-products are included in parsed results.
overrideDate
var overrideDate: Date?
Override the cutoff date for this specific client instance.
overrideEndpoint
var overrideEndpoint: String?
Override the server-side endpoint for result posting.
Methods
link(credentials)
fun link(credentials: Credentials.Password): Task<ProviderSetupResults>
fun link(executor: Executor, credentials: Credentials.Password): Task<ProviderSetupResults>
Links an IMAP account with the given credentials. Returns a ProviderSetupResults value indicating the outcome of the setup flow.
verify(credentials)
fun verify(credentials: Credentials.Password): Task<Boolean>
fun verify(executor: Executor, credentials: Credentials.Password): Task<Boolean>
Validates that the provided credentials can authenticate successfully.
logout()
fun logout(): Task<Boolean>
fun logout(credentials: Credentials.Password): Task<Boolean>
fun logout(executor: Executor, credentials: Credentials.Password?): Task<Boolean>
Unlinks and removes stored IMAP credentials.
accounts()
fun accounts(): Task<List<Credentials.Password>>
Returns all linked IMAP accounts stored on the device.
messages(credentials)
fun messages(credentials: Credentials.Password): Task<List<ScanResults>>
fun messages(executor: Executor, credentials: Credentials.Password): Task<List<ScanResults>>
Fetches and parses e-receipts from the specified IMAP account.
fun messages(callback: MessagesCallback)
fun messages(executor: Executor, callback: MessagesCallback)
Callback-based variants for fetching and parsing e-receipts.
fun messages(executor: Executor, provider: Provider, sender: String, html: String): Task<List<ScanResults>>
Parses e-receipt data from raw HTML using the specified executor.
remoteMessages(credentials)
fun remoteMessages(credentials: Credentials.Password): Task<JobResults>
fun remoteMessages(executor: Executor, credentials: Credentials.Password): Task<JobResults>
Queues a remote scrape job for the specified IMAP account. Returns a JobResults with the job ID.
fun remoteMessages(callback: JobResultsCallback)
fun remoteMessages(executor: Executor, callback: JobResultsCallback)
Callback-based variants for queuing a remote scrape job.
fun remoteMessages(email: String, provider: Provider, eml: String): Task<JobResults>
fun remoteMessages(executor: Executor, email: String, provider: Provider, eml: String): Task<JobResults>
Queues a remote scrape job using raw EML content.
rawEmails(flag)
fun rawEmails(flag: Boolean): ImapClient
When true, returns raw email content alongside parsed results. Returns this for chaining.
clearLastCheckedTime()
fun clearLastCheckedTime(): Task<Boolean>
fun clearLastCheckedTime(provider: Provider): Task<Boolean>
fun clearLastCheckedTime(executor: Executor, providers: Array<Provider>): Task<Boolean>
Resets the last-checked timestamp. Can target a specific provider or an array of providers.
close()
fun close()
Releases client resources.