mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Use JsonDict for blog post headers.
This commit is contained in:
@@ -1,20 +1,25 @@
|
|||||||
package org.briarproject.briar.headless.blogs
|
package org.briarproject.briar.headless.blogs
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.sync.MessageId
|
||||||
import org.briarproject.bramble.identity.output
|
import org.briarproject.bramble.identity.output
|
||||||
import org.briarproject.briar.api.blog.BlogPostHeader
|
import org.briarproject.briar.api.blog.BlogPostHeader
|
||||||
import org.briarproject.briar.api.blog.MessageType
|
import org.briarproject.briar.api.blog.MessageType
|
||||||
|
import org.briarproject.briar.headless.json.JsonDict
|
||||||
|
|
||||||
internal fun BlogPostHeader.output(body: String) = mapOf(
|
internal fun BlogPostHeader.output(body: String): JsonDict {
|
||||||
"body" to body,
|
val dict = JsonDict(
|
||||||
"author" to author.output(),
|
"body" to body,
|
||||||
"authorStatus" to authorStatus.output(),
|
"author" to author.output(),
|
||||||
"type" to type.output(),
|
"authorStatus" to authorStatus.output(),
|
||||||
"id" to id.bytes,
|
"type" to type.output(),
|
||||||
"parentId" to parentId?.bytes,
|
"id" to id.bytes,
|
||||||
"read" to isRead,
|
"read" to isRead,
|
||||||
"rssFeed" to isRssFeed,
|
"rssFeed" to isRssFeed,
|
||||||
"timestamp" to timestamp,
|
"timestamp" to timestamp,
|
||||||
"timestampReceived" to timeReceived
|
"timestampReceived" to timeReceived
|
||||||
)
|
)
|
||||||
|
if (parentId != null) dict.put("parentId", (parentId as MessageId).bytes)
|
||||||
|
return dict
|
||||||
|
}
|
||||||
|
|
||||||
internal fun MessageType.output() = name.toLowerCase()
|
internal fun MessageType.output() = name.toLowerCase()
|
||||||
|
|||||||
Reference in New Issue
Block a user