Merge pull request #526 from lbryio/api_doc_string

Daemon API doc string update
This commit is contained in:
Umpei Kay Kurokawa 2017-03-13 14:18:14 -04:00 committed by GitHub
commit ec35eb2397
2 changed files with 167 additions and 116 deletions

View file

@ -98,10 +98,25 @@ Return:
Get claims for a name
Args:
name: file name
txid: transaction id of a name claim transaction
name: search for claims on this name
Returns
list of name claims
{
'claims': list of claims for the name
[
{
'amount': amount assigned to the claim, not including supports
'effective_amount': total amount assigned to the claim, including supports
'claim_id': claim ID of the claim
'height': height of block containing the claim
'txid': txid of the claim
'nout': nout of the claim
'supports': a list of supports attached to the claim
'value': the value of the claim
},
]
'supports_without_claims': list of supports without any claims attached to them
'last_takeover_height': the height when the last takeover for the name happened
}
```
## claim_list_mine
@ -112,7 +127,25 @@ List my name claims
Args:
None
Returns
list of name claims
list of name claims owned by user
[
{
'address': address that owns the claim
'amount': amount assigned to the claim
'blocks_to_expiration': number of blocks until it expires
'category': "claim", "update" , or "support"
'claim_id': claim ID of the claim
'confirmations': number of blocks of confirmations for the claim
'expiration_height': the block height which the claim will expire
'expired': True if expired, False otherwise
'height': height of the block containing the claim
'is_spent': True if claim is abandoned, False otherwise
'name': name of the claim
'txid': txid of the cliam
'nout': nout of the claim
'value': value of the claim
},
]
```
## claim_new_support
@ -133,7 +166,7 @@ Return:
## claim_show
```text
Resolve claim info from a LBRY uri
Resolve claim info from a LBRY name
Args:
'name': name to look up, string, do not include lbry:// prefix
@ -141,7 +174,15 @@ Args:
'nout': optional, if specified, look for claim with this nout
Returns:
txid, amount, value, n, height
false if name is not claimed , else return dictionary containing
'txid': txid of claim
'nout': nout of claim
'amount': amount of claim
'value': value of claim
'height' : height of claim
'claim_id': claim ID of claim
'supports': supports associated with claim
```
## commands
@ -184,22 +225,37 @@ Returns
Delete a lbry file
Args:
'file_name': downloaded file name, string
'name' (optional): delete files by lbry name,
'sd_hash' (optional): delete files by sd hash,
'file_name' (optional): delete files by the name in the downloads folder,
'stream_hash' (optional): delete files by stream hash,
'claim_id' (optional): delete files by claim id,
'outpoint' (optional): delete files by claim outpoint,
'rowid': (optional): delete file by rowid in the file manager
'delete_target_file' (optional): delete file from downloads folder, defaults to True
if False only the blobs and db entries will be deleted
Returns:
confirmation message
True if deletion was successful, otherwise False
```
## file_get
## file_list
```text
Get a file, if no matching file exists returns False
List files limited by optional filters
Args:
'name': get file by lbry uri,
'sd_hash': get file by the hash in the name claim,
'file_name': get file by its name in the downloads folder,
'stream_hash': get file by its stream hash
'name' (optional): filter files by lbry name,
'sd_hash' (optional): filter files by sd hash,
'file_name' (optional): filter files by the name in the downloads folder,
'stream_hash' (optional): filter files by stream hash,
'claim_id' (optional): filter files by claim id,
'outpoint' (optional): filter files by claim outpoint,
'rowid' (optional): filter files by internal row id,
'full_status': (optional): bool, if true populate the 'message' and 'size' fields
Returns:
[
{
'completed': bool,
'file_name': str,
'download_directory': str,
@ -209,38 +265,18 @@ Returns:
'stream_name': str,
'suggested_file_name': str,
'sd_hash': str (hex),
'lbry_uri': str,
'txid': str (b58),
'claim_id': str (b58),
'name': str,
'outpoint': str, (txid:nout)
'claim_id': str (hex),
'download_path': str,
'mime_type': str,
'key': str (hex),
'total_bytes': int,
'total_bytes': int, None if full_status is False
'written_bytes': int,
'code': str,
'message': str
'metadata': Metadata dict if claim is valid, otherwise status str
'message': str, None if full_status is False
'metadata': Metadata dict
}
```
## file_list
```text
List files
Args:
None
Returns:
List of files, with the following keys:
'completed': bool
'file_name': string
'key': hex string
'points_paid': float
'stopped': bool
'stream_hash': base 58 string
'stream_name': string
'suggested_file_name': string
'sd_hash': string
]
```
## file_seed
@ -250,7 +286,7 @@ Start or stop seeding a file
Args:
'status': "start" or "stop"
'name': start file by lbry uri,
'name': start file by lbry name,
'sd_hash': start file by the hash in the name claim,
'file_name': start file by its name in the downloads folder,
Returns:
@ -260,7 +296,7 @@ Returns:
## get
```text
Download stream from a LBRY uri.
Download stream from a LBRY name.
Args:
'name': name to download, string
@ -271,8 +307,27 @@ Args:
'wait_for_write': optional, defaults to True. When set, waits for the file to
only start to be written before returning any results.
Returns:
'stream_hash': hex string
'path': path of download
{
'completed': bool,
'file_name': str,
'download_directory': str,
'points_paid': float,
'stopped': bool,
'stream_hash': str (hex),
'stream_name': str,
'suggested_file_name': str,
'sd_hash': str (hex),
'name': str,
'outpoint': str, (txid:nout)
'claim_id': str (hex),
'download_path': str,
'mime_type': str,
'key': str (hex),
'total_bytes': int
'written_bytes': int,
'message': str
'metadata': Metadata dict
}
```
## get_availability
@ -281,7 +336,7 @@ Returns:
Get stream availability for a winning claim
Arg:
name (str): lbry uri
name (str): lbry name
sd_timeout (int, optional): sd blob download timeout
peer_timeout (int, optional): how long to look for peers
@ -289,28 +344,6 @@ Returns:
peers per blob / total blobs
```
## get_mean_availability
```text
Get mean blob availability
Args:
None
Returns:
Mean peers for a blob
```
## get_nametrie
```text
Get the nametrie
Args:
None
Returns:
Name claim trie
```
## help
```text
@ -323,17 +356,6 @@ Returns:
otherwise returns general help message
```
## open
```text
Instruct the OS to open a file with its default program.
Args:
'sd_hash': SD hash of file to be opened
Returns:
True, opens file
```
## peer_list
```text
@ -359,11 +381,10 @@ Args:
the stream from your existing claim for the name will be used
'fee' (optional): dict, FeeValidator compliant
Returns:
'success' : True if claim was succesful , False otherwise
'reason' : if not succesful, give reason
'txid' : txid of resulting transaction if succesful
'nout' : nout of the resulting support claim if succesful
'fee' : fee paid for the claim transaction if succesful
'tx' : hex encoded transaction
'txid' : txid of resulting transaction
'nout' : nout of the resulting support claim
'fee' : fee paid for the claim transaction
'claim_id' : claim id of the resulting transaction
```
@ -392,23 +413,12 @@ Returns:
## resolve_name
```text
Resolve stream info from a LBRY uri
Resolve stream info from a LBRY name
Args:
'name': name to look up, string, do not include lbry:// prefix
Returns:
metadata from name claim or None if the name is not known
```
## reveal
```text
Reveal a file or directory in file browser
Args:
'path': path to be revealed in file browser
Returns:
True, opens file browser
metadata dictionary from name claim or None if the name is not known
```
## send_amount_to_address
@ -469,7 +479,6 @@ Return daemon status
Args:
session_status: bool
blockchain_status: bool
Returns:
daemon status
```
@ -480,7 +489,7 @@ Returns:
Get estimated cost for a lbry stream
Args:
'name': lbry uri
'name': lbry name
'size': stream size, in bytes. if provided an sd blob won't be downloaded.
Returns:
estimated cost

View file

@ -1456,7 +1456,7 @@ class Daemon(AuthJSONRPCServer):
Args:
'name': name to look up, string, do not include lbry:// prefix
Returns:
metadata from name claim or None if the name is not known
metadata dictionary from name claim or None if the name is not known
"""
if not name:
@ -1488,7 +1488,15 @@ class Daemon(AuthJSONRPCServer):
'nout': optional, if specified, look for claim with this nout
Returns:
txid, amount, value, n, height
false if name is not claimed , else return dictionary containing
'txid': txid of claim
'nout': nout of claim
'amount': amount of claim
'value': value of claim
'height' : height of claim
'claim_id': claim ID of claim
'supports': supports associated with claim
"""
d = self.session.wallet.get_claim_info(name, txid, nout)
@ -1815,7 +1823,25 @@ class Daemon(AuthJSONRPCServer):
Args:
None
Returns
list of name claims
list of name claims owned by user
[
{
'address': address that owns the claim
'amount': amount assigned to the claim
'blocks_to_expiration': number of blocks until it expires
'category': "claim", "update" , or "support"
'claim_id': claim ID of the claim
'confirmations': number of blocks of confirmations for the claim
'expiration_height': the block height which the claim will expire
'expired': True if expired, False otherwise
'height': height of the block containing the claim
'is_spent': True if claim is abandoned, False otherwise
'name': name of the claim
'txid': txid of the cliam
'nout': nout of the claim
'value': value of the claim
},
]
"""
d = self.session.wallet.get_name_claims()
@ -1842,7 +1868,23 @@ class Daemon(AuthJSONRPCServer):
Args:
name: search for claims on this name
Returns
list of name claims
{
'claims': list of claims for the name
[
{
'amount': amount assigned to the claim, not including supports
'effective_amount': total amount assigned to the claim, including supports
'claim_id': claim ID of the claim
'height': height of block containing the claim
'txid': txid of the claim
'nout': nout of the claim
'supports': a list of supports attached to the claim
'value': the value of the claim
},
]
'supports_without_claims': list of supports without any claims attached to them
'last_takeover_height': the height when the last takeover for the name happened
}
"""
d = self.session.wallet.get_claims_for_name(name)