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

// ChannelsGetLeftChannelsRequest represents TL type `channels.getLeftChannels#8341ecc0`.
// Get a list of channels/supergroups¹ we left, requires a takeout session, see here »
// for more info².
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/takeout
//
// See https://core.telegram.org/method/channels.getLeftChannels for reference.
type ChannelsGetLeftChannelsRequest struct {
	// Offset for pagination¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets
	Offset int
}

// ChannelsGetLeftChannelsRequestTypeID is TL type id of ChannelsGetLeftChannelsRequest.
const ChannelsGetLeftChannelsRequestTypeID = 0x8341ecc0

// Ensuring interfaces in compile-time for ChannelsGetLeftChannelsRequest.
var (
	_ bin.Encoder     = &ChannelsGetLeftChannelsRequest{}
	_ bin.Decoder     = &ChannelsGetLeftChannelsRequest{}
	_ bin.BareEncoder = &ChannelsGetLeftChannelsRequest{}
	_ bin.BareDecoder = &ChannelsGetLeftChannelsRequest{}
)

func ( *ChannelsGetLeftChannelsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Offset == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *ChannelsGetLeftChannelsRequest) () string {
	if  == nil {
		return "ChannelsGetLeftChannelsRequest(nil)"
	}
	type  ChannelsGetLeftChannelsRequest
	return fmt.Sprintf("ChannelsGetLeftChannelsRequest%+v", (*))
}

// FillFrom fills ChannelsGetLeftChannelsRequest from given interface.
func ( *ChannelsGetLeftChannelsRequest) ( interface {
	() ( int)
}) {
	.Offset = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*ChannelsGetLeftChannelsRequest) () uint32 {
	return ChannelsGetLeftChannelsRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*ChannelsGetLeftChannelsRequest) () string {
	return "channels.getLeftChannels"
}

// TypeInfo returns info about TL type.
func ( *ChannelsGetLeftChannelsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.getLeftChannels",
		ID:   ChannelsGetLeftChannelsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsGetLeftChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getLeftChannels#8341ecc0 as nil")
	}
	.PutID(ChannelsGetLeftChannelsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsGetLeftChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.getLeftChannels#8341ecc0 as nil")
	}
	.PutInt(.Offset)
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsGetLeftChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getLeftChannels#8341ecc0 to nil")
	}
	if  := .ConsumeID(ChannelsGetLeftChannelsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.getLeftChannels#8341ecc0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsGetLeftChannelsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.getLeftChannels#8341ecc0 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode channels.getLeftChannels#8341ecc0: field offset: %w", )
		}
		.Offset = 
	}
	return nil
}

// GetOffset returns value of Offset field.
func ( *ChannelsGetLeftChannelsRequest) () ( int) {
	if  == nil {
		return
	}
	return .Offset
}

// ChannelsGetLeftChannels invokes method channels.getLeftChannels#8341ecc0 returning error if any.
// Get a list of channels/supergroups¹ we left, requires a takeout session, see here »
// for more info².
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/takeout
//
// Possible errors:
//
//	403 TAKEOUT_REQUIRED: A takeout session needs to be initialized first, see here » for more info.
//
// See https://core.telegram.org/method/channels.getLeftChannels for reference.
func ( *Client) ( context.Context,  int) (MessagesChatsClass, error) {
	var  MessagesChatsBox

	 := &ChannelsGetLeftChannelsRequest{
		Offset: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Chats, nil
}