add stream_list
This commit is contained in:
parent
6918a2436a
commit
1155ea6b9d
3 changed files with 25 additions and 0 deletions
|
@ -429,6 +429,18 @@ func (d *Client) AddressList(account *string, address *string) (*AddressListResp
|
||||||
return response, d.call(response, "address_list", structs.Map(args))
|
return response, d.call(response, "address_list", structs.Map(args))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Client) StreamList(account *string) (*StreamListResponse, error) {
|
||||||
|
response := new(StreamListResponse)
|
||||||
|
err := d.call(response, "stream_list", map[string]interface{}{
|
||||||
|
"account_id": account,
|
||||||
|
"include_protobuf": true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Client) ClaimList(account *string, page uint64, pageSize uint64) (*ClaimListResponse, error) {
|
func (d *Client) ClaimList(account *string, page uint64, pageSize uint64) (*ClaimListResponse, error) {
|
||||||
if page == 0 {
|
if page == 0 {
|
||||||
return nil, errors.Err("pages start from 1")
|
return nil, errors.Err("pages start from 1")
|
||||||
|
|
|
@ -280,6 +280,17 @@ func TestClient_ClaimList(t *testing.T) {
|
||||||
prettyPrint(*got)
|
prettyPrint(*got)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClient_StreamList(t *testing.T) {
|
||||||
|
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
|
||||||
|
d := NewClient("")
|
||||||
|
got, err := d.StreamList(nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
prettyPrint(*got)
|
||||||
|
}
|
||||||
|
|
||||||
func TestClient_TransactionList(t *testing.T) {
|
func TestClient_TransactionList(t *testing.T) {
|
||||||
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
|
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
|
||||||
d := NewClient("")
|
d := NewClient("")
|
||||||
|
|
|
@ -396,6 +396,8 @@ func (c *Claim) GetStreamSizeByMagic() (streamSize uint64, e error) {
|
||||||
return streamSize, nil
|
return streamSize, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StreamListResponse []Claim
|
||||||
|
|
||||||
type ClaimListResponse struct {
|
type ClaimListResponse struct {
|
||||||
Claims []Claim `json:"items"`
|
Claims []Claim `json:"items"`
|
||||||
Page uint64 `json:"page"`
|
Page uint64 `json:"page"`
|
||||||
|
|
Loading…
Reference in a new issue