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
1163 lines
28 KiB
Go
1163 lines
28 KiB
Go
//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{}
|
|
)
|
|
|
|
// InputInvoiceClassArray is adapter for slice of InputInvoiceClass.
|
|
type InputInvoiceClassArray []InputInvoiceClass
|
|
|
|
// Sort sorts slice of InputInvoiceClass.
|
|
func (s InputInvoiceClassArray) Sort(less func(a, b InputInvoiceClass) bool) InputInvoiceClassArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceClass.
|
|
func (s InputInvoiceClassArray) SortStable(less func(a, b InputInvoiceClass) bool) InputInvoiceClassArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceClass.
|
|
func (s InputInvoiceClassArray) Retain(keep func(x InputInvoiceClass) bool) InputInvoiceClassArray {
|
|
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 InputInvoiceClassArray) First() (v InputInvoiceClass, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceClassArray) Last() (v InputInvoiceClass, 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 *InputInvoiceClassArray) PopFirst() (v InputInvoiceClass, 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 InputInvoiceClass
|
|
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 *InputInvoiceClassArray) Pop() (v InputInvoiceClass, 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
|
|
}
|
|
|
|
// AsInputInvoiceMessage returns copy with only InputInvoiceMessage constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceMessage() (to InputInvoiceMessageArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceMessage)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceSlug returns copy with only InputInvoiceSlug constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceSlug() (to InputInvoiceSlugArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceSlug)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoicePremiumGiftCode returns copy with only InputInvoicePremiumGiftCode constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoicePremiumGiftCode() (to InputInvoicePremiumGiftCodeArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoicePremiumGiftCode)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceStars returns copy with only InputInvoiceStars constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceStars() (to InputInvoiceStarsArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceStars)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceChatInviteSubscription returns copy with only InputInvoiceChatInviteSubscription constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceChatInviteSubscription() (to InputInvoiceChatInviteSubscriptionArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceChatInviteSubscription)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceStarGift returns copy with only InputInvoiceStarGift constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceStarGift() (to InputInvoiceStarGiftArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceStarGift)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceStarGiftUpgrade returns copy with only InputInvoiceStarGiftUpgrade constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceStarGiftUpgrade() (to InputInvoiceStarGiftUpgradeArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceStarGiftUpgrade)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceStarGiftTransfer returns copy with only InputInvoiceStarGiftTransfer constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceStarGiftTransfer() (to InputInvoiceStarGiftTransferArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceStarGiftTransfer)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoicePremiumGiftStars returns copy with only InputInvoicePremiumGiftStars constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoicePremiumGiftStars() (to InputInvoicePremiumGiftStarsArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoicePremiumGiftStars)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceBusinessBotTransferStars returns copy with only InputInvoiceBusinessBotTransferStars constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceBusinessBotTransferStars() (to InputInvoiceBusinessBotTransferStarsArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceBusinessBotTransferStars)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// AsInputInvoiceStarGiftResale returns copy with only InputInvoiceStarGiftResale constructors.
|
|
func (s InputInvoiceClassArray) AsInputInvoiceStarGiftResale() (to InputInvoiceStarGiftResaleArray) {
|
|
for _, elem := range s {
|
|
value, ok := elem.(*InputInvoiceStarGiftResale)
|
|
if !ok {
|
|
continue
|
|
}
|
|
to = append(to, *value)
|
|
}
|
|
|
|
return to
|
|
}
|
|
|
|
// InputInvoiceMessageArray is adapter for slice of InputInvoiceMessage.
|
|
type InputInvoiceMessageArray []InputInvoiceMessage
|
|
|
|
// Sort sorts slice of InputInvoiceMessage.
|
|
func (s InputInvoiceMessageArray) Sort(less func(a, b InputInvoiceMessage) bool) InputInvoiceMessageArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceMessage.
|
|
func (s InputInvoiceMessageArray) SortStable(less func(a, b InputInvoiceMessage) bool) InputInvoiceMessageArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceMessage.
|
|
func (s InputInvoiceMessageArray) Retain(keep func(x InputInvoiceMessage) bool) InputInvoiceMessageArray {
|
|
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 InputInvoiceMessageArray) First() (v InputInvoiceMessage, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceMessageArray) Last() (v InputInvoiceMessage, 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 *InputInvoiceMessageArray) PopFirst() (v InputInvoiceMessage, 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 InputInvoiceMessage
|
|
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 *InputInvoiceMessageArray) Pop() (v InputInvoiceMessage, 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
|
|
}
|
|
|
|
// InputInvoiceSlugArray is adapter for slice of InputInvoiceSlug.
|
|
type InputInvoiceSlugArray []InputInvoiceSlug
|
|
|
|
// Sort sorts slice of InputInvoiceSlug.
|
|
func (s InputInvoiceSlugArray) Sort(less func(a, b InputInvoiceSlug) bool) InputInvoiceSlugArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceSlug.
|
|
func (s InputInvoiceSlugArray) SortStable(less func(a, b InputInvoiceSlug) bool) InputInvoiceSlugArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceSlug.
|
|
func (s InputInvoiceSlugArray) Retain(keep func(x InputInvoiceSlug) bool) InputInvoiceSlugArray {
|
|
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 InputInvoiceSlugArray) First() (v InputInvoiceSlug, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceSlugArray) Last() (v InputInvoiceSlug, 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 *InputInvoiceSlugArray) PopFirst() (v InputInvoiceSlug, 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 InputInvoiceSlug
|
|
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 *InputInvoiceSlugArray) Pop() (v InputInvoiceSlug, 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
|
|
}
|
|
|
|
// InputInvoicePremiumGiftCodeArray is adapter for slice of InputInvoicePremiumGiftCode.
|
|
type InputInvoicePremiumGiftCodeArray []InputInvoicePremiumGiftCode
|
|
|
|
// Sort sorts slice of InputInvoicePremiumGiftCode.
|
|
func (s InputInvoicePremiumGiftCodeArray) Sort(less func(a, b InputInvoicePremiumGiftCode) bool) InputInvoicePremiumGiftCodeArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoicePremiumGiftCode.
|
|
func (s InputInvoicePremiumGiftCodeArray) SortStable(less func(a, b InputInvoicePremiumGiftCode) bool) InputInvoicePremiumGiftCodeArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoicePremiumGiftCode.
|
|
func (s InputInvoicePremiumGiftCodeArray) Retain(keep func(x InputInvoicePremiumGiftCode) bool) InputInvoicePremiumGiftCodeArray {
|
|
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 InputInvoicePremiumGiftCodeArray) First() (v InputInvoicePremiumGiftCode, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoicePremiumGiftCodeArray) Last() (v InputInvoicePremiumGiftCode, 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 *InputInvoicePremiumGiftCodeArray) PopFirst() (v InputInvoicePremiumGiftCode, 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 InputInvoicePremiumGiftCode
|
|
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 *InputInvoicePremiumGiftCodeArray) Pop() (v InputInvoicePremiumGiftCode, 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
|
|
}
|
|
|
|
// InputInvoiceStarsArray is adapter for slice of InputInvoiceStars.
|
|
type InputInvoiceStarsArray []InputInvoiceStars
|
|
|
|
// Sort sorts slice of InputInvoiceStars.
|
|
func (s InputInvoiceStarsArray) Sort(less func(a, b InputInvoiceStars) bool) InputInvoiceStarsArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceStars.
|
|
func (s InputInvoiceStarsArray) SortStable(less func(a, b InputInvoiceStars) bool) InputInvoiceStarsArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceStars.
|
|
func (s InputInvoiceStarsArray) Retain(keep func(x InputInvoiceStars) bool) InputInvoiceStarsArray {
|
|
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 InputInvoiceStarsArray) First() (v InputInvoiceStars, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceStarsArray) Last() (v InputInvoiceStars, 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 *InputInvoiceStarsArray) PopFirst() (v InputInvoiceStars, 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 InputInvoiceStars
|
|
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 *InputInvoiceStarsArray) Pop() (v InputInvoiceStars, 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
|
|
}
|
|
|
|
// InputInvoiceChatInviteSubscriptionArray is adapter for slice of InputInvoiceChatInviteSubscription.
|
|
type InputInvoiceChatInviteSubscriptionArray []InputInvoiceChatInviteSubscription
|
|
|
|
// Sort sorts slice of InputInvoiceChatInviteSubscription.
|
|
func (s InputInvoiceChatInviteSubscriptionArray) Sort(less func(a, b InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceChatInviteSubscription.
|
|
func (s InputInvoiceChatInviteSubscriptionArray) SortStable(less func(a, b InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceChatInviteSubscription.
|
|
func (s InputInvoiceChatInviteSubscriptionArray) Retain(keep func(x InputInvoiceChatInviteSubscription) bool) InputInvoiceChatInviteSubscriptionArray {
|
|
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 InputInvoiceChatInviteSubscriptionArray) First() (v InputInvoiceChatInviteSubscription, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceChatInviteSubscriptionArray) Last() (v InputInvoiceChatInviteSubscription, 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 *InputInvoiceChatInviteSubscriptionArray) PopFirst() (v InputInvoiceChatInviteSubscription, 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 InputInvoiceChatInviteSubscription
|
|
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 *InputInvoiceChatInviteSubscriptionArray) Pop() (v InputInvoiceChatInviteSubscription, 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
|
|
}
|
|
|
|
// InputInvoiceStarGiftArray is adapter for slice of InputInvoiceStarGift.
|
|
type InputInvoiceStarGiftArray []InputInvoiceStarGift
|
|
|
|
// Sort sorts slice of InputInvoiceStarGift.
|
|
func (s InputInvoiceStarGiftArray) Sort(less func(a, b InputInvoiceStarGift) bool) InputInvoiceStarGiftArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceStarGift.
|
|
func (s InputInvoiceStarGiftArray) SortStable(less func(a, b InputInvoiceStarGift) bool) InputInvoiceStarGiftArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceStarGift.
|
|
func (s InputInvoiceStarGiftArray) Retain(keep func(x InputInvoiceStarGift) bool) InputInvoiceStarGiftArray {
|
|
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 InputInvoiceStarGiftArray) First() (v InputInvoiceStarGift, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceStarGiftArray) Last() (v InputInvoiceStarGift, 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 *InputInvoiceStarGiftArray) PopFirst() (v InputInvoiceStarGift, 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 InputInvoiceStarGift
|
|
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 *InputInvoiceStarGiftArray) Pop() (v InputInvoiceStarGift, 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
|
|
}
|
|
|
|
// InputInvoiceStarGiftUpgradeArray is adapter for slice of InputInvoiceStarGiftUpgrade.
|
|
type InputInvoiceStarGiftUpgradeArray []InputInvoiceStarGiftUpgrade
|
|
|
|
// Sort sorts slice of InputInvoiceStarGiftUpgrade.
|
|
func (s InputInvoiceStarGiftUpgradeArray) Sort(less func(a, b InputInvoiceStarGiftUpgrade) bool) InputInvoiceStarGiftUpgradeArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceStarGiftUpgrade.
|
|
func (s InputInvoiceStarGiftUpgradeArray) SortStable(less func(a, b InputInvoiceStarGiftUpgrade) bool) InputInvoiceStarGiftUpgradeArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceStarGiftUpgrade.
|
|
func (s InputInvoiceStarGiftUpgradeArray) Retain(keep func(x InputInvoiceStarGiftUpgrade) bool) InputInvoiceStarGiftUpgradeArray {
|
|
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 InputInvoiceStarGiftUpgradeArray) First() (v InputInvoiceStarGiftUpgrade, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceStarGiftUpgradeArray) Last() (v InputInvoiceStarGiftUpgrade, 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 *InputInvoiceStarGiftUpgradeArray) PopFirst() (v InputInvoiceStarGiftUpgrade, 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 InputInvoiceStarGiftUpgrade
|
|
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 *InputInvoiceStarGiftUpgradeArray) Pop() (v InputInvoiceStarGiftUpgrade, 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
|
|
}
|
|
|
|
// InputInvoiceStarGiftTransferArray is adapter for slice of InputInvoiceStarGiftTransfer.
|
|
type InputInvoiceStarGiftTransferArray []InputInvoiceStarGiftTransfer
|
|
|
|
// Sort sorts slice of InputInvoiceStarGiftTransfer.
|
|
func (s InputInvoiceStarGiftTransferArray) Sort(less func(a, b InputInvoiceStarGiftTransfer) bool) InputInvoiceStarGiftTransferArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceStarGiftTransfer.
|
|
func (s InputInvoiceStarGiftTransferArray) SortStable(less func(a, b InputInvoiceStarGiftTransfer) bool) InputInvoiceStarGiftTransferArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceStarGiftTransfer.
|
|
func (s InputInvoiceStarGiftTransferArray) Retain(keep func(x InputInvoiceStarGiftTransfer) bool) InputInvoiceStarGiftTransferArray {
|
|
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 InputInvoiceStarGiftTransferArray) First() (v InputInvoiceStarGiftTransfer, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceStarGiftTransferArray) Last() (v InputInvoiceStarGiftTransfer, 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 *InputInvoiceStarGiftTransferArray) PopFirst() (v InputInvoiceStarGiftTransfer, 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 InputInvoiceStarGiftTransfer
|
|
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 *InputInvoiceStarGiftTransferArray) Pop() (v InputInvoiceStarGiftTransfer, 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
|
|
}
|
|
|
|
// InputInvoicePremiumGiftStarsArray is adapter for slice of InputInvoicePremiumGiftStars.
|
|
type InputInvoicePremiumGiftStarsArray []InputInvoicePremiumGiftStars
|
|
|
|
// Sort sorts slice of InputInvoicePremiumGiftStars.
|
|
func (s InputInvoicePremiumGiftStarsArray) Sort(less func(a, b InputInvoicePremiumGiftStars) bool) InputInvoicePremiumGiftStarsArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoicePremiumGiftStars.
|
|
func (s InputInvoicePremiumGiftStarsArray) SortStable(less func(a, b InputInvoicePremiumGiftStars) bool) InputInvoicePremiumGiftStarsArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoicePremiumGiftStars.
|
|
func (s InputInvoicePremiumGiftStarsArray) Retain(keep func(x InputInvoicePremiumGiftStars) bool) InputInvoicePremiumGiftStarsArray {
|
|
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 InputInvoicePremiumGiftStarsArray) First() (v InputInvoicePremiumGiftStars, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoicePremiumGiftStarsArray) Last() (v InputInvoicePremiumGiftStars, 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 *InputInvoicePremiumGiftStarsArray) PopFirst() (v InputInvoicePremiumGiftStars, 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 InputInvoicePremiumGiftStars
|
|
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 *InputInvoicePremiumGiftStarsArray) Pop() (v InputInvoicePremiumGiftStars, 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
|
|
}
|
|
|
|
// InputInvoiceBusinessBotTransferStarsArray is adapter for slice of InputInvoiceBusinessBotTransferStars.
|
|
type InputInvoiceBusinessBotTransferStarsArray []InputInvoiceBusinessBotTransferStars
|
|
|
|
// Sort sorts slice of InputInvoiceBusinessBotTransferStars.
|
|
func (s InputInvoiceBusinessBotTransferStarsArray) Sort(less func(a, b InputInvoiceBusinessBotTransferStars) bool) InputInvoiceBusinessBotTransferStarsArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceBusinessBotTransferStars.
|
|
func (s InputInvoiceBusinessBotTransferStarsArray) SortStable(less func(a, b InputInvoiceBusinessBotTransferStars) bool) InputInvoiceBusinessBotTransferStarsArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceBusinessBotTransferStars.
|
|
func (s InputInvoiceBusinessBotTransferStarsArray) Retain(keep func(x InputInvoiceBusinessBotTransferStars) bool) InputInvoiceBusinessBotTransferStarsArray {
|
|
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 InputInvoiceBusinessBotTransferStarsArray) First() (v InputInvoiceBusinessBotTransferStars, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceBusinessBotTransferStarsArray) Last() (v InputInvoiceBusinessBotTransferStars, 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 *InputInvoiceBusinessBotTransferStarsArray) PopFirst() (v InputInvoiceBusinessBotTransferStars, 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 InputInvoiceBusinessBotTransferStars
|
|
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 *InputInvoiceBusinessBotTransferStarsArray) Pop() (v InputInvoiceBusinessBotTransferStars, 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
|
|
}
|
|
|
|
// InputInvoiceStarGiftResaleArray is adapter for slice of InputInvoiceStarGiftResale.
|
|
type InputInvoiceStarGiftResaleArray []InputInvoiceStarGiftResale
|
|
|
|
// Sort sorts slice of InputInvoiceStarGiftResale.
|
|
func (s InputInvoiceStarGiftResaleArray) Sort(less func(a, b InputInvoiceStarGiftResale) bool) InputInvoiceStarGiftResaleArray {
|
|
sort.Slice(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// SortStable sorts slice of InputInvoiceStarGiftResale.
|
|
func (s InputInvoiceStarGiftResaleArray) SortStable(less func(a, b InputInvoiceStarGiftResale) bool) InputInvoiceStarGiftResaleArray {
|
|
sort.SliceStable(s, func(i, j int) bool {
|
|
return less(s[i], s[j])
|
|
})
|
|
return s
|
|
}
|
|
|
|
// Retain filters in-place slice of InputInvoiceStarGiftResale.
|
|
func (s InputInvoiceStarGiftResaleArray) Retain(keep func(x InputInvoiceStarGiftResale) bool) InputInvoiceStarGiftResaleArray {
|
|
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 InputInvoiceStarGiftResaleArray) First() (v InputInvoiceStarGiftResale, ok bool) {
|
|
if len(s) < 1 {
|
|
return
|
|
}
|
|
return s[0], true
|
|
}
|
|
|
|
// Last returns last element of slice (if exists).
|
|
func (s InputInvoiceStarGiftResaleArray) Last() (v InputInvoiceStarGiftResale, 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 *InputInvoiceStarGiftResaleArray) PopFirst() (v InputInvoiceStarGiftResale, 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 InputInvoiceStarGiftResale
|
|
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 *InputInvoiceStarGiftResaleArray) Pop() (v InputInvoiceStarGiftResale, 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
|
|
}
|