Skip to content

Commit

Permalink
msggen: add help method
Browse files Browse the repository at this point in the history
Changelog-None
  • Loading branch information
daywalker90 authored and cdecker committed May 16, 2024
1 parent 6a68ef9 commit 89b384e
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 84 deletions.
48 changes: 48 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
"GetrouteRouteStyle": {
"tlv": 0
},
"HelpFormat-hint": {
"simple": 0
},
"KeysendStatus": {
"complete": 0
},
Expand Down Expand Up @@ -1381,6 +1384,19 @@
"GetRoute.route[].msatoshi": 7,
"GetRoute.route[].style": 6
},
"HelpHelp": {
"Help.help[].category": 2,
"Help.help[].command": 1,
"Help.help[].description": 3,
"Help.help[].verbose": 4
},
"HelpRequest": {
"Help.command": 1
},
"HelpResponse": {
"Help.format-hint": 2,
"Help.help[]": 1
},
"InvoiceRequest": {
"Invoice.amount_msat": 10,
"Invoice.cltv": 6,
Expand Down Expand Up @@ -5375,6 +5391,38 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Help": {
"added": "pre-v0.10.1",
"deprecated": null
},
"Help.command": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.format-hint": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.help[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.help[].category": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.help[].command": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.help[].description": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Help.help[].verbose": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Invoice": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
21 changes: 21 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,38 @@ impl Node for Server

}

async fn help(
&self,
request: tonic::Request<pb::HelpRequest>,
) -> Result<tonic::Response<pb::HelpResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::HelpRequest = req.into();
debug!("Client asked for help");
trace!("help request: {:?}", req);
let mut rpc = ClnRpc::new(&self.rpc_path)
.await
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
let result = rpc.call(Request::Help(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method Help: {:?}", e)))?;
match result {
Response::Help(r) => {
trace!("help response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call Help",
r
)
)),
}

}

async fn pre_approve_keysend(
&self,
request: tonic::Request<pb::PreapprovekeysendRequest>,
Expand Down
76 changes: 76 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def load_jsonrpc_service():
"Recover",
"RecoverChannel",
"Invoice",
"InvoiceRequest",
"DisableInvoiceRequest",
"ListInvoiceRequests",
"ListDatastore",
"ListInvoices",
"SendOnion",
Expand Down Expand Up @@ -187,7 +190,7 @@ def load_jsonrpc_service():
# "check", # No point in mapping this one
"Stop",
# "notifications", # No point in mapping this
# "help",
"Help",
"PreApproveKeysend",
"PreApproveInvoice",
"StaticBackup",
Expand Down
175 changes: 92 additions & 83 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ def __init__(self, channel):
request_serializer=node__pb2.StopRequest.SerializeToString,
response_deserializer=node__pb2.StopResponse.FromString,
)
self.Help = channel.unary_unary(
'/cln.Node/Help',
request_serializer=node__pb2.HelpRequest.SerializeToString,
response_deserializer=node__pb2.HelpResponse.FromString,
)
self.PreApproveKeysend = channel.unary_unary(
'/cln.Node/PreApproveKeysend',
request_serializer=node__pb2.PreapprovekeysendRequest.SerializeToString,
Expand Down Expand Up @@ -1101,6 +1106,12 @@ def Stop(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Help(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def PreApproveKeysend(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -1648,6 +1659,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.StopRequest.FromString,
response_serializer=node__pb2.StopResponse.SerializeToString,
),
'Help': grpc.unary_unary_rpc_method_handler(
servicer.Help,
request_deserializer=node__pb2.HelpRequest.FromString,
response_serializer=node__pb2.HelpResponse.SerializeToString,
),
'PreApproveKeysend': grpc.unary_unary_rpc_method_handler(
servicer.PreApproveKeysend,
request_deserializer=node__pb2.PreapprovekeysendRequest.FromString,
Expand Down Expand Up @@ -3292,6 +3308,23 @@ def Stop(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def Help(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/cln.Node/Help',
node__pb2.HelpRequest.SerializeToString,
node__pb2.HelpResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def PreApproveKeysend(request,
target,
Expand Down
1 change: 1 addition & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/primitives_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 89b384e

Please sign in to comment.