mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-09-04 04:45:09 +00:00
generate api examples
This commit is contained in:
parent
fd56dc68cd
commit
59e1df9efa
1 changed files with 10 additions and 2 deletions
|
@ -44,11 +44,19 @@ def get_api(obj):
|
||||||
for arg in arguments:
|
for arg in arguments:
|
||||||
arg['description'] = ' '.join(arg['description'])
|
arg['description'] = ' '.join(arg['description'])
|
||||||
|
|
||||||
|
name = obj.__name__[len('jsonrpc_'):]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': obj.__name__[len('jsonrpc_'):],
|
'name': name,
|
||||||
'description': description.strip(),
|
'description': description.strip(),
|
||||||
'arguments': arguments,
|
'arguments': arguments,
|
||||||
'returns': returns.strip()
|
'returns': returns.strip(),
|
||||||
|
'examples': [{
|
||||||
|
'curl': f"""curl -d'{{"method": "{name}"}}' http://localhost:5279/""",
|
||||||
|
'lbrynet': f'lbrynet {name} --some-arg=foo',
|
||||||
|
'python': f'requests.post("http://localhost:5279", json={{"method": "{name}"}}).json()',
|
||||||
|
'output': returns.strip()
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue