mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
174 lines
3.8 KiB
Go
174 lines
3.8 KiB
Go
// Code generated by falafel 0.9.1. DO NOT EDIT.
|
|
// source: wtclient.proto
|
|
|
|
package wtclientrpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
)
|
|
|
|
func RegisterWatchtowerClientJSONCallbacks(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["wtclientrpc.WatchtowerClient.AddTower"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &AddTowerRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.AddTower(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["wtclientrpc.WatchtowerClient.RemoveTower"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &RemoveTowerRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.RemoveTower(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["wtclientrpc.WatchtowerClient.ListTowers"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListTowersRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.ListTowers(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["wtclientrpc.WatchtowerClient.GetTowerInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GetTowerInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.GetTowerInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["wtclientrpc.WatchtowerClient.Stats"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &StatsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.Stats(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["wtclientrpc.WatchtowerClient.Policy"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PolicyRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewWatchtowerClientClient(conn)
|
|
resp, err := client.Policy(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}
|