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

// PhotosGetUserPhotosRequest represents TL type `photos.getUserPhotos#91cd32a8`.
// Returns the list of user photos.
//
// See https://core.telegram.org/method/photos.getUserPhotos for reference.
type PhotosGetUserPhotosRequest struct {
	// User ID
	UserID InputUserClass
	// Number of list elements to be skipped
	Offset int
	// If a positive value was transferred, the method will return only photos with IDs less
	// than the set one. This parameter is often useful when refetching file references »¹,
	// as in conjuction with limit=1 and offset=-1 the photo² object with the id specified
	// in max_id can be fetched.
	//
	// Links:
	//  1) https://core.telegram.org/api/file_reference
	//  2) https://core.telegram.org/constructor/photo
	MaxID int64
	// Number of list elements to be returned
	Limit int
}

// PhotosGetUserPhotosRequestTypeID is TL type id of PhotosGetUserPhotosRequest.
const PhotosGetUserPhotosRequestTypeID = 0x91cd32a8

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

func ( *PhotosGetUserPhotosRequest) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == nil) {
		return false
	}
	if !(.Offset == 0) {
		return false
	}
	if !(.MaxID == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PhotosGetUserPhotosRequest from given interface.
func ( *PhotosGetUserPhotosRequest) ( interface {
	() ( InputUserClass)
	() ( int)
	() ( int64)
	() ( int)
}) {
	.UserID = .()
	.Offset = .()
	.MaxID = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*PhotosGetUserPhotosRequest) () string {
	return "photos.getUserPhotos"
}

// TypeInfo returns info about TL type.
func ( *PhotosGetUserPhotosRequest) () tdp.Type {
	 := tdp.Type{
		Name: "photos.getUserPhotos",
		ID:   PhotosGetUserPhotosRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "MaxID",
			SchemaName: "max_id",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotosGetUserPhotosRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photos.getUserPhotos#91cd32a8 as nil")
	}
	.PutID(PhotosGetUserPhotosRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotosGetUserPhotosRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photos.getUserPhotos#91cd32a8 as nil")
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode photos.getUserPhotos#91cd32a8: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode photos.getUserPhotos#91cd32a8: field user_id: %w", )
	}
	.PutInt(.Offset)
	.PutLong(.MaxID)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *PhotosGetUserPhotosRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photos.getUserPhotos#91cd32a8 to nil")
	}
	if  := .ConsumeID(PhotosGetUserPhotosRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode photos.getUserPhotos#91cd32a8: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PhotosGetUserPhotosRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photos.getUserPhotos#91cd32a8 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode photos.getUserPhotos#91cd32a8: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photos.getUserPhotos#91cd32a8: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode photos.getUserPhotos#91cd32a8: field max_id: %w", )
		}
		.MaxID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photos.getUserPhotos#91cd32a8: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *PhotosGetUserPhotosRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

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

// GetMaxID returns value of MaxID field.
func ( *PhotosGetUserPhotosRequest) () ( int64) {
	if  == nil {
		return
	}
	return .MaxID
}

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

// PhotosGetUserPhotos invokes method photos.getUserPhotos#91cd32a8 returning error if any.
// Returns the list of user photos.
//
// Possible errors:
//
//	400 MAX_ID_INVALID: The provided max ID is invalid.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/photos.getUserPhotos for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *PhotosGetUserPhotosRequest) (PhotosPhotosClass, error) {
	var  PhotosPhotosBox

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