SolidNotificationsClient

Client SDK for the sharing notification inbox, built on Linked Data Notifications (LDN). Lets an app read incoming share notifications and access requests from the user's inbox, and send the matching outgoing notifications.

This layer is pull-only: there is no push subscription. The expected usage:

  • call listNotifications / listRequests from a PeriodicWorkRequest(15.minutes) worker for background sync;

  • call them again on user-initiated refresh (pull-to-refresh, tab open).

Calls are delegated over IPC to the Android Solid Services app. Obtain an instance via Solid.getNotificationsClient; collect connectionState and wait for true before issuing calls. All operations are suspend functions and throw SolidException on failure.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun compactInbox(webId: String, olderThanIso: String? = null)

Deletes Offer/Undo pairs that cancel out and (optionally) items older than olderThanIso. The IPC layer doesn't propagate the delete count back; callers needing it should drive the manager in-process.

Link copied to clipboard

Hot Flow of the IPC service connection state; emits true once connected.

Link copied to clipboard
suspend fun deleteNotification(webId: String, notificationUri: String): Boolean

Deletes a single message from the inbox.

Link copied to clipboard
suspend fun ensureInbox(webId: String): String

Ensures the user has an LDN inbox, creating and advertising it if absent.

Link copied to clipboard

Returns the share notifications currently in webId's inbox (offers, accepts, withdrawals, rejections).

Link copied to clipboard
suspend fun listRequests(webId: String): List<ShareRequest>

Returns the access requests in webId's inbox — others asking for access to this user's resources.

Link copied to clipboard
suspend fun recordDecisionGranted(ownerWebId: String, requesterWebId: String, resourceUri: String, mode: ShareMode, requestUri: String? = null)

Leaves a read-only record in the owner's OWN inbox that they granted a request — the "you approved sharing with X" row they see in their own history.

Link copied to clipboard
suspend fun recordDecisionRejected(ownerWebId: String, requesterWebId: String, resourceUri: String, mode: ShareMode? = null, reason: String? = null)

Leaves a read-only record in the owner's OWN inbox that they declined a request.

Link copied to clipboard
suspend fun sendAccept(ownerWebId: String, requesterWebId: String, resourceUri: String, mode: ShareMode, requestUri: String? = null)

Tells a requester that their access request was granted.

Link copied to clipboard
suspend fun sendOffer(ownerWebId: String, receiverWebId: String, resourceUri: String, mode: ShareMode, resourceType: String? = null, resourceName: String? = null)

Notifies receiverWebId that ownerWebId has granted them mode access to resourceUri. resourceType / resourceName describe the object of a typed (entity) share — the entity's RDF class IRI and human title; both null for plain resource shares.

Link copied to clipboard
suspend fun sendReject(ownerWebId: String, requesterWebId: String, resourceUri: String, reason: String? = null)

Declines requesterWebId's access request for resourceUri, with an optional reason.

Link copied to clipboard
suspend fun sendRequest(requesterWebId: String, ownerWebId: String, resourceUri: String, requestedMode: ShareMode, summary: String? = null)

Asks ownerWebId for requestedMode access to resourceUri on behalf of requesterWebId, with an optional summary message.

Link copied to clipboard
suspend fun sendUndo(ownerWebId: String, receiverWebId: String, resourceUri: String)

Notifies receiverWebId that their access to resourceUri has been withdrawn.

Link copied to clipboard
suspend fun sendUpdate(ownerWebId: String, receiverWebId: String, resourceUri: String, mode: ShareMode, resourceType: String? = null, resourceName: String? = null)

Tells a receiver their access level changed. This is an as:Update — deliberately not a re-Offer, so the receiver sees "X updated your access" rather than a fresh share. resourceType / resourceName behave as on sendOffer.