OutlookClient
Handles Outlook OAuth authentication and e-receipt parsing via the Microsoft Graph API.
Package: com.microblink.digital
Declaration
class OutlookClient(
context: Context,
@RawRes configuration: Int,
callback: InitializeCallback
) : Client
configuration is a @RawRes resource ID pointing to a MSAL configuration JSON file with your Azure App Registration client ID and redirect URI.
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 |
Methods
| Method | Description |
|---|---|
login(activity) | Initiates the Outlook OAuth sign-in flow |
logout() | Signs out and clears stored tokens |
signedInAccount() | Returns the currently signed-in Microsoft account |
accounts() | Returns all cached Outlook accounts |
verify() | Validates stored Outlook credentials |
messages() | Fetches and parses e-receipts or parses from raw HTML |
remoteMessages() | Queues a remote scrape job |
clearLastCheckedTime() | Resets the last-checked timestamp |
close() | Releases client resources |
Authentication Methods
login(activity)
fun login(activity: Activity): Task<TokenCredentials>
Initiates the Outlook OAuth sign-in flow.
logout()
fun logout(): Task<Boolean>
fun logout(executor: Executor): Task<Boolean>
Signs out and clears stored tokens.
signedInAccount()
fun signedInAccount(): Task<IAccount>
fun signedInAccount(executor: Executor): Task<IAccount>
Returns the currently signed-in Microsoft account.
accounts()
fun accounts(): Task<List<Credentials.Password>>
fun accounts(executor: Executor): Task<List<Credentials.Password>>
Returns all cached Outlook accounts on the device.
verify()
fun verify(): Task<Boolean>
Validates that stored Outlook credentials are still active.
Parsing Methods
messages()
fun messages(): Task<List<ScanResults>>
Fetches messages (primarily for debugging HTML parsing).
fun messages(executor: Executor): Task<List<ScanResults>>
Fetches messages with an explicit executor.
fun messages(provider: Provider, sender: String, html: String): Task<List<ScanResults>>
Parses e-receipt data from a raw HTML string for testing purposes.
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()
fun remoteMessages(): Task<JobResults>
fun remoteMessages(executor: Executor): Task<JobResults>
Queues a remote scrape job. Returns a JobResults with the job ID.
fun remoteMessages(email: String, eml: String): Task<JobResults>
Queues a remote scrape job using raw EML content.
fun remoteMessages(executor: Executor, email: String, eml: String): Task<JobResults>
Queues a remote scrape job using raw EML content with the specified executor.
clearLastCheckedTime()
fun clearLastCheckedTime(): Task<Boolean>
fun clearLastCheckedTime(executor: Executor): Task<Boolean>
Resets the last-checked timestamp.
Configuration Properties
dayCutoff()
fun dayCutoff(): Int
fun dayCutoff(days: Int)
Search depth in days.
dateCutoff()
fun dateCutoff(): Date?
fun dateCutoff(date: Date)
Specific date boundary, overrides dayCutoff when set.
searchUntil()
fun searchUntil(): Date?
fun searchUntil(date: Date)
Upper boundary for the search period.
countryCode()
fun countryCode(): String?
fun countryCode(code: String)
ISO country code to improve parsing accuracy for region-specific receipts.
sendersToSearch()
fun sendersToSearch(): Map<String, Merchant>?
fun sendersToSearch(senders: Map<String, Merchant>)
Maps sender email addresses to merchant identifiers for filtering.
filterSensitive()
fun filterSensitive(): Boolean
fun filterSensitive(filter: Boolean)
Whether to redact sensitive data from parsed results.
useAggregation()
fun useAggregation(): Boolean
fun useAggregation(aggregate: Boolean)
Whether to aggregate related emails into a single result.
subProducts()
fun subProducts(): Boolean
fun subProducts(enabled: Boolean)
Whether sub-products are included in parsed results.
close()
fun close()
Releases client resources.