Use maps for JSON output.

This commit is contained in:
akwizgran
2018-09-21 18:15:29 +01:00
committed by Torsten Grote
parent cf033dc29d
commit bda52ea548
12 changed files with 157 additions and 218 deletions

View File

@@ -1,21 +1,13 @@
package org.briarproject.bramble.identity
import org.briarproject.bramble.api.identity.Author
import javax.annotation.concurrent.Immutable
@Immutable
data class OutputAuthor(
val id: ByteArray,
val name: String,
val publicKey: ByteArray
) {
constructor(author: Author) : this(
id = author.id.bytes,
name = author.name,
publicKey = author.publicKey
)
}
fun Author.output() = OutputAuthor(this)
fun Author.output() = mapOf(
"formatVersion" to formatVersion,
"id" to id.bytes,
"name" to name,
"publicKey" to publicKey
)
fun Author.Status.output() = name.toLowerCase()