forked from golangdaddy/multichain-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_liststreams.go
41 lines (32 loc) · 1.11 KB
/
api_liststreams.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package multichain
import (
"fmt"
)
// Returns information about streams created on the blockchain. Pass a stream name, ref or creation txid in streams to retrieve information about one stream only, an array thereof for multiple streams, or * for all streams. Use count and start to retrieve part of the list only, with negative start values (like the default) indicating the most recently created streams. Extra fields are shown for streams to which this node has subscribed.
func (client *Client) ListStreams(streams string, start, count int, verbose bool) (Response, error) {
if len(streams) == 0 {
streams = "*"
}
params := []interface{}{
fmt.Sprintf("%s", streams),
}
/*
params := []interface{}{
fmt.Sprintf("streams=%s", streams),
}
if start > 0 && count > 0 {
params = append(params, fmt.Sprintf("start=%d", start))
params = append(params, fmt.Sprintf("count=%d", count))
}
if verbose {
params = append(params, fmt.Sprintf("verbose=%v", verbose))
}
*/
msg := map[string]interface{}{
"jsonrpc": "1.0",
"id": CONST_ID,
"method": "liststreams",
"params": params,
}
return client.post(msg)
}