mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-12 00:26:57 +01:00
Replaces deprecated put method
This commit is contained in:
@@ -37,26 +37,26 @@ class JsonFilter(
|
|||||||
val filter =
|
val filter =
|
||||||
factory.objectNode().apply {
|
factory.objectNode().apply {
|
||||||
ids?.run {
|
ids?.run {
|
||||||
put(
|
replace(
|
||||||
"ids",
|
"ids",
|
||||||
factory.arrayNode(ids.size).apply { ids.forEach { add(it) } },
|
factory.arrayNode(ids.size).apply { ids.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
authors?.run {
|
authors?.run {
|
||||||
put(
|
replace(
|
||||||
"authors",
|
"authors",
|
||||||
factory.arrayNode(authors.size).apply { authors.forEach { add(it) } },
|
factory.arrayNode(authors.size).apply { authors.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
kinds?.run {
|
kinds?.run {
|
||||||
put(
|
replace(
|
||||||
"kinds",
|
"kinds",
|
||||||
factory.arrayNode(kinds.size).apply { kinds.forEach { add(it) } },
|
factory.arrayNode(kinds.size).apply { kinds.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
tags?.run {
|
tags?.run {
|
||||||
entries.forEach { kv ->
|
entries.forEach { kv ->
|
||||||
put(
|
replace(
|
||||||
"#${kv.key}",
|
"#${kv.key}",
|
||||||
factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } },
|
factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ data class Subscription(
|
|||||||
return factory.objectNode().apply {
|
return factory.objectNode().apply {
|
||||||
put("id", id)
|
put("id", id)
|
||||||
typedFilters?.also { filters ->
|
typedFilters?.also { filters ->
|
||||||
put(
|
replace(
|
||||||
"typedFilters",
|
"typedFilters",
|
||||||
factory.arrayNode(filters.size).apply {
|
factory.arrayNode(filters.size).apply {
|
||||||
filters.forEach { filter -> add(filter.toJsonObject()) }
|
filters.forEach { filter -> add(filter.toJsonObject()) }
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ class TypedFilter(
|
|||||||
val factory = Event.mapper.nodeFactory
|
val factory = Event.mapper.nodeFactory
|
||||||
|
|
||||||
return factory.objectNode().apply {
|
return factory.objectNode().apply {
|
||||||
put("types", typesToJson(types))
|
replace("types", typesToJson(types))
|
||||||
put("filter", filterToJson(filter))
|
replace("filter", filterToJson(filter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,26 +50,26 @@ class TypedFilter(
|
|||||||
val factory = Event.mapper.nodeFactory
|
val factory = Event.mapper.nodeFactory
|
||||||
return factory.objectNode().apply {
|
return factory.objectNode().apply {
|
||||||
filter.ids?.run {
|
filter.ids?.run {
|
||||||
put(
|
replace(
|
||||||
"ids",
|
"ids",
|
||||||
factory.arrayNode(filter.ids.size).apply { filter.ids.forEach { add(it) } },
|
factory.arrayNode(filter.ids.size).apply { filter.ids.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
filter.authors?.run {
|
filter.authors?.run {
|
||||||
put(
|
replace(
|
||||||
"authors",
|
"authors",
|
||||||
factory.arrayNode(filter.authors.size).apply { filter.authors.forEach { add(it) } },
|
factory.arrayNode(filter.authors.size).apply { filter.authors.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
filter.kinds?.run {
|
filter.kinds?.run {
|
||||||
put(
|
replace(
|
||||||
"kinds",
|
"kinds",
|
||||||
factory.arrayNode(filter.kinds.size).apply { filter.kinds.forEach { add(it) } },
|
factory.arrayNode(filter.kinds.size).apply { filter.kinds.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
filter.tags?.run {
|
filter.tags?.run {
|
||||||
entries.forEach { kv ->
|
entries.forEach { kv ->
|
||||||
put(
|
replace(
|
||||||
"#${kv.key}",
|
"#${kv.key}",
|
||||||
factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } },
|
factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ open class Event(
|
|||||||
put("pubkey", pubKey)
|
put("pubkey", pubKey)
|
||||||
put("created_at", createdAt)
|
put("created_at", createdAt)
|
||||||
put("kind", kind)
|
put("kind", kind)
|
||||||
put(
|
replace(
|
||||||
"tags",
|
"tags",
|
||||||
factory.arrayNode(tags.size).apply {
|
factory.arrayNode(tags.size).apply {
|
||||||
tags.forEach { tag ->
|
tags.forEach { tag ->
|
||||||
|
|||||||
Reference in New Issue
Block a user