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

// ContactsGetBlockedRequest represents TL type `contacts.getBlocked#9a868f80`.
// Returns the list of blocked users.
//
// See https://core.telegram.org/method/contacts.getBlocked for reference.
type ContactsGetBlockedRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to fetch the story blocklist; if not set, will fetch the main blocklist. See
	// here »¹ for differences between the two.
	//
	// Links:
	//  1) https://core.telegram.org/api/block
	MyStoriesFrom bool
	// The number of list elements to be skipped
	Offset int
	// The number of list elements to be returned
	Limit int
}

// ContactsGetBlockedRequestTypeID is TL type id of ContactsGetBlockedRequest.
const ContactsGetBlockedRequestTypeID = 0x9a868f80

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

func ( *ContactsGetBlockedRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.MyStoriesFrom == false) {
		return false
	}
	if !(.Offset == 0) {
		return false
	}
	if !(.Limit == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ContactsGetBlockedRequest from given interface.
func ( *ContactsGetBlockedRequest) ( interface {
	() ( bool)
	() ( int)
	() ( int)
}) {
	.MyStoriesFrom = .()
	.Offset = .()
	.Limit = .()
}

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

// TypeName returns name of type in TL schema.
func (*ContactsGetBlockedRequest) () string {
	return "contacts.getBlocked"
}

// TypeInfo returns info about TL type.
func ( *ContactsGetBlockedRequest) () tdp.Type {
	 := tdp.Type{
		Name: "contacts.getBlocked",
		ID:   ContactsGetBlockedRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MyStoriesFrom",
			SchemaName: "my_stories_from",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Limit",
			SchemaName: "limit",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *ContactsGetBlockedRequest) () {
	if !(.MyStoriesFrom == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *ContactsGetBlockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.getBlocked#9a868f80 as nil")
	}
	.PutID(ContactsGetBlockedRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactsGetBlockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.getBlocked#9a868f80 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode contacts.getBlocked#9a868f80: field flags: %w", )
	}
	.PutInt(.Offset)
	.PutInt(.Limit)
	return nil
}

// Decode implements bin.Decoder.
func ( *ContactsGetBlockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.getBlocked#9a868f80 to nil")
	}
	if  := .ConsumeID(ContactsGetBlockedRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode contacts.getBlocked#9a868f80: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ContactsGetBlockedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.getBlocked#9a868f80 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode contacts.getBlocked#9a868f80: field flags: %w", )
		}
	}
	.MyStoriesFrom = .Flags.Has(0)
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode contacts.getBlocked#9a868f80: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode contacts.getBlocked#9a868f80: field limit: %w", )
		}
		.Limit = 
	}
	return nil
}

// SetMyStoriesFrom sets value of MyStoriesFrom conditional field.
func ( *ContactsGetBlockedRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.MyStoriesFrom = true
	} else {
		.Flags.Unset(0)
		.MyStoriesFrom = false
	}
}

// GetMyStoriesFrom returns value of MyStoriesFrom conditional field.
func ( *ContactsGetBlockedRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

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

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

// ContactsGetBlocked invokes method contacts.getBlocked#9a868f80 returning error if any.
// Returns the list of blocked users.
//
// See https://core.telegram.org/method/contacts.getBlocked for reference.
func ( *Client) ( context.Context,  *ContactsGetBlockedRequest) (ContactsBlockedClass, error) {
	var  ContactsBlockedBox

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