2015-01-14 01:31:27 +02:00
|
|
|
package client
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
type rpcRequest struct {
|
2015-05-23 12:53:40 +02:00
|
|
|
service string
|
|
|
|
method string
|
|
|
|
contentType string
|
|
|
|
request interface{}
|
2015-12-31 20:11:46 +02:00
|
|
|
opts RequestOptions
|
2015-01-14 01:31:27 +02:00
|
|
|
}
|
|
|
|
|
2015-12-17 22:37:35 +02:00
|
|
|
func newRpcRequest(service, method string, request interface{}, contentType string, reqOpts ...RequestOption) Request {
|
2015-12-31 20:11:46 +02:00
|
|
|
var opts RequestOptions
|
2015-12-17 22:37:35 +02:00
|
|
|
|
|
|
|
for _, o := range reqOpts {
|
|
|
|
o(&opts)
|
|
|
|
}
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
return &rpcRequest{
|
2015-01-14 01:31:27 +02:00
|
|
|
service: service,
|
|
|
|
method: method,
|
|
|
|
request: request,
|
|
|
|
contentType: contentType,
|
2015-12-17 22:37:35 +02:00
|
|
|
opts: opts,
|
2015-01-14 01:31:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
func (r *rpcRequest) ContentType() string {
|
2015-01-14 01:31:27 +02:00
|
|
|
return r.contentType
|
|
|
|
}
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
func (r *rpcRequest) Service() string {
|
2015-01-14 01:31:27 +02:00
|
|
|
return r.service
|
|
|
|
}
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
func (r *rpcRequest) Method() string {
|
2015-01-14 01:31:27 +02:00
|
|
|
return r.method
|
|
|
|
}
|
|
|
|
|
2015-05-23 18:40:53 +02:00
|
|
|
func (r *rpcRequest) Request() interface{} {
|
2015-01-14 01:31:27 +02:00
|
|
|
return r.request
|
|
|
|
}
|
2015-12-17 22:37:35 +02:00
|
|
|
|
|
|
|
func (r *rpcRequest) Stream() bool {
|
2015-12-31 20:11:46 +02:00
|
|
|
return r.opts.Stream
|
2015-12-17 22:37:35 +02:00
|
|
|
}
|