(methodDecl *wshrpc.WshRpcMethodDecl, tsTypesMap map[reflect.Type]string)
| 461 | } |
| 462 | |
| 463 | func generateWshClientApiMethod_ResponseStream(methodDecl *wshrpc.WshRpcMethodDecl, tsTypesMap map[reflect.Type]string) string { |
| 464 | var sb strings.Builder |
| 465 | sb.WriteString(fmt.Sprintf(" // command %q [%s]\n", methodDecl.Command, methodDecl.CommandType)) |
| 466 | respType := "any" |
| 467 | if methodDecl.DefaultResponseDataType != nil { |
| 468 | respType, _ = TypeToTSType(methodDecl.DefaultResponseDataType, tsTypesMap) |
| 469 | } |
| 470 | methodSigDataParams, dataName := getTsWshMethodDataParamsAndExpr(methodDecl, tsTypesMap) |
| 471 | genRespType := fmt.Sprintf("AsyncGenerator<%s, void, boolean>", respType) |
| 472 | if methodSigDataParams == "" { |
| 473 | sb.WriteString(fmt.Sprintf(" %s(client: WshClient, opts?: RpcOpts): %s {\n", methodDecl.MethodName, genRespType)) |
| 474 | } else { |
| 475 | sb.WriteString(fmt.Sprintf(" %s(client: WshClient, %s, opts?: RpcOpts): %s {\n", methodDecl.MethodName, methodSigDataParams, genRespType)) |
| 476 | } |
| 477 | sb.WriteString(fmt.Sprintf(" if (this.mockClient) return this.mockClient.mockWshRpcStream(client, %q, %s, opts);\n", methodDecl.Command, dataName)) |
| 478 | sb.WriteString(fmt.Sprintf(" return client.wshRpcStream(%q, %s, opts);\n", methodDecl.Command, dataName)) |
| 479 | sb.WriteString(" }\n") |
| 480 | return sb.String() |
| 481 | } |
| 482 | |
| 483 | func generateWshClientApiMethod_Call(methodDecl *wshrpc.WshRpcMethodDecl, tsTypesMap map[reflect.Type]string) string { |
| 484 | var sb strings.Builder |
no test coverage detected