AccountMedia

Logical media operations and authenticated gallery queries.

Functions

Link copied to clipboard
suspend fun authorizeUpload(method: String, url: String, payloadSha256: String): HttpAuthorizationPlan

Sign an exact upload plan using the lowercase hexadecimal SHA-256 required by the service. Softrelay /api/v2/files authenticates the multipart file part (ciphertext for encrypted uploads), excluding the multipart envelope. The host owns that streaming hash and HTTP body.

Link copied to clipboard
suspend fun cancel(operationId: String): MediaOperation

Cancel an operation before message publication.

Link copied to clipboard

Cancel one unpublished attachment-dependent message atomically.

Link copied to clipboard
suspend fun claim(operationId: String, leaseId: String, leaseDurationSeconds: Int = 300): MediaLease?

Claim one exact recoverable transfer after the lease commits durably.

Link copied to clipboard
suspend fun complete(lease: MediaLease, attachment: AttachmentMetadata, byteCount: ULong): MediaCompletion

Commit final authenticated attachment metadata for the matching lease.

Link copied to clipboard
suspend fun downloads(messageId: MessageId): List<MediaOperation>

Existing downloads for the live message's current attachments; never prepares or schedules work.

Link copied to clipboard
suspend fun fail(lease: MediaLease, category: String): MediaOperation

Finish one lease with a permanent redacted failure category.

Link copied to clipboard
suspend fun failRetryable(lease: MediaLease, category: String): MediaOperation

Finish one lease with a redacted retryable failure category.

Link copied to clipboard
suspend fun gallery(conversationId: ConversationId? = null, before: MessageCursor? = null, limit: Int = 50): List<MediaItem>

Return a bounded newest-first authenticated media gallery.

Link copied to clipboard

Observe exact message downloads, independent of the recent-operation window.

Link copied to clipboard
fun observeGallery(conversationId: ConversationId? = null, before: MessageCursor? = null, limit: Int = 50): Flow<List<MediaItem>>

Observe a bounded gallery after durable account changes.

Link copied to clipboard
fun observeOperation(operationId: String): Flow<MediaOperation?>

Observe one exact logical transfer without depending on a bounded newest-first page.

Link copied to clipboard
fun observeOperations(limit: Int = 50): Flow<List<MediaOperation>>

Observe logical operations after durable account changes.

Link copied to clipboard

Observe a bounded exact ID set without depending on the newest-first UI page.

Link copied to clipboard

Observe durable asset replacements after account mutations.

Link copied to clipboard

Observe one attachment-dependent message intent.

Link copied to clipboard

Observe attachment-dependent message intents after durable changes.

Link copied to clipboard
suspend fun operation(operationId: String): MediaOperation?

Return one exact logical transfer, including terminal state.

Link copied to clipboard
suspend fun operations(limit: Int = 50): List<MediaOperation>

Return a bounded list of recoverable logical operations.

Link copied to clipboard
suspend fun operationsById(operationIds: List<String>): List<MediaOperation>

Return existing operations for one bounded, unique, exact ID set in caller order.

Link copied to clipboard

Return one exact upload-dependent asset replacement.

Link copied to clipboard

Return a bounded newest-update-first page of asset replacements.

Link copied to clipboard
suspend fun pendingMessage(commandId: CommandId): PendingMediaMessage?

Return one attachment-dependent message intent.

Link copied to clipboard
suspend fun pendingMessages(limit: Int = 50): List<PendingMediaMessage>

Return a bounded newest-update-first page of attachment-dependent messages.

Link copied to clipboard

Persist a public conversation-icon upload and dependent subject update.

Link copied to clipboard

Prepare or return the stable download for the current authenticated conversation icon.

Link copied to clipboard
suspend fun prepareDownload(messageId: MessageId, attachmentUrl: String): MediaOperation

Prepare or return the stable download for an authenticated attachment.

Link copied to clipboard
suspend fun prepareMessage(commandId: CommandId, conversationId: ConversationId, content: MessageContent, sources: List<MediaPreparation>, replyTo: MessageId? = null, draftToConsume: ConversationDraft? = null): PendingMediaMessage

Persist an attachment-dependent message before Android starts any file or HTTP effect.

Link copied to clipboard

Persist a public profile-banner upload and its dependent profile update.

Link copied to clipboard

Persist a public profile-picture upload and its dependent profile update.

Link copied to clipboard
suspend fun prepareTransfer(commandId: CommandId, direction: MediaDirection, sourceFingerprint: String, conversationId: ConversationId? = null): MediaOperation

Persist one logical operation before Android starts a file or HTTP effect.

Link copied to clipboard
suspend fun recoverablePage(cursor: String? = null, limit: Int = 50): MediaOperationPage

Return one stable page of every non-terminal transfer owned by a platform executor.

Link copied to clipboard

Publish every asset replacement whose upload completed before process death.

Link copied to clipboard
suspend fun recoverReadyMessages(limit: Int = 50): List<OperationResult>

Publish every message whose uploads completed before a prior process died.

Link copied to clipboard
suspend fun restartDownload(operationId: String): MediaOperation

Restart a terminal download after cache eviction or explicit user retry.

Link copied to clipboard
suspend fun retry(operationId: String): MediaOperation

Return a retryable operation to prepared state.

Link copied to clipboard
suspend fun uploadUrl(): String

Return the configured or active-relay-derived HTTPS upload endpoint.