7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
47 lines
1.3 KiB
Cheetah
47 lines
1.3 KiB
Cheetah
{{- /*gotype: go.mau.fi/mautrix-telegram/pkg/gotd/gen.structDef*/ -}}
|
|
{{ define "struct" }}{{ $s := . }}
|
|
// {{ $s.Comment }}
|
|
{{- if $s.Docs }}
|
|
{{- template "print_comment" $s.Docs }}
|
|
{{- end }}
|
|
{{- if $s.Links }}
|
|
{{- template "print_links" $s.Links }}
|
|
{{- end }}
|
|
{{- if $s.URL }}
|
|
//
|
|
// See {{ $s.URL }} for reference.
|
|
{{- end }}
|
|
type {{ $s.Name }} struct {
|
|
{{- range $f := $s.Fields }}
|
|
{{- template "print_comment" $f.Comment }}
|
|
{{- if $f.Links}}
|
|
{{- template "print_links" $f.Links }}
|
|
{{- end }}
|
|
{{- if and ($f.Conditional) (not $f.ConditionalBool) }}
|
|
//
|
|
// Use Set{{ $f.Name }} and Get{{ $f.Name }} helpers.
|
|
{{- end }}
|
|
{{ $f.Name }} {{ template "print_type" $f }}
|
|
{{- end }}
|
|
}
|
|
|
|
// {{ $s.Name }}TypeID is TL type id of {{ $s.Name }}.
|
|
const {{ $s.Name }}TypeID = {{ if not $s.Vector }}0x{{ $s.HexID }}{{- else -}}bin.TypeVector{{- end }}
|
|
|
|
{{ if $s.Interface }}
|
|
// construct implements constructor of {{ $s.Interface }}.
|
|
func ({{ $s.Receiver }} {{ $s.Name }}) construct() {{ $s.Interface }} { return &{{ $s.Receiver }} }
|
|
{{ end }}
|
|
|
|
// Ensuring interfaces in compile-time for {{ $s.Name }}.
|
|
var (
|
|
_ bin.Encoder = &{{ $s.Name }}{}
|
|
_ bin.Decoder = &{{ $s.Name }}{}
|
|
_ bin.BareEncoder = &{{ $s.Name }}{}
|
|
_ bin.BareDecoder = &{{ $s.Name }}{}
|
|
{{ if $s.Interface }}
|
|
_ {{ $s.Interface }} = &{{ $s.Name }}{}
|
|
{{ end }}
|
|
)
|
|
{{ end }}
|