mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 04:57:20 +01:00
Renames internal Req objects
This commit is contained in:
@@ -26,13 +26,13 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.utils.RandomInstance
|
||||
|
||||
class NostrClientDynamicFilterRequest(
|
||||
class NostrClientDynamicReq(
|
||||
val client: INostrClient,
|
||||
val filter: () -> Map<NormalizedRelayUrl, List<Filter>>,
|
||||
val onEvent: (event: Event) -> Unit = {},
|
||||
) : IRequestListener,
|
||||
IOpenNostrRequest {
|
||||
private val subId = RandomInstance.randomChars(10)
|
||||
val subId = RandomInstance.randomChars(10)
|
||||
|
||||
override fun onEvent(
|
||||
event: Event,
|
||||
@@ -59,4 +59,4 @@ class NostrClientDynamicFilterRequest(
|
||||
fun INostrClient.req(
|
||||
filters: () -> Map<NormalizedRelayUrl, List<Filter>>,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientDynamicFilterRequest(this, filters, onEvent)
|
||||
): IOpenNostrRequest = NostrClientDynamicReq(this, filters, onEvent)
|
||||
@@ -27,13 +27,13 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer
|
||||
import com.vitorpamplona.quartz.utils.RandomInstance
|
||||
|
||||
class NostrClientStaticFilterRequest(
|
||||
class NostrClientStaticReq(
|
||||
val client: INostrClient,
|
||||
val filter: Map<NormalizedRelayUrl, List<Filter>>,
|
||||
val onEvent: (event: Event) -> Unit = {},
|
||||
) : IRequestListener,
|
||||
IOpenNostrRequest {
|
||||
private val subId = RandomInstance.randomChars(10)
|
||||
val subId = RandomInstance.randomChars(10)
|
||||
|
||||
override fun onEvent(
|
||||
event: Event,
|
||||
@@ -61,25 +61,25 @@ fun INostrClient.req(
|
||||
relay: NormalizedRelayUrl,
|
||||
filters: List<Filter>,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, mapOf(relay to filters), onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, mapOf(relay to filters), onEvent)
|
||||
|
||||
fun INostrClient.req(
|
||||
relay: NormalizedRelayUrl,
|
||||
filter: Filter,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, mapOf(relay to listOf(filter)), onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, mapOf(relay to listOf(filter)), onEvent)
|
||||
|
||||
fun INostrClient.req(
|
||||
relays: List<NormalizedRelayUrl>,
|
||||
filters: List<Filter>,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, relays.associateWith { filters }, onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, relays.associateWith { filters }, onEvent)
|
||||
|
||||
fun INostrClient.req(
|
||||
relays: List<NormalizedRelayUrl>,
|
||||
filter: Filter,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, relays.associateWith { listOf(filter) }, onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, relays.associateWith { listOf(filter) }, onEvent)
|
||||
|
||||
// -----------------------------------
|
||||
// Helper methods with relay as string
|
||||
@@ -88,10 +88,10 @@ fun INostrClient.req(
|
||||
relay: String,
|
||||
filters: List<Filter>,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, mapOf(RelayUrlNormalizer.normalize(relay) to filters), onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, mapOf(RelayUrlNormalizer.normalize(relay) to filters), onEvent)
|
||||
|
||||
fun INostrClient.req(
|
||||
relay: String,
|
||||
filter: Filter,
|
||||
onEvent: (event: Event) -> Unit = {},
|
||||
): IOpenNostrRequest = NostrClientStaticFilterRequest(this, mapOf(RelayUrlNormalizer.normalize(relay) to listOf(filter)), onEvent)
|
||||
): IOpenNostrRequest = NostrClientStaticReq(this, mapOf(RelayUrlNormalizer.normalize(relay) to listOf(filter)), onEvent)
|
||||
Reference in New Issue
Block a user