Files
mautrix-telegram/pkg/gotd/gen/_template/client.tmpl
T
2025-06-27 20:03:37 -07:00

28 lines
570 B
Cheetah

{{ 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 }}