(w *wshutil.WshRpc, command string, data interface{}, opts *wshrpc.RpcOpts)
| 14 | ) |
| 15 | |
| 16 | func 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 | |
| 42 | func rtnErr[T any](ch chan wshrpc.RespOrErrorUnion[T], err error) { |
| 43 | go func() { |
no test coverage detected