mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-19 10:28:30 +00:00
deploy: 7b6d93d13b934d5a7fa7c5c1e2e831e2752a95da
This commit is contained in:
parent
5970059070
commit
271ae58b27
@ -259,7 +259,7 @@ procSuite "Waku v2 JSON-RPC API":
|
|||||||
let client = newRpcHttpClient()
|
let client = newRpcHttpClient()
|
||||||
await client.connect("127.0.0.1", rpcPort)
|
await client.connect("127.0.0.1", rpcPort)
|
||||||
|
|
||||||
let response = await client.get_waku_v2_store_v1_messages(defaultTopic, @[HistoryContentFilter(contentTopic: defaultContentTopic)], some(StorePagingOptions()))
|
let response = await client.get_waku_v2_store_v1_messages(some(defaultTopic), some(@[HistoryContentFilter(contentTopic: defaultContentTopic)]), some(StorePagingOptions()))
|
||||||
check:
|
check:
|
||||||
response.messages.len() == 8
|
response.messages.len() == 8
|
||||||
response.pagingOptions.isNone
|
response.pagingOptions.isNone
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# libtool - Provide generalized library-building support services.
|
# libtool - Provide generalized library-building support services.
|
||||||
# Generated automatically by config.status (libbacktrace) version-unused
|
# Generated automatically by config.status (libbacktrace) version-unused
|
||||||
# Libtool was configured on host fv-az132-996:
|
# Libtool was configured on host fv-az182-872:
|
||||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||||
|
@ -16,7 +16,7 @@ proc delete_waku_v2_relay_v1_subscriptions(topics: seq[string]): bool
|
|||||||
|
|
||||||
# Store API
|
# Store API
|
||||||
|
|
||||||
proc get_waku_v2_store_v1_messages(pubsubTopic: string, contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]): StoreResponse
|
proc get_waku_v2_store_v1_messages(pubsubTopicOption: Option[string], contentFiltersOption: Option[seq[HistoryContentFilter]], pagingOptions: Option[StorePagingOptions]): StoreResponse
|
||||||
|
|
||||||
# Filter API
|
# Filter API
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ proc installStoreApiHandlers*(node: WakuNode, rpcsrv: RpcServer) =
|
|||||||
|
|
||||||
## Store API version 1 definitions
|
## Store API version 1 definitions
|
||||||
|
|
||||||
rpcsrv.rpc("get_waku_v2_store_v1_messages") do(pubsubTopic: string, contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]) -> StoreResponse:
|
rpcsrv.rpc("get_waku_v2_store_v1_messages") do(pubsubTopicOption: Option[string], contentFiltersOption: Option[seq[HistoryContentFilter]], pagingOptions: Option[StorePagingOptions]) -> StoreResponse:
|
||||||
## Returns history for a list of content topics with optional paging
|
## Returns history for a list of content topics with optional paging
|
||||||
debug "get_waku_v2_store_v1_messages"
|
debug "get_waku_v2_store_v1_messages"
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ proc installStoreApiHandlers*(node: WakuNode, rpcsrv: RpcServer) =
|
|||||||
debug "get_waku_v2_store_v1_messages response"
|
debug "get_waku_v2_store_v1_messages response"
|
||||||
responseFut.complete(response.toStoreResponse())
|
responseFut.complete(response.toStoreResponse())
|
||||||
|
|
||||||
let historyQuery = HistoryQuery(pubsubTopic: pubsubTopic,
|
let historyQuery = HistoryQuery(pubsubTopic: if pubsubTopicOption.isSome: pubsubTopicOption.get() else: "",
|
||||||
contentFilters: contentFilters,
|
contentFilters: if contentFiltersOption.isSome: contentFiltersOption.get() else: @[],
|
||||||
pagingInfo: if pagingOptions.isSome: pagingOptions.get.toPagingInfo() else: PagingInfo())
|
pagingInfo: if pagingOptions.isSome: pagingOptions.get.toPagingInfo() else: PagingInfo())
|
||||||
|
|
||||||
await node.query(historyQuery, queryFuncHandler)
|
await node.query(historyQuery, queryFuncHandler)
|
||||||
|
@ -37,5 +37,5 @@ echo "Content topic is:", input
|
|||||||
var node = newRpcHttpClient()
|
var node = newRpcHttpClient()
|
||||||
waitfor node.connect("localhost", rpcPort)
|
waitfor node.connect("localhost", rpcPort)
|
||||||
|
|
||||||
var res = waitfor node.get_waku_v2_store_v1_messages(pubsubTopic, @[HistoryContentFilter(contentTopic: ContentTopic(input))], none(StorePagingOptions))
|
var res = waitfor node.get_waku_v2_store_v1_messages(some(pubsubTopic), some(@[HistoryContentFilter(contentTopic: ContentTopic(input))]), none(StorePagingOptions))
|
||||||
echo "Waku query response: ", res
|
echo "Waku query response: ", res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user