MCPcopy
hub / github.com/wavetermdev/waveterm / sendRpcRequestCallHelper

Function sendRpcRequestCallHelper

pkg/wshrpc/wshclient/wshclientutil.go:16–40  ·  view source on GitHub ↗
(w *wshutil.WshRpc, command string, data interface{}, opts *wshrpc.RpcOpts)

Source from the content-addressed store, hash-verified

14)
15
16func sendRpcRequestCallHelper[T any](w *wshutil.WshRpc, command string, data interface{}, opts *wshrpc.RpcOpts) (T, error) {
17 if opts == nil {
18 opts = &wshrpc.RpcOpts{}
19 }
20 var respData T
21 if w == nil {
22 return respData, errors.New("nil wshrpc passed to wshclient")
23 }
24 if opts.NoResponse {
25 err := w.SendCommand(command, data, opts)
26 if err != nil {
27 return respData, err
28 }
29 return respData, nil
30 }
31 resp, err := w.SendRpcRequest(command, data, opts)
32 if err != nil {
33 return respData, err
34 }
35 err = utilfn.ReUnmarshal(&respData, resp)
36 if err != nil {
37 return respData, err
38 }
39 return respData, nil
40}
41
42func rtnErr[T any](ch chan wshrpc.RespOrErrorUnion[T], err error) {
43 go func() {

Callers 15

AuthenticateCommandFunction · 0.85
AuthenticateTokenCommandFunction · 0.85
BlockInfoCommandFunction · 0.85
BlockJobStatusCommandFunction · 0.85
BlocksListCommandFunction · 0.85
CheckGoVersionCommandFunction · 0.85
ConnListCommandFunction · 0.85
ConnStatusCommandFunction · 0.85
CreateBlockCommandFunction · 0.85
CreateSubBlockCommandFunction · 0.85
DebugTermCommandFunction · 0.85

Calls 3

ReUnmarshalFunction · 0.92
SendCommandMethod · 0.80
SendRpcRequestMethod · 0.80

Tested by

no test coverage detected