-
Notifications
You must be signed in to change notification settings - Fork 3
/
RemoteCall.go
34 lines (29 loc) · 1.05 KB
/
RemoteCall.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package rpc
import (
"github.com/WeBankBlockchain/WeCross-Go-SDK/common"
"github.com/WeBankBlockchain/WeCross-Go-SDK/rpc/service"
"github.com/WeBankBlockchain/WeCross-Go-SDK/rpc/types"
"github.com/WeBankBlockchain/WeCross-Go-SDK/rpc/types/response"
)
type RemoteCall struct {
weCrossService service.WeCrossService
httpMethod string
uri string
responseType response.ResponseType
request *types.Request
}
func NewRemoteCall(weCrossService service.WeCrossService, httpMethod string, uri string, responseType response.ResponseType, request *types.Request) *RemoteCall {
return &RemoteCall{
weCrossService: weCrossService,
httpMethod: httpMethod,
uri: uri,
responseType: responseType,
request: request,
}
}
func (rc *RemoteCall) Send() (*types.Response, *common.WeCrossSDKError) {
return rc.weCrossService.Send(rc.httpMethod, rc.uri, rc.request, rc.responseType)
}
func (rc *RemoteCall) AsyncSend(back *types.CallBack) {
rc.weCrossService.AsyncSend(rc.httpMethod, rc.uri, rc.request, rc.responseType, back)
}