{{ define "client" }}
{{ $pkg := $.Package }}
{{ template "header" $ }}

// Invoker can invoke raw MTProto rpc calls.
type Invoker interface {
  Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder) error
}

// Client implement methods for calling functions from TL schema via Invoker.
type Client struct {
  rpc Invoker
}

// Invoker returns Invoker used by this client.
func (c *Client) Invoker() Invoker {
    return c.rpc
}

// NewClient creates new Client.
func NewClient(invoker Invoker) *Client {
  return &Client{
    rpc: invoker,
  }
}

{{ end }}
