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

// MessageActionClassArray is adapter for slice of MessageActionClass.
type MessageActionClassArray []MessageActionClass

// Sort sorts slice of MessageActionClass.
func (s MessageActionClassArray) Sort(less func(a, b MessageActionClass) bool) MessageActionClassArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionClass.
func (s MessageActionClassArray) SortStable(less func(a, b MessageActionClass) bool) MessageActionClassArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionClass.
func (s MessageActionClassArray) Retain(keep func(x MessageActionClass) bool) MessageActionClassArray {
	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 MessageActionClassArray) First() (v MessageActionClass, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionClassArray) Last() (v MessageActionClass, 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 *MessageActionClassArray) PopFirst() (v MessageActionClass, 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 MessageActionClass
	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 *MessageActionClassArray) Pop() (v MessageActionClass, 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
}

// AsMessageActionChatCreate returns copy with only MessageActionChatCreate constructors.
func (s MessageActionClassArray) AsMessageActionChatCreate() (to MessageActionChatCreateArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatCreate)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatEditTitle returns copy with only MessageActionChatEditTitle constructors.
func (s MessageActionClassArray) AsMessageActionChatEditTitle() (to MessageActionChatEditTitleArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatEditTitle)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatEditPhoto returns copy with only MessageActionChatEditPhoto constructors.
func (s MessageActionClassArray) AsMessageActionChatEditPhoto() (to MessageActionChatEditPhotoArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatEditPhoto)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatAddUser returns copy with only MessageActionChatAddUser constructors.
func (s MessageActionClassArray) AsMessageActionChatAddUser() (to MessageActionChatAddUserArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatAddUser)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatDeleteUser returns copy with only MessageActionChatDeleteUser constructors.
func (s MessageActionClassArray) AsMessageActionChatDeleteUser() (to MessageActionChatDeleteUserArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatDeleteUser)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatJoinedByLink returns copy with only MessageActionChatJoinedByLink constructors.
func (s MessageActionClassArray) AsMessageActionChatJoinedByLink() (to MessageActionChatJoinedByLinkArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatJoinedByLink)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChannelCreate returns copy with only MessageActionChannelCreate constructors.
func (s MessageActionClassArray) AsMessageActionChannelCreate() (to MessageActionChannelCreateArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChannelCreate)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChatMigrateTo returns copy with only MessageActionChatMigrateTo constructors.
func (s MessageActionClassArray) AsMessageActionChatMigrateTo() (to MessageActionChatMigrateToArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChatMigrateTo)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionChannelMigrateFrom returns copy with only MessageActionChannelMigrateFrom constructors.
func (s MessageActionClassArray) AsMessageActionChannelMigrateFrom() (to MessageActionChannelMigrateFromArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionChannelMigrateFrom)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGameScore returns copy with only MessageActionGameScore constructors.
func (s MessageActionClassArray) AsMessageActionGameScore() (to MessageActionGameScoreArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGameScore)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPaymentSentMe returns copy with only MessageActionPaymentSentMe constructors.
func (s MessageActionClassArray) AsMessageActionPaymentSentMe() (to MessageActionPaymentSentMeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPaymentSentMe)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPaymentSent returns copy with only MessageActionPaymentSent constructors.
func (s MessageActionClassArray) AsMessageActionPaymentSent() (to MessageActionPaymentSentArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPaymentSent)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPhoneCall returns copy with only MessageActionPhoneCall constructors.
func (s MessageActionClassArray) AsMessageActionPhoneCall() (to MessageActionPhoneCallArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPhoneCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionCustomAction returns copy with only MessageActionCustomAction constructors.
func (s MessageActionClassArray) AsMessageActionCustomAction() (to MessageActionCustomActionArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionCustomAction)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionBotAllowed returns copy with only MessageActionBotAllowed constructors.
func (s MessageActionClassArray) AsMessageActionBotAllowed() (to MessageActionBotAllowedArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionBotAllowed)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSecureValuesSentMe returns copy with only MessageActionSecureValuesSentMe constructors.
func (s MessageActionClassArray) AsMessageActionSecureValuesSentMe() (to MessageActionSecureValuesSentMeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSecureValuesSentMe)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSecureValuesSent returns copy with only MessageActionSecureValuesSent constructors.
func (s MessageActionClassArray) AsMessageActionSecureValuesSent() (to MessageActionSecureValuesSentArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSecureValuesSent)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGeoProximityReached returns copy with only MessageActionGeoProximityReached constructors.
func (s MessageActionClassArray) AsMessageActionGeoProximityReached() (to MessageActionGeoProximityReachedArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGeoProximityReached)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGroupCall returns copy with only MessageActionGroupCall constructors.
func (s MessageActionClassArray) AsMessageActionGroupCall() (to MessageActionGroupCallArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGroupCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionInviteToGroupCall returns copy with only MessageActionInviteToGroupCall constructors.
func (s MessageActionClassArray) AsMessageActionInviteToGroupCall() (to MessageActionInviteToGroupCallArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionInviteToGroupCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSetMessagesTTL returns copy with only MessageActionSetMessagesTTL constructors.
func (s MessageActionClassArray) AsMessageActionSetMessagesTTL() (to MessageActionSetMessagesTTLArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSetMessagesTTL)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGroupCallScheduled returns copy with only MessageActionGroupCallScheduled constructors.
func (s MessageActionClassArray) AsMessageActionGroupCallScheduled() (to MessageActionGroupCallScheduledArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGroupCallScheduled)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSetChatTheme returns copy with only MessageActionSetChatTheme constructors.
func (s MessageActionClassArray) AsMessageActionSetChatTheme() (to MessageActionSetChatThemeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSetChatTheme)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionWebViewDataSentMe returns copy with only MessageActionWebViewDataSentMe constructors.
func (s MessageActionClassArray) AsMessageActionWebViewDataSentMe() (to MessageActionWebViewDataSentMeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionWebViewDataSentMe)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionWebViewDataSent returns copy with only MessageActionWebViewDataSent constructors.
func (s MessageActionClassArray) AsMessageActionWebViewDataSent() (to MessageActionWebViewDataSentArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionWebViewDataSent)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiftPremium returns copy with only MessageActionGiftPremium constructors.
func (s MessageActionClassArray) AsMessageActionGiftPremium() (to MessageActionGiftPremiumArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiftPremium)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionTopicCreate returns copy with only MessageActionTopicCreate constructors.
func (s MessageActionClassArray) AsMessageActionTopicCreate() (to MessageActionTopicCreateArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionTopicCreate)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionTopicEdit returns copy with only MessageActionTopicEdit constructors.
func (s MessageActionClassArray) AsMessageActionTopicEdit() (to MessageActionTopicEditArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionTopicEdit)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSuggestProfilePhoto returns copy with only MessageActionSuggestProfilePhoto constructors.
func (s MessageActionClassArray) AsMessageActionSuggestProfilePhoto() (to MessageActionSuggestProfilePhotoArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSuggestProfilePhoto)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionRequestedPeer returns copy with only MessageActionRequestedPeer constructors.
func (s MessageActionClassArray) AsMessageActionRequestedPeer() (to MessageActionRequestedPeerArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionRequestedPeer)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSetChatWallPaper returns copy with only MessageActionSetChatWallPaper constructors.
func (s MessageActionClassArray) AsMessageActionSetChatWallPaper() (to MessageActionSetChatWallPaperArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSetChatWallPaper)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiftCode returns copy with only MessageActionGiftCode constructors.
func (s MessageActionClassArray) AsMessageActionGiftCode() (to MessageActionGiftCodeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiftCode)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiveawayLaunch returns copy with only MessageActionGiveawayLaunch constructors.
func (s MessageActionClassArray) AsMessageActionGiveawayLaunch() (to MessageActionGiveawayLaunchArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiveawayLaunch)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiveawayResults returns copy with only MessageActionGiveawayResults constructors.
func (s MessageActionClassArray) AsMessageActionGiveawayResults() (to MessageActionGiveawayResultsArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiveawayResults)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionBoostApply returns copy with only MessageActionBoostApply constructors.
func (s MessageActionClassArray) AsMessageActionBoostApply() (to MessageActionBoostApplyArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionBoostApply)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionRequestedPeerSentMe returns copy with only MessageActionRequestedPeerSentMe constructors.
func (s MessageActionClassArray) AsMessageActionRequestedPeerSentMe() (to MessageActionRequestedPeerSentMeArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionRequestedPeerSentMe)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPaymentRefunded returns copy with only MessageActionPaymentRefunded constructors.
func (s MessageActionClassArray) AsMessageActionPaymentRefunded() (to MessageActionPaymentRefundedArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPaymentRefunded)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiftStars returns copy with only MessageActionGiftStars constructors.
func (s MessageActionClassArray) AsMessageActionGiftStars() (to MessageActionGiftStarsArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiftStars)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPrizeStars returns copy with only MessageActionPrizeStars constructors.
func (s MessageActionClassArray) AsMessageActionPrizeStars() (to MessageActionPrizeStarsArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPrizeStars)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionStarGift returns copy with only MessageActionStarGift constructors.
func (s MessageActionClassArray) AsMessageActionStarGift() (to MessageActionStarGiftArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionStarGift)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionStarGiftUnique returns copy with only MessageActionStarGiftUnique constructors.
func (s MessageActionClassArray) AsMessageActionStarGiftUnique() (to MessageActionStarGiftUniqueArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionStarGiftUnique)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPaidMessagesRefunded returns copy with only MessageActionPaidMessagesRefunded constructors.
func (s MessageActionClassArray) AsMessageActionPaidMessagesRefunded() (to MessageActionPaidMessagesRefundedArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPaidMessagesRefunded)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionPaidMessagesPrice returns copy with only MessageActionPaidMessagesPrice constructors.
func (s MessageActionClassArray) AsMessageActionPaidMessagesPrice() (to MessageActionPaidMessagesPriceArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionPaidMessagesPrice)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionConferenceCall returns copy with only MessageActionConferenceCall constructors.
func (s MessageActionClassArray) AsMessageActionConferenceCall() (to MessageActionConferenceCallArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionConferenceCall)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionTodoCompletions returns copy with only MessageActionTodoCompletions constructors.
func (s MessageActionClassArray) AsMessageActionTodoCompletions() (to MessageActionTodoCompletionsArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionTodoCompletions)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionTodoAppendTasks returns copy with only MessageActionTodoAppendTasks constructors.
func (s MessageActionClassArray) AsMessageActionTodoAppendTasks() (to MessageActionTodoAppendTasksArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionTodoAppendTasks)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSuggestedPostApproval returns copy with only MessageActionSuggestedPostApproval constructors.
func (s MessageActionClassArray) AsMessageActionSuggestedPostApproval() (to MessageActionSuggestedPostApprovalArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSuggestedPostApproval)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSuggestedPostSuccess returns copy with only MessageActionSuggestedPostSuccess constructors.
func (s MessageActionClassArray) AsMessageActionSuggestedPostSuccess() (to MessageActionSuggestedPostSuccessArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSuggestedPostSuccess)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSuggestedPostRefund returns copy with only MessageActionSuggestedPostRefund constructors.
func (s MessageActionClassArray) AsMessageActionSuggestedPostRefund() (to MessageActionSuggestedPostRefundArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSuggestedPostRefund)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionGiftTon returns copy with only MessageActionGiftTon constructors.
func (s MessageActionClassArray) AsMessageActionGiftTon() (to MessageActionGiftTonArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionGiftTon)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// AsMessageActionSuggestBirthday returns copy with only MessageActionSuggestBirthday constructors.
func (s MessageActionClassArray) AsMessageActionSuggestBirthday() (to MessageActionSuggestBirthdayArray) {
	for _, elem := range s {
		value, ok := elem.(*MessageActionSuggestBirthday)
		if !ok {
			continue
		}
		to = append(to, *value)
	}

	return to
}

// MessageActionChatCreateArray is adapter for slice of MessageActionChatCreate.
type MessageActionChatCreateArray []MessageActionChatCreate

// Sort sorts slice of MessageActionChatCreate.
func (s MessageActionChatCreateArray) Sort(less func(a, b MessageActionChatCreate) bool) MessageActionChatCreateArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatCreate.
func (s MessageActionChatCreateArray) SortStable(less func(a, b MessageActionChatCreate) bool) MessageActionChatCreateArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatCreate.
func (s MessageActionChatCreateArray) Retain(keep func(x MessageActionChatCreate) bool) MessageActionChatCreateArray {
	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 MessageActionChatCreateArray) First() (v MessageActionChatCreate, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatCreateArray) Last() (v MessageActionChatCreate, 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 *MessageActionChatCreateArray) PopFirst() (v MessageActionChatCreate, 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 MessageActionChatCreate
	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 *MessageActionChatCreateArray) Pop() (v MessageActionChatCreate, 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
}

// MessageActionChatEditTitleArray is adapter for slice of MessageActionChatEditTitle.
type MessageActionChatEditTitleArray []MessageActionChatEditTitle

// Sort sorts slice of MessageActionChatEditTitle.
func (s MessageActionChatEditTitleArray) Sort(less func(a, b MessageActionChatEditTitle) bool) MessageActionChatEditTitleArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatEditTitle.
func (s MessageActionChatEditTitleArray) SortStable(less func(a, b MessageActionChatEditTitle) bool) MessageActionChatEditTitleArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatEditTitle.
func (s MessageActionChatEditTitleArray) Retain(keep func(x MessageActionChatEditTitle) bool) MessageActionChatEditTitleArray {
	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 MessageActionChatEditTitleArray) First() (v MessageActionChatEditTitle, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatEditTitleArray) Last() (v MessageActionChatEditTitle, 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 *MessageActionChatEditTitleArray) PopFirst() (v MessageActionChatEditTitle, 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 MessageActionChatEditTitle
	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 *MessageActionChatEditTitleArray) Pop() (v MessageActionChatEditTitle, 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
}

// MessageActionChatEditPhotoArray is adapter for slice of MessageActionChatEditPhoto.
type MessageActionChatEditPhotoArray []MessageActionChatEditPhoto

// Sort sorts slice of MessageActionChatEditPhoto.
func (s MessageActionChatEditPhotoArray) Sort(less func(a, b MessageActionChatEditPhoto) bool) MessageActionChatEditPhotoArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatEditPhoto.
func (s MessageActionChatEditPhotoArray) SortStable(less func(a, b MessageActionChatEditPhoto) bool) MessageActionChatEditPhotoArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatEditPhoto.
func (s MessageActionChatEditPhotoArray) Retain(keep func(x MessageActionChatEditPhoto) bool) MessageActionChatEditPhotoArray {
	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 MessageActionChatEditPhotoArray) First() (v MessageActionChatEditPhoto, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatEditPhotoArray) Last() (v MessageActionChatEditPhoto, 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 *MessageActionChatEditPhotoArray) PopFirst() (v MessageActionChatEditPhoto, 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 MessageActionChatEditPhoto
	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 *MessageActionChatEditPhotoArray) Pop() (v MessageActionChatEditPhoto, 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
}

// MessageActionChatAddUserArray is adapter for slice of MessageActionChatAddUser.
type MessageActionChatAddUserArray []MessageActionChatAddUser

// Sort sorts slice of MessageActionChatAddUser.
func (s MessageActionChatAddUserArray) Sort(less func(a, b MessageActionChatAddUser) bool) MessageActionChatAddUserArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatAddUser.
func (s MessageActionChatAddUserArray) SortStable(less func(a, b MessageActionChatAddUser) bool) MessageActionChatAddUserArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatAddUser.
func (s MessageActionChatAddUserArray) Retain(keep func(x MessageActionChatAddUser) bool) MessageActionChatAddUserArray {
	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 MessageActionChatAddUserArray) First() (v MessageActionChatAddUser, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatAddUserArray) Last() (v MessageActionChatAddUser, 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 *MessageActionChatAddUserArray) PopFirst() (v MessageActionChatAddUser, 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 MessageActionChatAddUser
	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 *MessageActionChatAddUserArray) Pop() (v MessageActionChatAddUser, 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
}

// MessageActionChatDeleteUserArray is adapter for slice of MessageActionChatDeleteUser.
type MessageActionChatDeleteUserArray []MessageActionChatDeleteUser

// Sort sorts slice of MessageActionChatDeleteUser.
func (s MessageActionChatDeleteUserArray) Sort(less func(a, b MessageActionChatDeleteUser) bool) MessageActionChatDeleteUserArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatDeleteUser.
func (s MessageActionChatDeleteUserArray) SortStable(less func(a, b MessageActionChatDeleteUser) bool) MessageActionChatDeleteUserArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatDeleteUser.
func (s MessageActionChatDeleteUserArray) Retain(keep func(x MessageActionChatDeleteUser) bool) MessageActionChatDeleteUserArray {
	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 MessageActionChatDeleteUserArray) First() (v MessageActionChatDeleteUser, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatDeleteUserArray) Last() (v MessageActionChatDeleteUser, 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 *MessageActionChatDeleteUserArray) PopFirst() (v MessageActionChatDeleteUser, 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 MessageActionChatDeleteUser
	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 *MessageActionChatDeleteUserArray) Pop() (v MessageActionChatDeleteUser, 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
}

// MessageActionChatJoinedByLinkArray is adapter for slice of MessageActionChatJoinedByLink.
type MessageActionChatJoinedByLinkArray []MessageActionChatJoinedByLink

// Sort sorts slice of MessageActionChatJoinedByLink.
func (s MessageActionChatJoinedByLinkArray) Sort(less func(a, b MessageActionChatJoinedByLink) bool) MessageActionChatJoinedByLinkArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatJoinedByLink.
func (s MessageActionChatJoinedByLinkArray) SortStable(less func(a, b MessageActionChatJoinedByLink) bool) MessageActionChatJoinedByLinkArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatJoinedByLink.
func (s MessageActionChatJoinedByLinkArray) Retain(keep func(x MessageActionChatJoinedByLink) bool) MessageActionChatJoinedByLinkArray {
	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 MessageActionChatJoinedByLinkArray) First() (v MessageActionChatJoinedByLink, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatJoinedByLinkArray) Last() (v MessageActionChatJoinedByLink, 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 *MessageActionChatJoinedByLinkArray) PopFirst() (v MessageActionChatJoinedByLink, 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 MessageActionChatJoinedByLink
	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 *MessageActionChatJoinedByLinkArray) Pop() (v MessageActionChatJoinedByLink, 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
}

// MessageActionChannelCreateArray is adapter for slice of MessageActionChannelCreate.
type MessageActionChannelCreateArray []MessageActionChannelCreate

// Sort sorts slice of MessageActionChannelCreate.
func (s MessageActionChannelCreateArray) Sort(less func(a, b MessageActionChannelCreate) bool) MessageActionChannelCreateArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChannelCreate.
func (s MessageActionChannelCreateArray) SortStable(less func(a, b MessageActionChannelCreate) bool) MessageActionChannelCreateArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChannelCreate.
func (s MessageActionChannelCreateArray) Retain(keep func(x MessageActionChannelCreate) bool) MessageActionChannelCreateArray {
	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 MessageActionChannelCreateArray) First() (v MessageActionChannelCreate, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChannelCreateArray) Last() (v MessageActionChannelCreate, 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 *MessageActionChannelCreateArray) PopFirst() (v MessageActionChannelCreate, 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 MessageActionChannelCreate
	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 *MessageActionChannelCreateArray) Pop() (v MessageActionChannelCreate, 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
}

// MessageActionChatMigrateToArray is adapter for slice of MessageActionChatMigrateTo.
type MessageActionChatMigrateToArray []MessageActionChatMigrateTo

// Sort sorts slice of MessageActionChatMigrateTo.
func (s MessageActionChatMigrateToArray) Sort(less func(a, b MessageActionChatMigrateTo) bool) MessageActionChatMigrateToArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChatMigrateTo.
func (s MessageActionChatMigrateToArray) SortStable(less func(a, b MessageActionChatMigrateTo) bool) MessageActionChatMigrateToArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChatMigrateTo.
func (s MessageActionChatMigrateToArray) Retain(keep func(x MessageActionChatMigrateTo) bool) MessageActionChatMigrateToArray {
	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 MessageActionChatMigrateToArray) First() (v MessageActionChatMigrateTo, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChatMigrateToArray) Last() (v MessageActionChatMigrateTo, 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 *MessageActionChatMigrateToArray) PopFirst() (v MessageActionChatMigrateTo, 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 MessageActionChatMigrateTo
	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 *MessageActionChatMigrateToArray) Pop() (v MessageActionChatMigrateTo, 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
}

// MessageActionChannelMigrateFromArray is adapter for slice of MessageActionChannelMigrateFrom.
type MessageActionChannelMigrateFromArray []MessageActionChannelMigrateFrom

// Sort sorts slice of MessageActionChannelMigrateFrom.
func (s MessageActionChannelMigrateFromArray) Sort(less func(a, b MessageActionChannelMigrateFrom) bool) MessageActionChannelMigrateFromArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionChannelMigrateFrom.
func (s MessageActionChannelMigrateFromArray) SortStable(less func(a, b MessageActionChannelMigrateFrom) bool) MessageActionChannelMigrateFromArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionChannelMigrateFrom.
func (s MessageActionChannelMigrateFromArray) Retain(keep func(x MessageActionChannelMigrateFrom) bool) MessageActionChannelMigrateFromArray {
	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 MessageActionChannelMigrateFromArray) First() (v MessageActionChannelMigrateFrom, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionChannelMigrateFromArray) Last() (v MessageActionChannelMigrateFrom, 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 *MessageActionChannelMigrateFromArray) PopFirst() (v MessageActionChannelMigrateFrom, 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 MessageActionChannelMigrateFrom
	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 *MessageActionChannelMigrateFromArray) Pop() (v MessageActionChannelMigrateFrom, 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
}

// MessageActionGameScoreArray is adapter for slice of MessageActionGameScore.
type MessageActionGameScoreArray []MessageActionGameScore

// Sort sorts slice of MessageActionGameScore.
func (s MessageActionGameScoreArray) Sort(less func(a, b MessageActionGameScore) bool) MessageActionGameScoreArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGameScore.
func (s MessageActionGameScoreArray) SortStable(less func(a, b MessageActionGameScore) bool) MessageActionGameScoreArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGameScore.
func (s MessageActionGameScoreArray) Retain(keep func(x MessageActionGameScore) bool) MessageActionGameScoreArray {
	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 MessageActionGameScoreArray) First() (v MessageActionGameScore, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGameScoreArray) Last() (v MessageActionGameScore, 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 *MessageActionGameScoreArray) PopFirst() (v MessageActionGameScore, 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 MessageActionGameScore
	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 *MessageActionGameScoreArray) Pop() (v MessageActionGameScore, 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
}

// MessageActionPaymentSentMeArray is adapter for slice of MessageActionPaymentSentMe.
type MessageActionPaymentSentMeArray []MessageActionPaymentSentMe

// Sort sorts slice of MessageActionPaymentSentMe.
func (s MessageActionPaymentSentMeArray) Sort(less func(a, b MessageActionPaymentSentMe) bool) MessageActionPaymentSentMeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPaymentSentMe.
func (s MessageActionPaymentSentMeArray) SortStable(less func(a, b MessageActionPaymentSentMe) bool) MessageActionPaymentSentMeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPaymentSentMe.
func (s MessageActionPaymentSentMeArray) Retain(keep func(x MessageActionPaymentSentMe) bool) MessageActionPaymentSentMeArray {
	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 MessageActionPaymentSentMeArray) First() (v MessageActionPaymentSentMe, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPaymentSentMeArray) Last() (v MessageActionPaymentSentMe, 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 *MessageActionPaymentSentMeArray) PopFirst() (v MessageActionPaymentSentMe, 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 MessageActionPaymentSentMe
	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 *MessageActionPaymentSentMeArray) Pop() (v MessageActionPaymentSentMe, 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
}

// MessageActionPaymentSentArray is adapter for slice of MessageActionPaymentSent.
type MessageActionPaymentSentArray []MessageActionPaymentSent

// Sort sorts slice of MessageActionPaymentSent.
func (s MessageActionPaymentSentArray) Sort(less func(a, b MessageActionPaymentSent) bool) MessageActionPaymentSentArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPaymentSent.
func (s MessageActionPaymentSentArray) SortStable(less func(a, b MessageActionPaymentSent) bool) MessageActionPaymentSentArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPaymentSent.
func (s MessageActionPaymentSentArray) Retain(keep func(x MessageActionPaymentSent) bool) MessageActionPaymentSentArray {
	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 MessageActionPaymentSentArray) First() (v MessageActionPaymentSent, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPaymentSentArray) Last() (v MessageActionPaymentSent, 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 *MessageActionPaymentSentArray) PopFirst() (v MessageActionPaymentSent, 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 MessageActionPaymentSent
	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 *MessageActionPaymentSentArray) Pop() (v MessageActionPaymentSent, 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
}

// MessageActionPhoneCallArray is adapter for slice of MessageActionPhoneCall.
type MessageActionPhoneCallArray []MessageActionPhoneCall

// Sort sorts slice of MessageActionPhoneCall.
func (s MessageActionPhoneCallArray) Sort(less func(a, b MessageActionPhoneCall) bool) MessageActionPhoneCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPhoneCall.
func (s MessageActionPhoneCallArray) SortStable(less func(a, b MessageActionPhoneCall) bool) MessageActionPhoneCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPhoneCall.
func (s MessageActionPhoneCallArray) Retain(keep func(x MessageActionPhoneCall) bool) MessageActionPhoneCallArray {
	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 MessageActionPhoneCallArray) First() (v MessageActionPhoneCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPhoneCallArray) Last() (v MessageActionPhoneCall, 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 *MessageActionPhoneCallArray) PopFirst() (v MessageActionPhoneCall, 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 MessageActionPhoneCall
	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 *MessageActionPhoneCallArray) Pop() (v MessageActionPhoneCall, 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
}

// MessageActionCustomActionArray is adapter for slice of MessageActionCustomAction.
type MessageActionCustomActionArray []MessageActionCustomAction

// Sort sorts slice of MessageActionCustomAction.
func (s MessageActionCustomActionArray) Sort(less func(a, b MessageActionCustomAction) bool) MessageActionCustomActionArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionCustomAction.
func (s MessageActionCustomActionArray) SortStable(less func(a, b MessageActionCustomAction) bool) MessageActionCustomActionArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionCustomAction.
func (s MessageActionCustomActionArray) Retain(keep func(x MessageActionCustomAction) bool) MessageActionCustomActionArray {
	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 MessageActionCustomActionArray) First() (v MessageActionCustomAction, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionCustomActionArray) Last() (v MessageActionCustomAction, 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 *MessageActionCustomActionArray) PopFirst() (v MessageActionCustomAction, 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 MessageActionCustomAction
	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 *MessageActionCustomActionArray) Pop() (v MessageActionCustomAction, 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
}

// MessageActionBotAllowedArray is adapter for slice of MessageActionBotAllowed.
type MessageActionBotAllowedArray []MessageActionBotAllowed

// Sort sorts slice of MessageActionBotAllowed.
func (s MessageActionBotAllowedArray) Sort(less func(a, b MessageActionBotAllowed) bool) MessageActionBotAllowedArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionBotAllowed.
func (s MessageActionBotAllowedArray) SortStable(less func(a, b MessageActionBotAllowed) bool) MessageActionBotAllowedArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionBotAllowed.
func (s MessageActionBotAllowedArray) Retain(keep func(x MessageActionBotAllowed) bool) MessageActionBotAllowedArray {
	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 MessageActionBotAllowedArray) First() (v MessageActionBotAllowed, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionBotAllowedArray) Last() (v MessageActionBotAllowed, 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 *MessageActionBotAllowedArray) PopFirst() (v MessageActionBotAllowed, 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 MessageActionBotAllowed
	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 *MessageActionBotAllowedArray) Pop() (v MessageActionBotAllowed, 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
}

// MessageActionSecureValuesSentMeArray is adapter for slice of MessageActionSecureValuesSentMe.
type MessageActionSecureValuesSentMeArray []MessageActionSecureValuesSentMe

// Sort sorts slice of MessageActionSecureValuesSentMe.
func (s MessageActionSecureValuesSentMeArray) Sort(less func(a, b MessageActionSecureValuesSentMe) bool) MessageActionSecureValuesSentMeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSecureValuesSentMe.
func (s MessageActionSecureValuesSentMeArray) SortStable(less func(a, b MessageActionSecureValuesSentMe) bool) MessageActionSecureValuesSentMeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSecureValuesSentMe.
func (s MessageActionSecureValuesSentMeArray) Retain(keep func(x MessageActionSecureValuesSentMe) bool) MessageActionSecureValuesSentMeArray {
	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 MessageActionSecureValuesSentMeArray) First() (v MessageActionSecureValuesSentMe, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSecureValuesSentMeArray) Last() (v MessageActionSecureValuesSentMe, 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 *MessageActionSecureValuesSentMeArray) PopFirst() (v MessageActionSecureValuesSentMe, 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 MessageActionSecureValuesSentMe
	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 *MessageActionSecureValuesSentMeArray) Pop() (v MessageActionSecureValuesSentMe, 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
}

// MessageActionSecureValuesSentArray is adapter for slice of MessageActionSecureValuesSent.
type MessageActionSecureValuesSentArray []MessageActionSecureValuesSent

// Sort sorts slice of MessageActionSecureValuesSent.
func (s MessageActionSecureValuesSentArray) Sort(less func(a, b MessageActionSecureValuesSent) bool) MessageActionSecureValuesSentArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSecureValuesSent.
func (s MessageActionSecureValuesSentArray) SortStable(less func(a, b MessageActionSecureValuesSent) bool) MessageActionSecureValuesSentArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSecureValuesSent.
func (s MessageActionSecureValuesSentArray) Retain(keep func(x MessageActionSecureValuesSent) bool) MessageActionSecureValuesSentArray {
	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 MessageActionSecureValuesSentArray) First() (v MessageActionSecureValuesSent, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSecureValuesSentArray) Last() (v MessageActionSecureValuesSent, 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 *MessageActionSecureValuesSentArray) PopFirst() (v MessageActionSecureValuesSent, 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 MessageActionSecureValuesSent
	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 *MessageActionSecureValuesSentArray) Pop() (v MessageActionSecureValuesSent, 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
}

// MessageActionGeoProximityReachedArray is adapter for slice of MessageActionGeoProximityReached.
type MessageActionGeoProximityReachedArray []MessageActionGeoProximityReached

// Sort sorts slice of MessageActionGeoProximityReached.
func (s MessageActionGeoProximityReachedArray) Sort(less func(a, b MessageActionGeoProximityReached) bool) MessageActionGeoProximityReachedArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGeoProximityReached.
func (s MessageActionGeoProximityReachedArray) SortStable(less func(a, b MessageActionGeoProximityReached) bool) MessageActionGeoProximityReachedArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGeoProximityReached.
func (s MessageActionGeoProximityReachedArray) Retain(keep func(x MessageActionGeoProximityReached) bool) MessageActionGeoProximityReachedArray {
	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 MessageActionGeoProximityReachedArray) First() (v MessageActionGeoProximityReached, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGeoProximityReachedArray) Last() (v MessageActionGeoProximityReached, 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 *MessageActionGeoProximityReachedArray) PopFirst() (v MessageActionGeoProximityReached, 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 MessageActionGeoProximityReached
	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 *MessageActionGeoProximityReachedArray) Pop() (v MessageActionGeoProximityReached, 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
}

// MessageActionGroupCallArray is adapter for slice of MessageActionGroupCall.
type MessageActionGroupCallArray []MessageActionGroupCall

// Sort sorts slice of MessageActionGroupCall.
func (s MessageActionGroupCallArray) Sort(less func(a, b MessageActionGroupCall) bool) MessageActionGroupCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGroupCall.
func (s MessageActionGroupCallArray) SortStable(less func(a, b MessageActionGroupCall) bool) MessageActionGroupCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGroupCall.
func (s MessageActionGroupCallArray) Retain(keep func(x MessageActionGroupCall) bool) MessageActionGroupCallArray {
	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 MessageActionGroupCallArray) First() (v MessageActionGroupCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGroupCallArray) Last() (v MessageActionGroupCall, 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 *MessageActionGroupCallArray) PopFirst() (v MessageActionGroupCall, 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 MessageActionGroupCall
	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 *MessageActionGroupCallArray) Pop() (v MessageActionGroupCall, 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
}

// MessageActionInviteToGroupCallArray is adapter for slice of MessageActionInviteToGroupCall.
type MessageActionInviteToGroupCallArray []MessageActionInviteToGroupCall

// Sort sorts slice of MessageActionInviteToGroupCall.
func (s MessageActionInviteToGroupCallArray) Sort(less func(a, b MessageActionInviteToGroupCall) bool) MessageActionInviteToGroupCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionInviteToGroupCall.
func (s MessageActionInviteToGroupCallArray) SortStable(less func(a, b MessageActionInviteToGroupCall) bool) MessageActionInviteToGroupCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionInviteToGroupCall.
func (s MessageActionInviteToGroupCallArray) Retain(keep func(x MessageActionInviteToGroupCall) bool) MessageActionInviteToGroupCallArray {
	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 MessageActionInviteToGroupCallArray) First() (v MessageActionInviteToGroupCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionInviteToGroupCallArray) Last() (v MessageActionInviteToGroupCall, 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 *MessageActionInviteToGroupCallArray) PopFirst() (v MessageActionInviteToGroupCall, 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 MessageActionInviteToGroupCall
	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 *MessageActionInviteToGroupCallArray) Pop() (v MessageActionInviteToGroupCall, 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
}

// MessageActionSetMessagesTTLArray is adapter for slice of MessageActionSetMessagesTTL.
type MessageActionSetMessagesTTLArray []MessageActionSetMessagesTTL

// Sort sorts slice of MessageActionSetMessagesTTL.
func (s MessageActionSetMessagesTTLArray) Sort(less func(a, b MessageActionSetMessagesTTL) bool) MessageActionSetMessagesTTLArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSetMessagesTTL.
func (s MessageActionSetMessagesTTLArray) SortStable(less func(a, b MessageActionSetMessagesTTL) bool) MessageActionSetMessagesTTLArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSetMessagesTTL.
func (s MessageActionSetMessagesTTLArray) Retain(keep func(x MessageActionSetMessagesTTL) bool) MessageActionSetMessagesTTLArray {
	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 MessageActionSetMessagesTTLArray) First() (v MessageActionSetMessagesTTL, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSetMessagesTTLArray) Last() (v MessageActionSetMessagesTTL, 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 *MessageActionSetMessagesTTLArray) PopFirst() (v MessageActionSetMessagesTTL, 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 MessageActionSetMessagesTTL
	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 *MessageActionSetMessagesTTLArray) Pop() (v MessageActionSetMessagesTTL, 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
}

// MessageActionGroupCallScheduledArray is adapter for slice of MessageActionGroupCallScheduled.
type MessageActionGroupCallScheduledArray []MessageActionGroupCallScheduled

// Sort sorts slice of MessageActionGroupCallScheduled.
func (s MessageActionGroupCallScheduledArray) Sort(less func(a, b MessageActionGroupCallScheduled) bool) MessageActionGroupCallScheduledArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGroupCallScheduled.
func (s MessageActionGroupCallScheduledArray) SortStable(less func(a, b MessageActionGroupCallScheduled) bool) MessageActionGroupCallScheduledArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGroupCallScheduled.
func (s MessageActionGroupCallScheduledArray) Retain(keep func(x MessageActionGroupCallScheduled) bool) MessageActionGroupCallScheduledArray {
	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 MessageActionGroupCallScheduledArray) First() (v MessageActionGroupCallScheduled, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGroupCallScheduledArray) Last() (v MessageActionGroupCallScheduled, 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 *MessageActionGroupCallScheduledArray) PopFirst() (v MessageActionGroupCallScheduled, 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 MessageActionGroupCallScheduled
	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 *MessageActionGroupCallScheduledArray) Pop() (v MessageActionGroupCallScheduled, 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
}

// MessageActionSetChatThemeArray is adapter for slice of MessageActionSetChatTheme.
type MessageActionSetChatThemeArray []MessageActionSetChatTheme

// Sort sorts slice of MessageActionSetChatTheme.
func (s MessageActionSetChatThemeArray) Sort(less func(a, b MessageActionSetChatTheme) bool) MessageActionSetChatThemeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSetChatTheme.
func (s MessageActionSetChatThemeArray) SortStable(less func(a, b MessageActionSetChatTheme) bool) MessageActionSetChatThemeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSetChatTheme.
func (s MessageActionSetChatThemeArray) Retain(keep func(x MessageActionSetChatTheme) bool) MessageActionSetChatThemeArray {
	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 MessageActionSetChatThemeArray) First() (v MessageActionSetChatTheme, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSetChatThemeArray) Last() (v MessageActionSetChatTheme, 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 *MessageActionSetChatThemeArray) PopFirst() (v MessageActionSetChatTheme, 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 MessageActionSetChatTheme
	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 *MessageActionSetChatThemeArray) Pop() (v MessageActionSetChatTheme, 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
}

// MessageActionWebViewDataSentMeArray is adapter for slice of MessageActionWebViewDataSentMe.
type MessageActionWebViewDataSentMeArray []MessageActionWebViewDataSentMe

// Sort sorts slice of MessageActionWebViewDataSentMe.
func (s MessageActionWebViewDataSentMeArray) Sort(less func(a, b MessageActionWebViewDataSentMe) bool) MessageActionWebViewDataSentMeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionWebViewDataSentMe.
func (s MessageActionWebViewDataSentMeArray) SortStable(less func(a, b MessageActionWebViewDataSentMe) bool) MessageActionWebViewDataSentMeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionWebViewDataSentMe.
func (s MessageActionWebViewDataSentMeArray) Retain(keep func(x MessageActionWebViewDataSentMe) bool) MessageActionWebViewDataSentMeArray {
	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 MessageActionWebViewDataSentMeArray) First() (v MessageActionWebViewDataSentMe, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionWebViewDataSentMeArray) Last() (v MessageActionWebViewDataSentMe, 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 *MessageActionWebViewDataSentMeArray) PopFirst() (v MessageActionWebViewDataSentMe, 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 MessageActionWebViewDataSentMe
	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 *MessageActionWebViewDataSentMeArray) Pop() (v MessageActionWebViewDataSentMe, 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
}

// MessageActionWebViewDataSentArray is adapter for slice of MessageActionWebViewDataSent.
type MessageActionWebViewDataSentArray []MessageActionWebViewDataSent

// Sort sorts slice of MessageActionWebViewDataSent.
func (s MessageActionWebViewDataSentArray) Sort(less func(a, b MessageActionWebViewDataSent) bool) MessageActionWebViewDataSentArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionWebViewDataSent.
func (s MessageActionWebViewDataSentArray) SortStable(less func(a, b MessageActionWebViewDataSent) bool) MessageActionWebViewDataSentArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionWebViewDataSent.
func (s MessageActionWebViewDataSentArray) Retain(keep func(x MessageActionWebViewDataSent) bool) MessageActionWebViewDataSentArray {
	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 MessageActionWebViewDataSentArray) First() (v MessageActionWebViewDataSent, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionWebViewDataSentArray) Last() (v MessageActionWebViewDataSent, 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 *MessageActionWebViewDataSentArray) PopFirst() (v MessageActionWebViewDataSent, 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 MessageActionWebViewDataSent
	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 *MessageActionWebViewDataSentArray) Pop() (v MessageActionWebViewDataSent, 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
}

// MessageActionGiftPremiumArray is adapter for slice of MessageActionGiftPremium.
type MessageActionGiftPremiumArray []MessageActionGiftPremium

// Sort sorts slice of MessageActionGiftPremium.
func (s MessageActionGiftPremiumArray) Sort(less func(a, b MessageActionGiftPremium) bool) MessageActionGiftPremiumArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiftPremium.
func (s MessageActionGiftPremiumArray) SortStable(less func(a, b MessageActionGiftPremium) bool) MessageActionGiftPremiumArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiftPremium.
func (s MessageActionGiftPremiumArray) Retain(keep func(x MessageActionGiftPremium) bool) MessageActionGiftPremiumArray {
	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 MessageActionGiftPremiumArray) First() (v MessageActionGiftPremium, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiftPremiumArray) Last() (v MessageActionGiftPremium, 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 *MessageActionGiftPremiumArray) PopFirst() (v MessageActionGiftPremium, 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 MessageActionGiftPremium
	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 *MessageActionGiftPremiumArray) Pop() (v MessageActionGiftPremium, 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
}

// MessageActionTopicCreateArray is adapter for slice of MessageActionTopicCreate.
type MessageActionTopicCreateArray []MessageActionTopicCreate

// Sort sorts slice of MessageActionTopicCreate.
func (s MessageActionTopicCreateArray) Sort(less func(a, b MessageActionTopicCreate) bool) MessageActionTopicCreateArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionTopicCreate.
func (s MessageActionTopicCreateArray) SortStable(less func(a, b MessageActionTopicCreate) bool) MessageActionTopicCreateArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionTopicCreate.
func (s MessageActionTopicCreateArray) Retain(keep func(x MessageActionTopicCreate) bool) MessageActionTopicCreateArray {
	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 MessageActionTopicCreateArray) First() (v MessageActionTopicCreate, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionTopicCreateArray) Last() (v MessageActionTopicCreate, 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 *MessageActionTopicCreateArray) PopFirst() (v MessageActionTopicCreate, 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 MessageActionTopicCreate
	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 *MessageActionTopicCreateArray) Pop() (v MessageActionTopicCreate, 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
}

// MessageActionTopicEditArray is adapter for slice of MessageActionTopicEdit.
type MessageActionTopicEditArray []MessageActionTopicEdit

// Sort sorts slice of MessageActionTopicEdit.
func (s MessageActionTopicEditArray) Sort(less func(a, b MessageActionTopicEdit) bool) MessageActionTopicEditArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionTopicEdit.
func (s MessageActionTopicEditArray) SortStable(less func(a, b MessageActionTopicEdit) bool) MessageActionTopicEditArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionTopicEdit.
func (s MessageActionTopicEditArray) Retain(keep func(x MessageActionTopicEdit) bool) MessageActionTopicEditArray {
	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 MessageActionTopicEditArray) First() (v MessageActionTopicEdit, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionTopicEditArray) Last() (v MessageActionTopicEdit, 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 *MessageActionTopicEditArray) PopFirst() (v MessageActionTopicEdit, 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 MessageActionTopicEdit
	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 *MessageActionTopicEditArray) Pop() (v MessageActionTopicEdit, 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
}

// MessageActionSuggestProfilePhotoArray is adapter for slice of MessageActionSuggestProfilePhoto.
type MessageActionSuggestProfilePhotoArray []MessageActionSuggestProfilePhoto

// Sort sorts slice of MessageActionSuggestProfilePhoto.
func (s MessageActionSuggestProfilePhotoArray) Sort(less func(a, b MessageActionSuggestProfilePhoto) bool) MessageActionSuggestProfilePhotoArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSuggestProfilePhoto.
func (s MessageActionSuggestProfilePhotoArray) SortStable(less func(a, b MessageActionSuggestProfilePhoto) bool) MessageActionSuggestProfilePhotoArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSuggestProfilePhoto.
func (s MessageActionSuggestProfilePhotoArray) Retain(keep func(x MessageActionSuggestProfilePhoto) bool) MessageActionSuggestProfilePhotoArray {
	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 MessageActionSuggestProfilePhotoArray) First() (v MessageActionSuggestProfilePhoto, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSuggestProfilePhotoArray) Last() (v MessageActionSuggestProfilePhoto, 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 *MessageActionSuggestProfilePhotoArray) PopFirst() (v MessageActionSuggestProfilePhoto, 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 MessageActionSuggestProfilePhoto
	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 *MessageActionSuggestProfilePhotoArray) Pop() (v MessageActionSuggestProfilePhoto, 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
}

// MessageActionRequestedPeerArray is adapter for slice of MessageActionRequestedPeer.
type MessageActionRequestedPeerArray []MessageActionRequestedPeer

// Sort sorts slice of MessageActionRequestedPeer.
func (s MessageActionRequestedPeerArray) Sort(less func(a, b MessageActionRequestedPeer) bool) MessageActionRequestedPeerArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionRequestedPeer.
func (s MessageActionRequestedPeerArray) SortStable(less func(a, b MessageActionRequestedPeer) bool) MessageActionRequestedPeerArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionRequestedPeer.
func (s MessageActionRequestedPeerArray) Retain(keep func(x MessageActionRequestedPeer) bool) MessageActionRequestedPeerArray {
	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 MessageActionRequestedPeerArray) First() (v MessageActionRequestedPeer, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionRequestedPeerArray) Last() (v MessageActionRequestedPeer, 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 *MessageActionRequestedPeerArray) PopFirst() (v MessageActionRequestedPeer, 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 MessageActionRequestedPeer
	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 *MessageActionRequestedPeerArray) Pop() (v MessageActionRequestedPeer, 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
}

// MessageActionSetChatWallPaperArray is adapter for slice of MessageActionSetChatWallPaper.
type MessageActionSetChatWallPaperArray []MessageActionSetChatWallPaper

// Sort sorts slice of MessageActionSetChatWallPaper.
func (s MessageActionSetChatWallPaperArray) Sort(less func(a, b MessageActionSetChatWallPaper) bool) MessageActionSetChatWallPaperArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSetChatWallPaper.
func (s MessageActionSetChatWallPaperArray) SortStable(less func(a, b MessageActionSetChatWallPaper) bool) MessageActionSetChatWallPaperArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSetChatWallPaper.
func (s MessageActionSetChatWallPaperArray) Retain(keep func(x MessageActionSetChatWallPaper) bool) MessageActionSetChatWallPaperArray {
	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 MessageActionSetChatWallPaperArray) First() (v MessageActionSetChatWallPaper, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSetChatWallPaperArray) Last() (v MessageActionSetChatWallPaper, 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 *MessageActionSetChatWallPaperArray) PopFirst() (v MessageActionSetChatWallPaper, 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 MessageActionSetChatWallPaper
	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 *MessageActionSetChatWallPaperArray) Pop() (v MessageActionSetChatWallPaper, 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
}

// MessageActionGiftCodeArray is adapter for slice of MessageActionGiftCode.
type MessageActionGiftCodeArray []MessageActionGiftCode

// Sort sorts slice of MessageActionGiftCode.
func (s MessageActionGiftCodeArray) Sort(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiftCode.
func (s MessageActionGiftCodeArray) SortStable(less func(a, b MessageActionGiftCode) bool) MessageActionGiftCodeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiftCode.
func (s MessageActionGiftCodeArray) Retain(keep func(x MessageActionGiftCode) bool) MessageActionGiftCodeArray {
	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 MessageActionGiftCodeArray) First() (v MessageActionGiftCode, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiftCodeArray) Last() (v MessageActionGiftCode, 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 *MessageActionGiftCodeArray) PopFirst() (v MessageActionGiftCode, 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 MessageActionGiftCode
	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 *MessageActionGiftCodeArray) Pop() (v MessageActionGiftCode, 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
}

// MessageActionGiveawayLaunchArray is adapter for slice of MessageActionGiveawayLaunch.
type MessageActionGiveawayLaunchArray []MessageActionGiveawayLaunch

// Sort sorts slice of MessageActionGiveawayLaunch.
func (s MessageActionGiveawayLaunchArray) Sort(less func(a, b MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiveawayLaunch.
func (s MessageActionGiveawayLaunchArray) SortStable(less func(a, b MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiveawayLaunch.
func (s MessageActionGiveawayLaunchArray) Retain(keep func(x MessageActionGiveawayLaunch) bool) MessageActionGiveawayLaunchArray {
	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 MessageActionGiveawayLaunchArray) First() (v MessageActionGiveawayLaunch, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiveawayLaunchArray) Last() (v MessageActionGiveawayLaunch, 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 *MessageActionGiveawayLaunchArray) PopFirst() (v MessageActionGiveawayLaunch, 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 MessageActionGiveawayLaunch
	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 *MessageActionGiveawayLaunchArray) Pop() (v MessageActionGiveawayLaunch, 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
}

// MessageActionGiveawayResultsArray is adapter for slice of MessageActionGiveawayResults.
type MessageActionGiveawayResultsArray []MessageActionGiveawayResults

// Sort sorts slice of MessageActionGiveawayResults.
func (s MessageActionGiveawayResultsArray) Sort(less func(a, b MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiveawayResults.
func (s MessageActionGiveawayResultsArray) SortStable(less func(a, b MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiveawayResults.
func (s MessageActionGiveawayResultsArray) Retain(keep func(x MessageActionGiveawayResults) bool) MessageActionGiveawayResultsArray {
	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 MessageActionGiveawayResultsArray) First() (v MessageActionGiveawayResults, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiveawayResultsArray) Last() (v MessageActionGiveawayResults, 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 *MessageActionGiveawayResultsArray) PopFirst() (v MessageActionGiveawayResults, 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 MessageActionGiveawayResults
	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 *MessageActionGiveawayResultsArray) Pop() (v MessageActionGiveawayResults, 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
}

// MessageActionBoostApplyArray is adapter for slice of MessageActionBoostApply.
type MessageActionBoostApplyArray []MessageActionBoostApply

// Sort sorts slice of MessageActionBoostApply.
func (s MessageActionBoostApplyArray) Sort(less func(a, b MessageActionBoostApply) bool) MessageActionBoostApplyArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionBoostApply.
func (s MessageActionBoostApplyArray) SortStable(less func(a, b MessageActionBoostApply) bool) MessageActionBoostApplyArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionBoostApply.
func (s MessageActionBoostApplyArray) Retain(keep func(x MessageActionBoostApply) bool) MessageActionBoostApplyArray {
	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 MessageActionBoostApplyArray) First() (v MessageActionBoostApply, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionBoostApplyArray) Last() (v MessageActionBoostApply, 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 *MessageActionBoostApplyArray) PopFirst() (v MessageActionBoostApply, 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 MessageActionBoostApply
	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 *MessageActionBoostApplyArray) Pop() (v MessageActionBoostApply, 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
}

// MessageActionRequestedPeerSentMeArray is adapter for slice of MessageActionRequestedPeerSentMe.
type MessageActionRequestedPeerSentMeArray []MessageActionRequestedPeerSentMe

// Sort sorts slice of MessageActionRequestedPeerSentMe.
func (s MessageActionRequestedPeerSentMeArray) Sort(less func(a, b MessageActionRequestedPeerSentMe) bool) MessageActionRequestedPeerSentMeArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionRequestedPeerSentMe.
func (s MessageActionRequestedPeerSentMeArray) SortStable(less func(a, b MessageActionRequestedPeerSentMe) bool) MessageActionRequestedPeerSentMeArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionRequestedPeerSentMe.
func (s MessageActionRequestedPeerSentMeArray) Retain(keep func(x MessageActionRequestedPeerSentMe) bool) MessageActionRequestedPeerSentMeArray {
	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 MessageActionRequestedPeerSentMeArray) First() (v MessageActionRequestedPeerSentMe, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionRequestedPeerSentMeArray) Last() (v MessageActionRequestedPeerSentMe, 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 *MessageActionRequestedPeerSentMeArray) PopFirst() (v MessageActionRequestedPeerSentMe, 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 MessageActionRequestedPeerSentMe
	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 *MessageActionRequestedPeerSentMeArray) Pop() (v MessageActionRequestedPeerSentMe, 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
}

// MessageActionPaymentRefundedArray is adapter for slice of MessageActionPaymentRefunded.
type MessageActionPaymentRefundedArray []MessageActionPaymentRefunded

// Sort sorts slice of MessageActionPaymentRefunded.
func (s MessageActionPaymentRefundedArray) Sort(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPaymentRefunded.
func (s MessageActionPaymentRefundedArray) SortStable(less func(a, b MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPaymentRefunded.
func (s MessageActionPaymentRefundedArray) Retain(keep func(x MessageActionPaymentRefunded) bool) MessageActionPaymentRefundedArray {
	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 MessageActionPaymentRefundedArray) First() (v MessageActionPaymentRefunded, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPaymentRefundedArray) Last() (v MessageActionPaymentRefunded, 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 *MessageActionPaymentRefundedArray) PopFirst() (v MessageActionPaymentRefunded, 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 MessageActionPaymentRefunded
	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 *MessageActionPaymentRefundedArray) Pop() (v MessageActionPaymentRefunded, 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
}

// MessageActionGiftStarsArray is adapter for slice of MessageActionGiftStars.
type MessageActionGiftStarsArray []MessageActionGiftStars

// Sort sorts slice of MessageActionGiftStars.
func (s MessageActionGiftStarsArray) Sort(less func(a, b MessageActionGiftStars) bool) MessageActionGiftStarsArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiftStars.
func (s MessageActionGiftStarsArray) SortStable(less func(a, b MessageActionGiftStars) bool) MessageActionGiftStarsArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiftStars.
func (s MessageActionGiftStarsArray) Retain(keep func(x MessageActionGiftStars) bool) MessageActionGiftStarsArray {
	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 MessageActionGiftStarsArray) First() (v MessageActionGiftStars, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiftStarsArray) Last() (v MessageActionGiftStars, 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 *MessageActionGiftStarsArray) PopFirst() (v MessageActionGiftStars, 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 MessageActionGiftStars
	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 *MessageActionGiftStarsArray) Pop() (v MessageActionGiftStars, 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
}

// MessageActionPrizeStarsArray is adapter for slice of MessageActionPrizeStars.
type MessageActionPrizeStarsArray []MessageActionPrizeStars

// Sort sorts slice of MessageActionPrizeStars.
func (s MessageActionPrizeStarsArray) Sort(less func(a, b MessageActionPrizeStars) bool) MessageActionPrizeStarsArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPrizeStars.
func (s MessageActionPrizeStarsArray) SortStable(less func(a, b MessageActionPrizeStars) bool) MessageActionPrizeStarsArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPrizeStars.
func (s MessageActionPrizeStarsArray) Retain(keep func(x MessageActionPrizeStars) bool) MessageActionPrizeStarsArray {
	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 MessageActionPrizeStarsArray) First() (v MessageActionPrizeStars, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPrizeStarsArray) Last() (v MessageActionPrizeStars, 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 *MessageActionPrizeStarsArray) PopFirst() (v MessageActionPrizeStars, 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 MessageActionPrizeStars
	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 *MessageActionPrizeStarsArray) Pop() (v MessageActionPrizeStars, 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
}

// MessageActionStarGiftArray is adapter for slice of MessageActionStarGift.
type MessageActionStarGiftArray []MessageActionStarGift

// Sort sorts slice of MessageActionStarGift.
func (s MessageActionStarGiftArray) Sort(less func(a, b MessageActionStarGift) bool) MessageActionStarGiftArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionStarGift.
func (s MessageActionStarGiftArray) SortStable(less func(a, b MessageActionStarGift) bool) MessageActionStarGiftArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionStarGift.
func (s MessageActionStarGiftArray) Retain(keep func(x MessageActionStarGift) bool) MessageActionStarGiftArray {
	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 MessageActionStarGiftArray) First() (v MessageActionStarGift, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionStarGiftArray) Last() (v MessageActionStarGift, 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 *MessageActionStarGiftArray) PopFirst() (v MessageActionStarGift, 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 MessageActionStarGift
	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 *MessageActionStarGiftArray) Pop() (v MessageActionStarGift, 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
}

// MessageActionStarGiftUniqueArray is adapter for slice of MessageActionStarGiftUnique.
type MessageActionStarGiftUniqueArray []MessageActionStarGiftUnique

// Sort sorts slice of MessageActionStarGiftUnique.
func (s MessageActionStarGiftUniqueArray) Sort(less func(a, b MessageActionStarGiftUnique) bool) MessageActionStarGiftUniqueArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionStarGiftUnique.
func (s MessageActionStarGiftUniqueArray) SortStable(less func(a, b MessageActionStarGiftUnique) bool) MessageActionStarGiftUniqueArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionStarGiftUnique.
func (s MessageActionStarGiftUniqueArray) Retain(keep func(x MessageActionStarGiftUnique) bool) MessageActionStarGiftUniqueArray {
	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 MessageActionStarGiftUniqueArray) First() (v MessageActionStarGiftUnique, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionStarGiftUniqueArray) Last() (v MessageActionStarGiftUnique, 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 *MessageActionStarGiftUniqueArray) PopFirst() (v MessageActionStarGiftUnique, 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 MessageActionStarGiftUnique
	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 *MessageActionStarGiftUniqueArray) Pop() (v MessageActionStarGiftUnique, 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
}

// MessageActionPaidMessagesRefundedArray is adapter for slice of MessageActionPaidMessagesRefunded.
type MessageActionPaidMessagesRefundedArray []MessageActionPaidMessagesRefunded

// Sort sorts slice of MessageActionPaidMessagesRefunded.
func (s MessageActionPaidMessagesRefundedArray) Sort(less func(a, b MessageActionPaidMessagesRefunded) bool) MessageActionPaidMessagesRefundedArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPaidMessagesRefunded.
func (s MessageActionPaidMessagesRefundedArray) SortStable(less func(a, b MessageActionPaidMessagesRefunded) bool) MessageActionPaidMessagesRefundedArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPaidMessagesRefunded.
func (s MessageActionPaidMessagesRefundedArray) Retain(keep func(x MessageActionPaidMessagesRefunded) bool) MessageActionPaidMessagesRefundedArray {
	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 MessageActionPaidMessagesRefundedArray) First() (v MessageActionPaidMessagesRefunded, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPaidMessagesRefundedArray) Last() (v MessageActionPaidMessagesRefunded, 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 *MessageActionPaidMessagesRefundedArray) PopFirst() (v MessageActionPaidMessagesRefunded, 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 MessageActionPaidMessagesRefunded
	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 *MessageActionPaidMessagesRefundedArray) Pop() (v MessageActionPaidMessagesRefunded, 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
}

// MessageActionPaidMessagesPriceArray is adapter for slice of MessageActionPaidMessagesPrice.
type MessageActionPaidMessagesPriceArray []MessageActionPaidMessagesPrice

// Sort sorts slice of MessageActionPaidMessagesPrice.
func (s MessageActionPaidMessagesPriceArray) Sort(less func(a, b MessageActionPaidMessagesPrice) bool) MessageActionPaidMessagesPriceArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionPaidMessagesPrice.
func (s MessageActionPaidMessagesPriceArray) SortStable(less func(a, b MessageActionPaidMessagesPrice) bool) MessageActionPaidMessagesPriceArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionPaidMessagesPrice.
func (s MessageActionPaidMessagesPriceArray) Retain(keep func(x MessageActionPaidMessagesPrice) bool) MessageActionPaidMessagesPriceArray {
	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 MessageActionPaidMessagesPriceArray) First() (v MessageActionPaidMessagesPrice, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionPaidMessagesPriceArray) Last() (v MessageActionPaidMessagesPrice, 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 *MessageActionPaidMessagesPriceArray) PopFirst() (v MessageActionPaidMessagesPrice, 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 MessageActionPaidMessagesPrice
	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 *MessageActionPaidMessagesPriceArray) Pop() (v MessageActionPaidMessagesPrice, 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
}

// MessageActionConferenceCallArray is adapter for slice of MessageActionConferenceCall.
type MessageActionConferenceCallArray []MessageActionConferenceCall

// Sort sorts slice of MessageActionConferenceCall.
func (s MessageActionConferenceCallArray) Sort(less func(a, b MessageActionConferenceCall) bool) MessageActionConferenceCallArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionConferenceCall.
func (s MessageActionConferenceCallArray) SortStable(less func(a, b MessageActionConferenceCall) bool) MessageActionConferenceCallArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionConferenceCall.
func (s MessageActionConferenceCallArray) Retain(keep func(x MessageActionConferenceCall) bool) MessageActionConferenceCallArray {
	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 MessageActionConferenceCallArray) First() (v MessageActionConferenceCall, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionConferenceCallArray) Last() (v MessageActionConferenceCall, 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 *MessageActionConferenceCallArray) PopFirst() (v MessageActionConferenceCall, 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 MessageActionConferenceCall
	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 *MessageActionConferenceCallArray) Pop() (v MessageActionConferenceCall, 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
}

// MessageActionTodoCompletionsArray is adapter for slice of MessageActionTodoCompletions.
type MessageActionTodoCompletionsArray []MessageActionTodoCompletions

// Sort sorts slice of MessageActionTodoCompletions.
func (s MessageActionTodoCompletionsArray) Sort(less func(a, b MessageActionTodoCompletions) bool) MessageActionTodoCompletionsArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionTodoCompletions.
func (s MessageActionTodoCompletionsArray) SortStable(less func(a, b MessageActionTodoCompletions) bool) MessageActionTodoCompletionsArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionTodoCompletions.
func (s MessageActionTodoCompletionsArray) Retain(keep func(x MessageActionTodoCompletions) bool) MessageActionTodoCompletionsArray {
	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 MessageActionTodoCompletionsArray) First() (v MessageActionTodoCompletions, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionTodoCompletionsArray) Last() (v MessageActionTodoCompletions, 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 *MessageActionTodoCompletionsArray) PopFirst() (v MessageActionTodoCompletions, 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 MessageActionTodoCompletions
	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 *MessageActionTodoCompletionsArray) Pop() (v MessageActionTodoCompletions, 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
}

// MessageActionTodoAppendTasksArray is adapter for slice of MessageActionTodoAppendTasks.
type MessageActionTodoAppendTasksArray []MessageActionTodoAppendTasks

// Sort sorts slice of MessageActionTodoAppendTasks.
func (s MessageActionTodoAppendTasksArray) Sort(less func(a, b MessageActionTodoAppendTasks) bool) MessageActionTodoAppendTasksArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionTodoAppendTasks.
func (s MessageActionTodoAppendTasksArray) SortStable(less func(a, b MessageActionTodoAppendTasks) bool) MessageActionTodoAppendTasksArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionTodoAppendTasks.
func (s MessageActionTodoAppendTasksArray) Retain(keep func(x MessageActionTodoAppendTasks) bool) MessageActionTodoAppendTasksArray {
	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 MessageActionTodoAppendTasksArray) First() (v MessageActionTodoAppendTasks, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionTodoAppendTasksArray) Last() (v MessageActionTodoAppendTasks, 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 *MessageActionTodoAppendTasksArray) PopFirst() (v MessageActionTodoAppendTasks, 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 MessageActionTodoAppendTasks
	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 *MessageActionTodoAppendTasksArray) Pop() (v MessageActionTodoAppendTasks, 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
}

// MessageActionSuggestedPostApprovalArray is adapter for slice of MessageActionSuggestedPostApproval.
type MessageActionSuggestedPostApprovalArray []MessageActionSuggestedPostApproval

// Sort sorts slice of MessageActionSuggestedPostApproval.
func (s MessageActionSuggestedPostApprovalArray) Sort(less func(a, b MessageActionSuggestedPostApproval) bool) MessageActionSuggestedPostApprovalArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSuggestedPostApproval.
func (s MessageActionSuggestedPostApprovalArray) SortStable(less func(a, b MessageActionSuggestedPostApproval) bool) MessageActionSuggestedPostApprovalArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSuggestedPostApproval.
func (s MessageActionSuggestedPostApprovalArray) Retain(keep func(x MessageActionSuggestedPostApproval) bool) MessageActionSuggestedPostApprovalArray {
	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 MessageActionSuggestedPostApprovalArray) First() (v MessageActionSuggestedPostApproval, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSuggestedPostApprovalArray) Last() (v MessageActionSuggestedPostApproval, 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 *MessageActionSuggestedPostApprovalArray) PopFirst() (v MessageActionSuggestedPostApproval, 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 MessageActionSuggestedPostApproval
	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 *MessageActionSuggestedPostApprovalArray) Pop() (v MessageActionSuggestedPostApproval, 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
}

// MessageActionSuggestedPostSuccessArray is adapter for slice of MessageActionSuggestedPostSuccess.
type MessageActionSuggestedPostSuccessArray []MessageActionSuggestedPostSuccess

// Sort sorts slice of MessageActionSuggestedPostSuccess.
func (s MessageActionSuggestedPostSuccessArray) Sort(less func(a, b MessageActionSuggestedPostSuccess) bool) MessageActionSuggestedPostSuccessArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSuggestedPostSuccess.
func (s MessageActionSuggestedPostSuccessArray) SortStable(less func(a, b MessageActionSuggestedPostSuccess) bool) MessageActionSuggestedPostSuccessArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSuggestedPostSuccess.
func (s MessageActionSuggestedPostSuccessArray) Retain(keep func(x MessageActionSuggestedPostSuccess) bool) MessageActionSuggestedPostSuccessArray {
	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 MessageActionSuggestedPostSuccessArray) First() (v MessageActionSuggestedPostSuccess, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSuggestedPostSuccessArray) Last() (v MessageActionSuggestedPostSuccess, 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 *MessageActionSuggestedPostSuccessArray) PopFirst() (v MessageActionSuggestedPostSuccess, 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 MessageActionSuggestedPostSuccess
	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 *MessageActionSuggestedPostSuccessArray) Pop() (v MessageActionSuggestedPostSuccess, 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
}

// MessageActionSuggestedPostRefundArray is adapter for slice of MessageActionSuggestedPostRefund.
type MessageActionSuggestedPostRefundArray []MessageActionSuggestedPostRefund

// Sort sorts slice of MessageActionSuggestedPostRefund.
func (s MessageActionSuggestedPostRefundArray) Sort(less func(a, b MessageActionSuggestedPostRefund) bool) MessageActionSuggestedPostRefundArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSuggestedPostRefund.
func (s MessageActionSuggestedPostRefundArray) SortStable(less func(a, b MessageActionSuggestedPostRefund) bool) MessageActionSuggestedPostRefundArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSuggestedPostRefund.
func (s MessageActionSuggestedPostRefundArray) Retain(keep func(x MessageActionSuggestedPostRefund) bool) MessageActionSuggestedPostRefundArray {
	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 MessageActionSuggestedPostRefundArray) First() (v MessageActionSuggestedPostRefund, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSuggestedPostRefundArray) Last() (v MessageActionSuggestedPostRefund, 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 *MessageActionSuggestedPostRefundArray) PopFirst() (v MessageActionSuggestedPostRefund, 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 MessageActionSuggestedPostRefund
	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 *MessageActionSuggestedPostRefundArray) Pop() (v MessageActionSuggestedPostRefund, 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
}

// MessageActionGiftTonArray is adapter for slice of MessageActionGiftTon.
type MessageActionGiftTonArray []MessageActionGiftTon

// Sort sorts slice of MessageActionGiftTon.
func (s MessageActionGiftTonArray) Sort(less func(a, b MessageActionGiftTon) bool) MessageActionGiftTonArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionGiftTon.
func (s MessageActionGiftTonArray) SortStable(less func(a, b MessageActionGiftTon) bool) MessageActionGiftTonArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionGiftTon.
func (s MessageActionGiftTonArray) Retain(keep func(x MessageActionGiftTon) bool) MessageActionGiftTonArray {
	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 MessageActionGiftTonArray) First() (v MessageActionGiftTon, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionGiftTonArray) Last() (v MessageActionGiftTon, 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 *MessageActionGiftTonArray) PopFirst() (v MessageActionGiftTon, 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 MessageActionGiftTon
	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 *MessageActionGiftTonArray) Pop() (v MessageActionGiftTon, 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
}

// MessageActionSuggestBirthdayArray is adapter for slice of MessageActionSuggestBirthday.
type MessageActionSuggestBirthdayArray []MessageActionSuggestBirthday

// Sort sorts slice of MessageActionSuggestBirthday.
func (s MessageActionSuggestBirthdayArray) Sort(less func(a, b MessageActionSuggestBirthday) bool) MessageActionSuggestBirthdayArray {
	sort.Slice(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// SortStable sorts slice of MessageActionSuggestBirthday.
func (s MessageActionSuggestBirthdayArray) SortStable(less func(a, b MessageActionSuggestBirthday) bool) MessageActionSuggestBirthdayArray {
	sort.SliceStable(s, func(i, j int) bool {
		return less(s[i], s[j])
	})
	return s
}

// Retain filters in-place slice of MessageActionSuggestBirthday.
func (s MessageActionSuggestBirthdayArray) Retain(keep func(x MessageActionSuggestBirthday) bool) MessageActionSuggestBirthdayArray {
	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 MessageActionSuggestBirthdayArray) First() (v MessageActionSuggestBirthday, ok bool) {
	if len(s) < 1 {
		return
	}
	return s[0], true
}

// Last returns last element of slice (if exists).
func (s MessageActionSuggestBirthdayArray) Last() (v MessageActionSuggestBirthday, 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 *MessageActionSuggestBirthdayArray) PopFirst() (v MessageActionSuggestBirthday, 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 MessageActionSuggestBirthday
	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 *MessageActionSuggestBirthdayArray) Pop() (v MessageActionSuggestBirthday, 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
}
