You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tl_phone_join_as_peers_gen.go
    path of file: ./repos/td/tg
    
    the code of the file until where you have to start completion: // Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"github.com/gotd/td/bin"
	"github.com/gotd/td/tdjson"
	"github.com/gotd/td/tdp"
	"github.com/gotd/td/tgerr"
)

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

// PhoneJoinAsPeers represents TL type `phone.joinAsPeers#afe5623f`.
// A list of peers that can be used to join a group call, presenting yourself as a
// specific user/channel.
//
// See https://core.telegram.org/constructor/phone.joinAsPeers for reference.
type PhoneJoinAsPeers struct {
	// Peers
	Peers []PeerClass
	// Chats mentioned in the peers vector
	Chats []ChatClass
	// Users mentioned in the peers vector
	Users []UserClass
}

// PhoneJoinAsPeersTypeID is TL type id of PhoneJoinAsPeers.
const PhoneJoinAsPeersTypeID = 0xafe5623f

// Ensuring interfaces i
    
func (j *PhoneJoinAsPeers) EncodeBare(b *bin.Buffer) error {
	if j == nil {
		return fmt.Errorf("can't encode phone.joinAsPeers#afe5623f as nil")
	}
	b.PutVectorHeader(len(j.Peers))
	for idx, v := range j.Peers {
		if v == nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field peers element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field peers element with index %d: %w", idx, err)
		}
	}
	b.PutVectorHeader(len(j.Chats))
	for idx, v := range j.Chats {
		if v == nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field chats element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field chats element with index %d: %w", idx, err)
		}
	}
	b.PutVectorHeader(len(j.Users))
	for idx, v := range j.Users {
		if v == nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field users element with index %d is nil", idx)
		}
		if err := v.Encode(b); err != nil {
			return fmt.Errorf("unable to encode phone.joinAsPeers#afe5623f: field users element with index %d: %w", idx, err)
		}
	}
	return nil
}