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

// ContactsGetSavedRequest represents TL type `contacts.getSaved#82f1e39f`.
// Get all contacts, requires a takeout session, see here » for more info¹.
//
// Links:
//  1. https://core.telegram.org/api/takeout
//
// See https://core.telegram.org/method/contacts.getSaved for reference.
type ContactsGetSavedRequest struct {
}

// ContactsGetSavedRequestTypeID is TL type id of ContactsGetSavedRequest.
const ContactsGetSavedRequestTypeID = 0x82f1e39f

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

func ( *ContactsGetSavedRequest) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *ContactsGetSavedRequest) () tdp.Type {
	 := tdp.Type{
		Name: "contacts.getSaved",
		ID:   ContactsGetSavedRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *ContactsGetSavedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.getSaved#82f1e39f as nil")
	}
	.PutID(ContactsGetSavedRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactsGetSavedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.getSaved#82f1e39f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ContactsGetSavedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.getSaved#82f1e39f to nil")
	}
	if  := .ConsumeID(ContactsGetSavedRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode contacts.getSaved#82f1e39f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ContactsGetSavedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.getSaved#82f1e39f to nil")
	}
	return nil
}

// ContactsGetSaved invokes method contacts.getSaved#82f1e39f returning error if any.
// Get all contacts, requires a takeout session, see here » for more info¹.
//
// Links:
//  1. 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/contacts.getSaved for reference.
func ( *Client) ( context.Context) ([]SavedPhoneContact, error) {
	var  SavedPhoneContactVector

	 := &ContactsGetSavedRequest{}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return []SavedPhoneContact(.Elems), nil
}