Compare commits

...
6 Commits
Author SHA1 Message Date
Niko Storni 1155ea6b9d add stream_list 2019-10-10 04:29:11 +02:00
Alex Grin 6918a2436a Merge pull request #74 from StrikerRUS/patch-1
bump year in license
2019-10-09 10:37:13 -04:00
Nikita Titov 7e524c6b08 bump year in license 2019-10-09 00:06:05 +03:00
sayplastic 9c278d131d Merge pull request #73 from lbryio/feature/wallet
Add wallet commands to JSON-RPC client
2019-10-08 13:08:57 +07:00
Niko Storni b1c090e28d fix claim search not returning claim values 2019-10-03 22:50:07 +02:00
Niko Storni deab868c53 add bid to channel update params 2019-09-27 15:36:23 +02:00
4 changed files with 43 additions and 14 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016-2018 LBRY Inc
Copyright (c) 2016-2019 LBRY Inc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+28 -13
View File
@@ -290,11 +290,12 @@ func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOp
type ChannelUpdateOptions struct {
ChannelCreateOptions `json:",flatten"`
NewSigningKey *bool `json:"new_signing_key,omitempty"`
ClearFeatured *bool `json:"clear_featured,omitempty"`
ClearTags *bool `json:"clear_tags,omitempty"`
ClearLanguages *bool `json:"clear_languages,omitempty"`
ClearLocations *bool `json:"clear_locations,omitempty"`
NewSigningKey *bool `json:"new_signing_key,omitempty"`
ClearFeatured *bool `json:"clear_featured,omitempty"`
ClearTags *bool `json:"clear_tags,omitempty"`
ClearLanguages *bool `json:"clear_languages,omitempty"`
ClearLocations *bool `json:"clear_locations,omitempty"`
Bid *string `json:"bid,omitempty"`
}
func (d *Client) ChannelUpdate(claimID string, options ChannelUpdateOptions) (*TransactionSummary, error) {
@@ -428,6 +429,18 @@ func (d *Client) AddressList(account *string, address *string) (*AddressListResp
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) {
if page == 0 {
return nil, errors.Err("pages start from 1")
@@ -502,15 +515,17 @@ func (d *Client) Resolve(urls string) (*ResolveResponse, error) {
func (d *Client) ClaimSearch(claimName, claimID, txid *string, nout *uint) (*ClaimSearchResponse, error) {
response := new(ClaimSearchResponse)
args := struct {
ClaimID *string `json:"claim_id,omitempty"`
TXID *string `json:"txid,omitempty"`
Nout *uint `json:"nout,omitempty"`
Name *string `json:"name,omitempty"`
ClaimID *string `json:"claim_id,omitempty"`
TXID *string `json:"txid,omitempty"`
Nout *uint `json:"nout,omitempty"`
Name *string `json:"name,omitempty"`
IncludeProtobuf bool `json:"include_protobuf"`
}{
ClaimID: claimID,
TXID: txid,
Nout: nout,
Name: claimName,
ClaimID: claimID,
TXID: txid,
Nout: nout,
Name: claimName,
IncludeProtobuf: true,
}
structs.DefaultTagName = "json"
return response, d.call(response, "claim_search", structs.Map(args))
+12
View File
@@ -196,6 +196,7 @@ func TestClient_StreamCreate(t *testing.T) {
func TestClient_ChannelUpdate(t *testing.T) {
d := NewClient("")
got, err := d.ChannelUpdate(channelID, ChannelUpdateOptions{
Bid: util.PtrToString("0.01"),
ClearLanguages: util.PtrToBool(true),
ClearLocations: util.PtrToBool(true),
ClearTags: util.PtrToBool(true),
@@ -279,6 +280,17 @@ func TestClient_ClaimList(t *testing.T) {
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) {
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
d := NewClient("")
+2
View File
@@ -396,6 +396,8 @@ func (c *Claim) GetStreamSizeByMagic() (streamSize uint64, e error) {
return streamSize, nil
}
type StreamListResponse []Claim
type ClaimListResponse struct {
Claims []Claim `json:"items"`
Page uint64 `json:"page"`