//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

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

// UpdatesClassArray is adapter for slice of UpdatesClass.
type UpdatesClassArray []UpdatesClass

// Sort sorts slice of UpdatesClass.
func ( UpdatesClassArray) ( func(,  UpdatesClass) bool) UpdatesClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdatesClass.
func ( UpdatesClassArray) ( func(,  UpdatesClass) bool) UpdatesClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdatesClass.
func ( UpdatesClassArray) ( func( UpdatesClass) bool) UpdatesClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdatesClassArray) () ( UpdatesClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdatesClassArray) () ( UpdatesClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdatesClassArray) () ( UpdatesClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdatesClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdatesClassArray) () ( UpdatesClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsUpdateShortMessage returns copy with only UpdateShortMessage constructors.
func ( UpdatesClassArray) () ( UpdateShortMessageArray) {
	for ,  := range  {
		,  := .(*UpdateShortMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsUpdateShortChatMessage returns copy with only UpdateShortChatMessage constructors.
func ( UpdatesClassArray) () ( UpdateShortChatMessageArray) {
	for ,  := range  {
		,  := .(*UpdateShortChatMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsUpdateShort returns copy with only UpdateShort constructors.
func ( UpdatesClassArray) () ( UpdateShortArray) {
	for ,  := range  {
		,  := .(*UpdateShort)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsUpdatesCombined returns copy with only UpdatesCombined constructors.
func ( UpdatesClassArray) () ( UpdatesCombinedArray) {
	for ,  := range  {
		,  := .(*UpdatesCombined)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsUpdates returns copy with only Updates constructors.
func ( UpdatesClassArray) () ( UpdatesArray) {
	for ,  := range  {
		,  := .(*Updates)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsUpdateShortSentMessage returns copy with only UpdateShortSentMessage constructors.
func ( UpdatesClassArray) () ( UpdateShortSentMessageArray) {
	for ,  := range  {
		,  := .(*UpdateShortSentMessage)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// UpdateShortMessageArray is adapter for slice of UpdateShortMessage.
type UpdateShortMessageArray []UpdateShortMessage

// Sort sorts slice of UpdateShortMessage.
func ( UpdateShortMessageArray) ( func(,  UpdateShortMessage) bool) UpdateShortMessageArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdateShortMessage.
func ( UpdateShortMessageArray) ( func(,  UpdateShortMessage) bool) UpdateShortMessageArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdateShortMessage.
func ( UpdateShortMessageArray) ( func( UpdateShortMessage) bool) UpdateShortMessageArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdateShortMessageArray) () ( UpdateShortMessage,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdateShortMessageArray) () ( UpdateShortMessage,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdateShortMessageArray) () ( UpdateShortMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdateShortMessage
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdateShortMessageArray) () ( UpdateShortMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of UpdateShortMessage by ID.
func ( UpdateShortMessageArray) () UpdateShortMessageArray {
	return .Sort(func(,  UpdateShortMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of UpdateShortMessage by ID.
func ( UpdateShortMessageArray) () UpdateShortMessageArray {
	return .SortStable(func(,  UpdateShortMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortByDate sorts slice of UpdateShortMessage by Date.
func ( UpdateShortMessageArray) () UpdateShortMessageArray {
	return .Sort(func(,  UpdateShortMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of UpdateShortMessage by Date.
func ( UpdateShortMessageArray) () UpdateShortMessageArray {
	return .SortStable(func(,  UpdateShortMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// FillMap fills constructors to given map.
func ( UpdateShortMessageArray) ( map[int]UpdateShortMessage) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( UpdateShortMessageArray) () map[int]UpdateShortMessage {
	 := make(map[int]UpdateShortMessage, len())
	.FillMap()
	return 
}

// UpdateShortChatMessageArray is adapter for slice of UpdateShortChatMessage.
type UpdateShortChatMessageArray []UpdateShortChatMessage

// Sort sorts slice of UpdateShortChatMessage.
func ( UpdateShortChatMessageArray) ( func(,  UpdateShortChatMessage) bool) UpdateShortChatMessageArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdateShortChatMessage.
func ( UpdateShortChatMessageArray) ( func(,  UpdateShortChatMessage) bool) UpdateShortChatMessageArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdateShortChatMessage.
func ( UpdateShortChatMessageArray) ( func( UpdateShortChatMessage) bool) UpdateShortChatMessageArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdateShortChatMessageArray) () ( UpdateShortChatMessage,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdateShortChatMessageArray) () ( UpdateShortChatMessage,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdateShortChatMessageArray) () ( UpdateShortChatMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdateShortChatMessage
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdateShortChatMessageArray) () ( UpdateShortChatMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of UpdateShortChatMessage by ID.
func ( UpdateShortChatMessageArray) () UpdateShortChatMessageArray {
	return .Sort(func(,  UpdateShortChatMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of UpdateShortChatMessage by ID.
func ( UpdateShortChatMessageArray) () UpdateShortChatMessageArray {
	return .SortStable(func(,  UpdateShortChatMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortByDate sorts slice of UpdateShortChatMessage by Date.
func ( UpdateShortChatMessageArray) () UpdateShortChatMessageArray {
	return .Sort(func(,  UpdateShortChatMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of UpdateShortChatMessage by Date.
func ( UpdateShortChatMessageArray) () UpdateShortChatMessageArray {
	return .SortStable(func(,  UpdateShortChatMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// FillMap fills constructors to given map.
func ( UpdateShortChatMessageArray) ( map[int]UpdateShortChatMessage) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( UpdateShortChatMessageArray) () map[int]UpdateShortChatMessage {
	 := make(map[int]UpdateShortChatMessage, len())
	.FillMap()
	return 
}

// UpdateShortArray is adapter for slice of UpdateShort.
type UpdateShortArray []UpdateShort

// Sort sorts slice of UpdateShort.
func ( UpdateShortArray) ( func(,  UpdateShort) bool) UpdateShortArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdateShort.
func ( UpdateShortArray) ( func(,  UpdateShort) bool) UpdateShortArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdateShort.
func ( UpdateShortArray) ( func( UpdateShort) bool) UpdateShortArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdateShortArray) () ( UpdateShort,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdateShortArray) () ( UpdateShort,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdateShortArray) () ( UpdateShort,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdateShort
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdateShortArray) () ( UpdateShort,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByDate sorts slice of UpdateShort by Date.
func ( UpdateShortArray) () UpdateShortArray {
	return .Sort(func(,  UpdateShort) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of UpdateShort by Date.
func ( UpdateShortArray) () UpdateShortArray {
	return .SortStable(func(,  UpdateShort) bool {
		return .GetDate() < .GetDate()
	})
}

// UpdatesCombinedArray is adapter for slice of UpdatesCombined.
type UpdatesCombinedArray []UpdatesCombined

// Sort sorts slice of UpdatesCombined.
func ( UpdatesCombinedArray) ( func(,  UpdatesCombined) bool) UpdatesCombinedArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdatesCombined.
func ( UpdatesCombinedArray) ( func(,  UpdatesCombined) bool) UpdatesCombinedArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdatesCombined.
func ( UpdatesCombinedArray) ( func( UpdatesCombined) bool) UpdatesCombinedArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdatesCombinedArray) () ( UpdatesCombined,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdatesCombinedArray) () ( UpdatesCombined,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdatesCombinedArray) () ( UpdatesCombined,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdatesCombined
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdatesCombinedArray) () ( UpdatesCombined,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByDate sorts slice of UpdatesCombined by Date.
func ( UpdatesCombinedArray) () UpdatesCombinedArray {
	return .Sort(func(,  UpdatesCombined) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of UpdatesCombined by Date.
func ( UpdatesCombinedArray) () UpdatesCombinedArray {
	return .SortStable(func(,  UpdatesCombined) bool {
		return .GetDate() < .GetDate()
	})
}

// UpdatesArray is adapter for slice of Updates.
type UpdatesArray []Updates

// Sort sorts slice of Updates.
func ( UpdatesArray) ( func(,  Updates) bool) UpdatesArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of Updates.
func ( UpdatesArray) ( func(,  Updates) bool) UpdatesArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of Updates.
func ( UpdatesArray) ( func( Updates) bool) UpdatesArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdatesArray) () ( Updates,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdatesArray) () ( Updates,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdatesArray) () ( Updates,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  Updates
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdatesArray) () ( Updates,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByDate sorts slice of Updates by Date.
func ( UpdatesArray) () UpdatesArray {
	return .Sort(func(,  Updates) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of Updates by Date.
func ( UpdatesArray) () UpdatesArray {
	return .SortStable(func(,  Updates) bool {
		return .GetDate() < .GetDate()
	})
}

// UpdateShortSentMessageArray is adapter for slice of UpdateShortSentMessage.
type UpdateShortSentMessageArray []UpdateShortSentMessage

// Sort sorts slice of UpdateShortSentMessage.
func ( UpdateShortSentMessageArray) ( func(,  UpdateShortSentMessage) bool) UpdateShortSentMessageArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of UpdateShortSentMessage.
func ( UpdateShortSentMessageArray) ( func(,  UpdateShortSentMessage) bool) UpdateShortSentMessageArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of UpdateShortSentMessage.
func ( UpdateShortSentMessageArray) ( func( UpdateShortSentMessage) bool) UpdateShortSentMessageArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( UpdateShortSentMessageArray) () ( UpdateShortSentMessage,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( UpdateShortSentMessageArray) () ( UpdateShortSentMessage,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *UpdateShortSentMessageArray) () ( UpdateShortSentMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  UpdateShortSentMessage
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *UpdateShortSentMessageArray) () ( UpdateShortSentMessage,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of UpdateShortSentMessage by ID.
func ( UpdateShortSentMessageArray) () UpdateShortSentMessageArray {
	return .Sort(func(,  UpdateShortSentMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of UpdateShortSentMessage by ID.
func ( UpdateShortSentMessageArray) () UpdateShortSentMessageArray {
	return .SortStable(func(,  UpdateShortSentMessage) bool {
		return .GetID() < .GetID()
	})
}

// SortByDate sorts slice of UpdateShortSentMessage by Date.
func ( UpdateShortSentMessageArray) () UpdateShortSentMessageArray {
	return .Sort(func(,  UpdateShortSentMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// SortStableByDate sorts slice of UpdateShortSentMessage by Date.
func ( UpdateShortSentMessageArray) () UpdateShortSentMessageArray {
	return .SortStable(func(,  UpdateShortSentMessage) bool {
		return .GetDate() < .GetDate()
	})
}

// FillMap fills constructors to given map.
func ( UpdateShortSentMessageArray) ( map[int]UpdateShortSentMessage) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( UpdateShortSentMessageArray) () map[int]UpdateShortSentMessage {
	 := make(map[int]UpdateShortSentMessage, len())
	.FillMap()
	return 
}