move gotd fork into repo. (#111)
- 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
This commit is contained in:
@@ -0,0 +1,511 @@
|
||||
//go:build !no_gotd_slices
|
||||
// +build !no_gotd_slices
|
||||
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
||||
)
|
||||
|
||||
// No-op definition for keeping imports.
|
||||
var (
|
||||
_ = bin.Buffer{}
|
||||
_ = context.Background()
|
||||
_ = fmt.Stringer(nil)
|
||||
_ = strings.Builder{}
|
||||
_ = errors.Is
|
||||
_ = multierr.AppendInto
|
||||
_ = sort.Ints
|
||||
_ = tdp.Format
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// StarGiftAttributeClassArray is adapter for slice of StarGiftAttributeClass.
|
||||
type StarGiftAttributeClassArray []StarGiftAttributeClass
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributeClassArray) Sort(less func(a, b StarGiftAttributeClass) bool) StarGiftAttributeClassArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributeClassArray) SortStable(less func(a, b StarGiftAttributeClass) bool) StarGiftAttributeClassArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeClass.
|
||||
func (s StarGiftAttributeClassArray) Retain(keep func(x StarGiftAttributeClass) bool) StarGiftAttributeClassArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s StarGiftAttributeClassArray) First() (v StarGiftAttributeClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeClassArray) Last() (v StarGiftAttributeClass, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeClassArray) PopFirst() (v StarGiftAttributeClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero StarGiftAttributeClass
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeClassArray) Pop() (v StarGiftAttributeClass, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// AsStarGiftAttributeModel returns copy with only StarGiftAttributeModel constructors.
|
||||
func (s StarGiftAttributeClassArray) AsStarGiftAttributeModel() (to StarGiftAttributeModelArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAttributeModel)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsStarGiftAttributePattern returns copy with only StarGiftAttributePattern constructors.
|
||||
func (s StarGiftAttributeClassArray) AsStarGiftAttributePattern() (to StarGiftAttributePatternArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAttributePattern)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsStarGiftAttributeBackdrop returns copy with only StarGiftAttributeBackdrop constructors.
|
||||
func (s StarGiftAttributeClassArray) AsStarGiftAttributeBackdrop() (to StarGiftAttributeBackdropArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAttributeBackdrop)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// AsStarGiftAttributeOriginalDetails returns copy with only StarGiftAttributeOriginalDetails constructors.
|
||||
func (s StarGiftAttributeClassArray) AsStarGiftAttributeOriginalDetails() (to StarGiftAttributeOriginalDetailsArray) {
|
||||
for _, elem := range s {
|
||||
value, ok := elem.(*StarGiftAttributeOriginalDetails)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
to = append(to, *value)
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
// StarGiftAttributeModelArray is adapter for slice of StarGiftAttributeModel.
|
||||
type StarGiftAttributeModelArray []StarGiftAttributeModel
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeModel.
|
||||
func (s StarGiftAttributeModelArray) Sort(less func(a, b StarGiftAttributeModel) bool) StarGiftAttributeModelArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeModel.
|
||||
func (s StarGiftAttributeModelArray) SortStable(less func(a, b StarGiftAttributeModel) bool) StarGiftAttributeModelArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeModel.
|
||||
func (s StarGiftAttributeModelArray) Retain(keep func(x StarGiftAttributeModel) bool) StarGiftAttributeModelArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s StarGiftAttributeModelArray) First() (v StarGiftAttributeModel, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeModelArray) Last() (v StarGiftAttributeModel, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeModelArray) PopFirst() (v StarGiftAttributeModel, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero StarGiftAttributeModel
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeModelArray) Pop() (v StarGiftAttributeModel, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// StarGiftAttributePatternArray is adapter for slice of StarGiftAttributePattern.
|
||||
type StarGiftAttributePatternArray []StarGiftAttributePattern
|
||||
|
||||
// Sort sorts slice of StarGiftAttributePattern.
|
||||
func (s StarGiftAttributePatternArray) Sort(less func(a, b StarGiftAttributePattern) bool) StarGiftAttributePatternArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributePattern.
|
||||
func (s StarGiftAttributePatternArray) SortStable(less func(a, b StarGiftAttributePattern) bool) StarGiftAttributePatternArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributePattern.
|
||||
func (s StarGiftAttributePatternArray) Retain(keep func(x StarGiftAttributePattern) bool) StarGiftAttributePatternArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s StarGiftAttributePatternArray) First() (v StarGiftAttributePattern, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributePatternArray) Last() (v StarGiftAttributePattern, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributePatternArray) PopFirst() (v StarGiftAttributePattern, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero StarGiftAttributePattern
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributePatternArray) Pop() (v StarGiftAttributePattern, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// StarGiftAttributeBackdropArray is adapter for slice of StarGiftAttributeBackdrop.
|
||||
type StarGiftAttributeBackdropArray []StarGiftAttributeBackdrop
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeBackdrop.
|
||||
func (s StarGiftAttributeBackdropArray) Sort(less func(a, b StarGiftAttributeBackdrop) bool) StarGiftAttributeBackdropArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeBackdrop.
|
||||
func (s StarGiftAttributeBackdropArray) SortStable(less func(a, b StarGiftAttributeBackdrop) bool) StarGiftAttributeBackdropArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeBackdrop.
|
||||
func (s StarGiftAttributeBackdropArray) Retain(keep func(x StarGiftAttributeBackdrop) bool) StarGiftAttributeBackdropArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s StarGiftAttributeBackdropArray) First() (v StarGiftAttributeBackdrop, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeBackdropArray) Last() (v StarGiftAttributeBackdrop, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeBackdropArray) PopFirst() (v StarGiftAttributeBackdrop, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero StarGiftAttributeBackdrop
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeBackdropArray) Pop() (v StarGiftAttributeBackdrop, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// StarGiftAttributeOriginalDetailsArray is adapter for slice of StarGiftAttributeOriginalDetails.
|
||||
type StarGiftAttributeOriginalDetailsArray []StarGiftAttributeOriginalDetails
|
||||
|
||||
// Sort sorts slice of StarGiftAttributeOriginalDetails.
|
||||
func (s StarGiftAttributeOriginalDetailsArray) Sort(less func(a, b StarGiftAttributeOriginalDetails) bool) StarGiftAttributeOriginalDetailsArray {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// SortStable sorts slice of StarGiftAttributeOriginalDetails.
|
||||
func (s StarGiftAttributeOriginalDetailsArray) SortStable(less func(a, b StarGiftAttributeOriginalDetails) bool) StarGiftAttributeOriginalDetailsArray {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return less(s[i], s[j])
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
// Retain filters in-place slice of StarGiftAttributeOriginalDetails.
|
||||
func (s StarGiftAttributeOriginalDetailsArray) Retain(keep func(x StarGiftAttributeOriginalDetails) bool) StarGiftAttributeOriginalDetailsArray {
|
||||
n := 0
|
||||
for _, x := range s {
|
||||
if keep(x) {
|
||||
s[n] = x
|
||||
n++
|
||||
}
|
||||
}
|
||||
s = s[:n]
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// First returns first element of slice (if exists).
|
||||
func (s StarGiftAttributeOriginalDetailsArray) First() (v StarGiftAttributeOriginalDetails, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[0], true
|
||||
}
|
||||
|
||||
// Last returns last element of slice (if exists).
|
||||
func (s StarGiftAttributeOriginalDetailsArray) Last() (v StarGiftAttributeOriginalDetails, ok bool) {
|
||||
if len(s) < 1 {
|
||||
return
|
||||
}
|
||||
return s[len(s)-1], true
|
||||
}
|
||||
|
||||
// PopFirst returns first element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeOriginalDetailsArray) PopFirst() (v StarGiftAttributeOriginalDetails, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[0]
|
||||
|
||||
// Delete by index from SliceTricks.
|
||||
copy(a[0:], a[1:])
|
||||
var zero StarGiftAttributeOriginalDetails
|
||||
a[len(a)-1] = zero
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// Pop returns last element of slice (if exists) and deletes it.
|
||||
func (s *StarGiftAttributeOriginalDetailsArray) Pop() (v StarGiftAttributeOriginalDetails, ok bool) {
|
||||
if s == nil || len(*s) < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
a := *s
|
||||
v = a[len(a)-1]
|
||||
a = a[:len(a)-1]
|
||||
*s = a
|
||||
|
||||
return v, true
|
||||
}
|
||||
|
||||
// SortByDate sorts slice of StarGiftAttributeOriginalDetails by Date.
|
||||
func (s StarGiftAttributeOriginalDetailsArray) SortByDate() StarGiftAttributeOriginalDetailsArray {
|
||||
return s.Sort(func(a, b StarGiftAttributeOriginalDetails) bool {
|
||||
return a.GetDate() < b.GetDate()
|
||||
})
|
||||
}
|
||||
|
||||
// SortStableByDate sorts slice of StarGiftAttributeOriginalDetails by Date.
|
||||
func (s StarGiftAttributeOriginalDetailsArray) SortStableByDate() StarGiftAttributeOriginalDetailsArray {
|
||||
return s.SortStable(func(a, b StarGiftAttributeOriginalDetails) bool {
|
||||
return a.GetDate() < b.GetDate()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user