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

// UploadGetWebFileRequest represents TL type `upload.getWebFile#24e6818d`.
//
// See https://core.telegram.org/method/upload.getWebFile for reference.
type UploadGetWebFileRequest struct {
	// Location field of UploadGetWebFileRequest.
	Location InputWebFileLocationClass
	// Offset field of UploadGetWebFileRequest.
	Offset int
	// Limit field of UploadGetWebFileRequest.
	Limit int
}

// UploadGetWebFileRequestTypeID is TL type id of UploadGetWebFileRequest.
const UploadGetWebFileRequestTypeID = 0x24e6818d

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

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

	return true
}

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

// FillFrom fills UploadGetWebFileRequest from given interface.
func ( *UploadGetWebFileRequest) ( interface {
	() ( InputWebFileLocationClass)
	() ( int)
	() ( int)
}) {
	.Location = .()
	.Offset = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*UploadGetWebFileRequest) () string {
	return "upload.getWebFile"
}

// TypeInfo returns info about TL type.
func ( *UploadGetWebFileRequest) () tdp.Type {
	 := tdp.Type{
		Name: "upload.getWebFile",
		ID:   UploadGetWebFileRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Location",
			SchemaName: "location",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UploadGetWebFileRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode upload.getWebFile#24e6818d as nil")
	}
	.PutID(UploadGetWebFileRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UploadGetWebFileRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode upload.getWebFile#24e6818d as nil")
	}
	if .Location == nil {
		return fmt.Errorf("unable to encode upload.getWebFile#24e6818d: field location is nil")
	}
	if  := .Location.Encode();  != nil {
		return fmt.Errorf("unable to encode upload.getWebFile#24e6818d: field location: %w", )
	}
	.PutInt(.Offset)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *UploadGetWebFileRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode upload.getWebFile#24e6818d to nil")
	}
	if  := .ConsumeID(UploadGetWebFileRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode upload.getWebFile#24e6818d: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *UploadGetWebFileRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode upload.getWebFile#24e6818d to nil")
	}
	{
		,  := DecodeInputWebFileLocation()
		if  != nil {
			return fmt.Errorf("unable to decode upload.getWebFile#24e6818d: field location: %w", )
		}
		.Location = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode upload.getWebFile#24e6818d: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode upload.getWebFile#24e6818d: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// GetLocation returns value of Location field.
func ( *UploadGetWebFileRequest) () ( InputWebFileLocationClass) {
	if  == nil {
		return
	}
	return .Location
}

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

// GetLimit returns value of Limit field.
func ( *UploadGetWebFileRequest) () ( int) {
	if  == nil {
		return
	}
	return .Limit
}

// UploadGetWebFile invokes method upload.getWebFile#24e6818d returning error if any.
//
// See https://core.telegram.org/method/upload.getWebFile for reference.
func ( *Client) ( context.Context,  *UploadGetWebFileRequest) (*UploadWebFile, error) {
	var  UploadWebFile

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