regenerated docs

This commit is contained in:
Lex Berezhny 2019-09-20 09:43:58 -04:00
parent b396322f1e
commit e49f8f8c61
3 changed files with 452 additions and 106 deletions

File diff suppressed because one or more lines are too long

View file

@ -6,6 +6,7 @@ from json import JSONEncoder
from google.protobuf.message import DecodeError from google.protobuf.message import DecodeError
from torba.client.wallet import Wallet
from torba.client.bip32 import PubKey from torba.client.bip32 import PubKey
from lbry.schema.claim import Claim from lbry.schema.claim import Claim
from lbry.wallet.ledger import MainNetLedger, Account from lbry.wallet.ledger import MainNetLedger, Account
@ -68,6 +69,13 @@ def encode_account_doc():
} }
def encode_wallet_doc():
return {
'id': 'wallet_id',
'name': 'optional wallet name',
}
def encode_file_doc(): def encode_file_doc():
return { return {
'streaming_url': '(str) url to stream the file using range requests', 'streaming_url': '(str) url to stream the file using range requests',
@ -111,6 +119,8 @@ class JSONResponseEncoder(JSONEncoder):
def default(self, obj): # pylint: disable=method-hidden def default(self, obj): # pylint: disable=method-hidden
if isinstance(obj, Account): if isinstance(obj, Account):
return self.encode_account(obj) return self.encode_account(obj)
if isinstance(obj, Wallet):
return self.encode_wallet(obj)
if isinstance(obj, ManagedStream): if isinstance(obj, ManagedStream):
return self.encode_file(obj) return self.encode_file(obj)
if isinstance(obj, Transaction): if isinstance(obj, Transaction):
@ -222,6 +232,12 @@ class JSONResponseEncoder(JSONEncoder):
result['is_default'] = self.ledger.accounts[0] == account result['is_default'] = self.ledger.accounts[0] == account
return result return result
def encode_wallet(self, wallet):
return {
'id': wallet.id,
'name': wallet.name
}
def encode_file(self, managed_stream): def encode_file(self, managed_stream):
output_exists = managed_stream.output_file_exists output_exists = managed_stream.output_file_exists
tx_height = managed_stream.stream_claim_info.height tx_height = managed_stream.stream_claim_info.height

View file

@ -13,13 +13,15 @@ from lbry.extras.daemon.Daemon import (
Daemon, jsonrpc_dumps_pretty, encode_pagination_doc Daemon, jsonrpc_dumps_pretty, encode_pagination_doc
) )
from lbry.extras.daemon.json_response_encoder import ( from lbry.extras.daemon.json_response_encoder import (
encode_tx_doc, encode_txo_doc, encode_account_doc, encode_file_doc encode_tx_doc, encode_txo_doc, encode_account_doc, encode_file_doc,
encode_wallet_doc
) )
from lbry.testcase import CommandTestCase from lbry.testcase import CommandTestCase
RETURN_DOCS = { RETURN_DOCS = {
'Account': encode_account_doc(), 'Account': encode_account_doc(),
'Wallet': encode_wallet_doc(),
'File': encode_file_doc(), 'File': encode_file_doc(),
'Transaction': encode_tx_doc(), 'Transaction': encode_tx_doc(),
'Output': encode_txo_doc(), 'Output': encode_txo_doc(),
@ -103,6 +105,13 @@ class Examples(CommandTestCase):
'preference', 'get' 'preference', 'get'
) )
# wallets
await r(
'List your wallets',
'wallet', 'list'
)
# accounts # accounts
await r( await r(