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

// StoriesIncrementStoryViewsRequest represents TL type `stories.incrementStoryViews#b2028afb`.
// Increment the view counter of one or more stories.
//
// See https://core.telegram.org/method/stories.incrementStoryViews for reference.
type StoriesIncrementStoryViewsRequest struct {
	// Peer where the stories were posted.
	Peer InputPeerClass
	// IDs of the stories (maximum 200 at a time).
	ID []int
}

// StoriesIncrementStoryViewsRequestTypeID is TL type id of StoriesIncrementStoryViewsRequest.
const StoriesIncrementStoryViewsRequestTypeID = 0xb2028afb

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

func ( *StoriesIncrementStoryViewsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills StoriesIncrementStoryViewsRequest from given interface.
func ( *StoriesIncrementStoryViewsRequest) ( interface {
	() ( InputPeerClass)
	() ( []int)
}) {
	.Peer = .()
	.ID = .()
}

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

// TypeName returns name of type in TL schema.
func (*StoriesIncrementStoryViewsRequest) () string {
	return "stories.incrementStoryViews"
}

// TypeInfo returns info about TL type.
func ( *StoriesIncrementStoryViewsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stories.incrementStoryViews",
		ID:   StoriesIncrementStoryViewsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StoriesIncrementStoryViewsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.incrementStoryViews#b2028afb as nil")
	}
	.PutID(StoriesIncrementStoryViewsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StoriesIncrementStoryViewsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stories.incrementStoryViews#b2028afb as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode stories.incrementStoryViews#b2028afb: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode stories.incrementStoryViews#b2028afb: field peer: %w", )
	}
	.PutVectorHeader(len(.ID))
	for ,  := range .ID {
		.PutInt()
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *StoriesIncrementStoryViewsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stories.incrementStoryViews#b2028afb to nil")
	}
	if  := .ConsumeID(StoriesIncrementStoryViewsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode stories.incrementStoryViews#b2028afb: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *StoriesIncrementStoryViewsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stories.incrementStoryViews#b2028afb to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode stories.incrementStoryViews#b2028afb: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode stories.incrementStoryViews#b2028afb: field id: %w", )
		}

		if  > 0 {
			.ID = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode stories.incrementStoryViews#b2028afb: field id: %w", )
			}
			.ID = append(.ID, )
		}
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *StoriesIncrementStoryViewsRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetID returns value of ID field.
func ( *StoriesIncrementStoryViewsRequest) () ( []int) {
	if  == nil {
		return
	}
	return .ID
}

// StoriesIncrementStoryViews invokes method stories.incrementStoryViews#b2028afb returning error if any.
// Increment the view counter of one or more stories.
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 STORY_ID_EMPTY: You specified no story IDs.
//
// See https://core.telegram.org/method/stories.incrementStoryViews for reference.
func ( *Client) ( context.Context,  *StoriesIncrementStoryViewsRequest) (bool, error) {
	var  BoolBox

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