package micro

import "context"

type (
	Request struct {
		ServiceName string
		Method      string
		Body        interface{}
		client      *Client
	}
)

//Do do request
func (r *Request) Do(ctx context.Context) (Response, error) {
	return r.client.Do(ctx, r)
}

//Call call method
func (r *Request) Call(ctx context.Context, i interface{}) (err error) {
	var (
		res Response
	)
	if res, err = r.Do(ctx); err != nil {
		return
	}
	if res.Error() != nil {
		return res.Error()
	}
	err = res.Decode(i)
	return
}
