litrpc: add cli directives to Autopilot service

This commit is contained in:
Elle Mouton 2023-03-19 17:57:29 +02:00
parent de3e492d41
commit 6c3fa5a6ad
No known key found for this signature in database
GPG key ID: D7D916376026F177
3 changed files with 44 additions and 0 deletions

View file

@ -408,6 +408,7 @@ type RevokeAutopilotSessionRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The local static public key of the Autopilot session to be revoked.
LocalPublicKey []byte `protobuf:"bytes,1,opt,name=local_public_key,json=localPublicKey,proto3" json:"local_public_key,omitempty"`
}

View file

@ -7,15 +7,31 @@ package litrpc;
option go_package = "github.com/lightninglabs/lightning-terminal/litrpc";
service Autopilot {
/* litcli: `autopilot features`
ListAutopilotFeatures fetches all the features supported by the Autopilot
server along with the rules that we need to support in order to subscribe
to those features.
*/
rpc ListAutopilotFeatures (ListAutopilotFeaturesRequest)
returns (ListAutopilotFeaturesResponse);
/* litcli: `autopilot add`
AddAutopilotSession creates a new LNC session and attempts to register it
with the Autopilot server.
*/
rpc AddAutopilotSession (AddAutopilotSessionRequest)
returns (AddAutopilotSessionResponse);
/* litcli: `autopilot list`
ListAutopilotSessions lists all the sessions that are of type
TypeAutopilot.
*/
rpc ListAutopilotSessions (ListAutopilotSessionsRequest)
returns (ListAutopilotSessionsResponse);
/* litcli: `autopilot revoke`
RevokeAutopilotSession revokes an Autopilot session.
*/
rpc RevokeAutopilotSession (RevokeAutopilotSessionRequest)
returns (RevokeAutopilotSessionResponse);
}
@ -101,6 +117,9 @@ message ListAutopilotFeaturesResponse {
}
message RevokeAutopilotSessionRequest {
/*
The local static public key of the Autopilot session to be revoked.
*/
bytes local_public_key = 1;
}

View file

@ -18,9 +18,21 @@ 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 {
// litcli: `autopilot features`
// ListAutopilotFeatures fetches all the features supported by the Autopilot
// server along with the rules that we need to support in order to subscribe
// to those features.
ListAutopilotFeatures(ctx context.Context, in *ListAutopilotFeaturesRequest, opts ...grpc.CallOption) (*ListAutopilotFeaturesResponse, error)
// litcli: `autopilot add`
// AddAutopilotSession creates a new LNC session and attempts to register it
// with the Autopilot server.
AddAutopilotSession(ctx context.Context, in *AddAutopilotSessionRequest, opts ...grpc.CallOption) (*AddAutopilotSessionResponse, error)
// litcli: `autopilot list`
// ListAutopilotSessions lists all the sessions that are of type
// TypeAutopilot.
ListAutopilotSessions(ctx context.Context, in *ListAutopilotSessionsRequest, opts ...grpc.CallOption) (*ListAutopilotSessionsResponse, error)
// litcli: `autopilot revoke`
// RevokeAutopilotSession revokes an Autopilot session.
RevokeAutopilotSession(ctx context.Context, in *RevokeAutopilotSessionRequest, opts ...grpc.CallOption) (*RevokeAutopilotSessionResponse, error)
}
@ -72,9 +84,21 @@ func (c *autopilotClient) RevokeAutopilotSession(ctx context.Context, in *Revoke
// All implementations must embed UnimplementedAutopilotServer
// for forward compatibility
type AutopilotServer interface {
// litcli: `autopilot features`
// ListAutopilotFeatures fetches all the features supported by the Autopilot
// server along with the rules that we need to support in order to subscribe
// to those features.
ListAutopilotFeatures(context.Context, *ListAutopilotFeaturesRequest) (*ListAutopilotFeaturesResponse, error)
// litcli: `autopilot add`
// AddAutopilotSession creates a new LNC session and attempts to register it
// with the Autopilot server.
AddAutopilotSession(context.Context, *AddAutopilotSessionRequest) (*AddAutopilotSessionResponse, error)
// litcli: `autopilot list`
// ListAutopilotSessions lists all the sessions that are of type
// TypeAutopilot.
ListAutopilotSessions(context.Context, *ListAutopilotSessionsRequest) (*ListAutopilotSessionsResponse, error)
// litcli: `autopilot revoke`
// RevokeAutopilotSession revokes an Autopilot session.
RevokeAutopilotSession(context.Context, *RevokeAutopilotSessionRequest) (*RevokeAutopilotSessionResponse, error)
mustEmbedUnimplementedAutopilotServer()
}