From b855566e6bd7a6350371716f43e1257c2debadd1 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Tue, 14 Nov 2023 16:58:14 -0800 Subject: [PATCH] lnrpc: add autopilotrpc doc tags to enable lncli api doc generation --- lnrpc/autopilotrpc/autopilot.proto | 22 ++++++++++++++++++++-- lnrpc/autopilotrpc/autopilot.swagger.json | 4 ++-- lnrpc/autopilotrpc/autopilot_grpc.pb.go | 4 ++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/lnrpc/autopilotrpc/autopilot.proto b/lnrpc/autopilotrpc/autopilot.proto index 67d0f9e38..40e871d4e 100644 --- a/lnrpc/autopilotrpc/autopilot.proto +++ b/lnrpc/autopilotrpc/autopilot.proto @@ -4,11 +4,29 @@ package autopilotrpc; option go_package = "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc"; +/* + * Comments in this file will be directly parsed into the API + * Documentation as descriptions of the associated method, message, or field. + * These descriptions should go right above the definition of the object, and + * can be in either block or // comment format. + * + * An RPC method can be matched to an lncli command by placing a line in the + * beginning of the description in exactly the following format: + * lncli: `methodname` + * + * Failure to specify the exact name of the command will cause documentation + * generation to fail. + * + * More information on how exactly the gRPC documentation is generated from + * this proto file can be found here: + * https://github.com/lightninglabs/lightning-api + */ + // Autopilot is a service that can be used to get information about the current // state of the daemon's autopilot agent, and also supply it with information // that can be used when deciding where to open channels. service Autopilot { - /* + /* lncli: `autopilot status` Status returns whether the daemon's autopilot agent is active. */ rpc Status (StatusRequest) returns (StatusResponse); @@ -19,7 +37,7 @@ service Autopilot { */ rpc ModifyStatus (ModifyStatusRequest) returns (ModifyStatusResponse); - /* + /* lncli: `autopilot query` QueryScores queries all available autopilot heuristics, in addition to any active combination of these heruristics, for the scores they would give to the given nodes. diff --git a/lnrpc/autopilotrpc/autopilot.swagger.json b/lnrpc/autopilotrpc/autopilot.swagger.json index 5462f9dfc..ab4e796c4 100644 --- a/lnrpc/autopilotrpc/autopilot.swagger.json +++ b/lnrpc/autopilotrpc/autopilot.swagger.json @@ -51,7 +51,7 @@ }, "/v2/autopilot/scores": { "get": { - "summary": "QueryScores queries all available autopilot heuristics, in addition to any\nactive combination of these heruristics, for the scores they would give to\nthe given nodes.", + "summary": "lncli: `autopilot query`\nQueryScores queries all available autopilot heuristics, in addition to any\nactive combination of these heruristics, for the scores they would give to\nthe given nodes.", "operationId": "Autopilot_QueryScores", "responses": { "200": { @@ -124,7 +124,7 @@ }, "/v2/autopilot/status": { "get": { - "summary": "Status returns whether the daemon's autopilot agent is active.", + "summary": "lncli: `autopilot status`\nStatus returns whether the daemon's autopilot agent is active.", "operationId": "Autopilot_Status", "responses": { "200": { diff --git a/lnrpc/autopilotrpc/autopilot_grpc.pb.go b/lnrpc/autopilotrpc/autopilot_grpc.pb.go index 67694b94f..f2339f01d 100644 --- a/lnrpc/autopilotrpc/autopilot_grpc.pb.go +++ b/lnrpc/autopilotrpc/autopilot_grpc.pb.go @@ -18,11 +18,13 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AutopilotClient interface { + // lncli: `autopilot status` // Status returns whether the daemon's autopilot agent is active. Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) // ModifyStatus is used to modify the status of the autopilot agent, like // enabling or disabling it. ModifyStatus(ctx context.Context, in *ModifyStatusRequest, opts ...grpc.CallOption) (*ModifyStatusResponse, error) + // lncli: `autopilot query` // QueryScores queries all available autopilot heuristics, in addition to any // active combination of these heruristics, for the scores they would give to // the given nodes. @@ -80,11 +82,13 @@ func (c *autopilotClient) SetScores(ctx context.Context, in *SetScoresRequest, o // All implementations must embed UnimplementedAutopilotServer // for forward compatibility type AutopilotServer interface { + // lncli: `autopilot status` // Status returns whether the daemon's autopilot agent is active. Status(context.Context, *StatusRequest) (*StatusResponse, error) // ModifyStatus is used to modify the status of the autopilot agent, like // enabling or disabling it. ModifyStatus(context.Context, *ModifyStatusRequest) (*ModifyStatusResponse, error) + // lncli: `autopilot query` // QueryScores queries all available autopilot heuristics, in addition to any // active combination of these heruristics, for the scores they would give to // the given nodes.