mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
In this commit we add all the proto methods and messages that we will need for the initial autopilot implementation.
123 lines
2.8 KiB
Go
123 lines
2.8 KiB
Go
// Code generated by falafel 0.9.1. DO NOT EDIT.
|
|
// source: lit-autopilot.proto
|
|
|
|
package litrpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
)
|
|
|
|
func RegisterAutopilotJSONCallbacks(registry map[string]func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error))) {
|
|
|
|
marshaler := &gateway.JSONPb{
|
|
MarshalOptions: protojson.MarshalOptions{
|
|
UseProtoNames: true,
|
|
EmitUnpopulated: true,
|
|
},
|
|
}
|
|
|
|
registry["litrpc.Autopilot.ListAutopilotFeatures"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListAutopilotFeaturesRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewAutopilotClient(conn)
|
|
resp, err := client.ListAutopilotFeatures(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["litrpc.Autopilot.AddAutopilotSession"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &AddAutopilotSessionRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewAutopilotClient(conn)
|
|
resp, err := client.AddAutopilotSession(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["litrpc.Autopilot.ListAutopilotSessions"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListAutopilotSessionsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewAutopilotClient(conn)
|
|
resp, err := client.ListAutopilotSessions(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["litrpc.Autopilot.RevokeAutopilotSession"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &RevokeAutopilotSessionRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewAutopilotClient(conn)
|
|
resp, err := client.RevokeAutopilotSession(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}
|