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"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type PrivacyValueAllowContacts struct {
}
const PrivacyValueAllowContactsTypeID = 0xfffe1bac
func (p PrivacyValueAllowContacts ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueAllowContacts {}
_ bin .Decoder = &PrivacyValueAllowContacts {}
_ bin .BareEncoder = &PrivacyValueAllowContacts {}
_ bin .BareDecoder = &PrivacyValueAllowContacts {}
_ PrivacyRuleClass = &PrivacyValueAllowContacts {}
)
func (p *PrivacyValueAllowContacts ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PrivacyValueAllowContacts ) String () string {
if p == nil {
return "PrivacyValueAllowContacts(nil)"
}
type Alias PrivacyValueAllowContacts
return fmt .Sprintf ("PrivacyValueAllowContacts%+v" , Alias (*p ))
}
func (*PrivacyValueAllowContacts ) TypeID () uint32 {
return PrivacyValueAllowContactsTypeID
}
func (*PrivacyValueAllowContacts ) TypeName () string {
return "privacyValueAllowContacts"
}
func (p *PrivacyValueAllowContacts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueAllowContacts" ,
ID : PrivacyValueAllowContactsTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PrivacyValueAllowContacts ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowContacts#fffe1bac as nil" )
}
b .PutID (PrivacyValueAllowContactsTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueAllowContacts ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowContacts#fffe1bac as nil" )
}
return nil
}
func (p *PrivacyValueAllowContacts ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowContacts#fffe1bac to nil" )
}
if err := b .ConsumeID (PrivacyValueAllowContactsTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowContacts#fffe1bac: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueAllowContacts ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowContacts#fffe1bac to nil" )
}
return nil
}
type PrivacyValueAllowAll struct {
}
const PrivacyValueAllowAllTypeID = 0x65427b82
func (p PrivacyValueAllowAll ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueAllowAll {}
_ bin .Decoder = &PrivacyValueAllowAll {}
_ bin .BareEncoder = &PrivacyValueAllowAll {}
_ bin .BareDecoder = &PrivacyValueAllowAll {}
_ PrivacyRuleClass = &PrivacyValueAllowAll {}
)
func (p *PrivacyValueAllowAll ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PrivacyValueAllowAll ) String () string {
if p == nil {
return "PrivacyValueAllowAll(nil)"
}
type Alias PrivacyValueAllowAll
return fmt .Sprintf ("PrivacyValueAllowAll%+v" , Alias (*p ))
}
func (*PrivacyValueAllowAll ) TypeID () uint32 {
return PrivacyValueAllowAllTypeID
}
func (*PrivacyValueAllowAll ) TypeName () string {
return "privacyValueAllowAll"
}
func (p *PrivacyValueAllowAll ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueAllowAll" ,
ID : PrivacyValueAllowAllTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PrivacyValueAllowAll ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowAll#65427b82 as nil" )
}
b .PutID (PrivacyValueAllowAllTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueAllowAll ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowAll#65427b82 as nil" )
}
return nil
}
func (p *PrivacyValueAllowAll ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowAll#65427b82 to nil" )
}
if err := b .ConsumeID (PrivacyValueAllowAllTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowAll#65427b82: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueAllowAll ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowAll#65427b82 to nil" )
}
return nil
}
type PrivacyValueAllowUsers struct {
Users []int64
}
const PrivacyValueAllowUsersTypeID = 0xb8905fb2
func (p PrivacyValueAllowUsers ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueAllowUsers {}
_ bin .Decoder = &PrivacyValueAllowUsers {}
_ bin .BareEncoder = &PrivacyValueAllowUsers {}
_ bin .BareDecoder = &PrivacyValueAllowUsers {}
_ PrivacyRuleClass = &PrivacyValueAllowUsers {}
)
func (p *PrivacyValueAllowUsers ) Zero () bool {
if p == nil {
return true
}
if !(p .Users == nil ) {
return false
}
return true
}
func (p *PrivacyValueAllowUsers ) String () string {
if p == nil {
return "PrivacyValueAllowUsers(nil)"
}
type Alias PrivacyValueAllowUsers
return fmt .Sprintf ("PrivacyValueAllowUsers%+v" , Alias (*p ))
}
func (p *PrivacyValueAllowUsers ) FillFrom (from interface {
GetUsers () (value []int64 )
}) {
p .Users = from .GetUsers ()
}
func (*PrivacyValueAllowUsers ) TypeID () uint32 {
return PrivacyValueAllowUsersTypeID
}
func (*PrivacyValueAllowUsers ) TypeName () string {
return "privacyValueAllowUsers"
}
func (p *PrivacyValueAllowUsers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueAllowUsers" ,
ID : PrivacyValueAllowUsersTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (p *PrivacyValueAllowUsers ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowUsers#b8905fb2 as nil" )
}
b .PutID (PrivacyValueAllowUsersTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueAllowUsers ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowUsers#b8905fb2 as nil" )
}
b .PutVectorHeader (len (p .Users ))
for _ , v := range p .Users {
b .PutLong (v )
}
return nil
}
func (p *PrivacyValueAllowUsers ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowUsers#b8905fb2 to nil" )
}
if err := b .ConsumeID (PrivacyValueAllowUsersTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowUsers#b8905fb2: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueAllowUsers ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowUsers#b8905fb2 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowUsers#b8905fb2: field users: %w" , err )
}
if headerLen > 0 {
p .Users = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowUsers#b8905fb2: field users: %w" , err )
}
p .Users = append (p .Users , value )
}
}
return nil
}
func (p *PrivacyValueAllowUsers ) GetUsers () (value []int64 ) {
if p == nil {
return
}
return p .Users
}
type PrivacyValueDisallowContacts struct {
}
const PrivacyValueDisallowContactsTypeID = 0xf888fa1a
func (p PrivacyValueDisallowContacts ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueDisallowContacts {}
_ bin .Decoder = &PrivacyValueDisallowContacts {}
_ bin .BareEncoder = &PrivacyValueDisallowContacts {}
_ bin .BareDecoder = &PrivacyValueDisallowContacts {}
_ PrivacyRuleClass = &PrivacyValueDisallowContacts {}
)
func (p *PrivacyValueDisallowContacts ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PrivacyValueDisallowContacts ) String () string {
if p == nil {
return "PrivacyValueDisallowContacts(nil)"
}
type Alias PrivacyValueDisallowContacts
return fmt .Sprintf ("PrivacyValueDisallowContacts%+v" , Alias (*p ))
}
func (*PrivacyValueDisallowContacts ) TypeID () uint32 {
return PrivacyValueDisallowContactsTypeID
}
func (*PrivacyValueDisallowContacts ) TypeName () string {
return "privacyValueDisallowContacts"
}
func (p *PrivacyValueDisallowContacts ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueDisallowContacts" ,
ID : PrivacyValueDisallowContactsTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PrivacyValueDisallowContacts ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowContacts#f888fa1a as nil" )
}
b .PutID (PrivacyValueDisallowContactsTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueDisallowContacts ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowContacts#f888fa1a as nil" )
}
return nil
}
func (p *PrivacyValueDisallowContacts ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowContacts#f888fa1a to nil" )
}
if err := b .ConsumeID (PrivacyValueDisallowContactsTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowContacts#f888fa1a: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueDisallowContacts ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowContacts#f888fa1a to nil" )
}
return nil
}
type PrivacyValueDisallowAll struct {
}
const PrivacyValueDisallowAllTypeID = 0x8b73e763
func (p PrivacyValueDisallowAll ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueDisallowAll {}
_ bin .Decoder = &PrivacyValueDisallowAll {}
_ bin .BareEncoder = &PrivacyValueDisallowAll {}
_ bin .BareDecoder = &PrivacyValueDisallowAll {}
_ PrivacyRuleClass = &PrivacyValueDisallowAll {}
)
func (p *PrivacyValueDisallowAll ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PrivacyValueDisallowAll ) String () string {
if p == nil {
return "PrivacyValueDisallowAll(nil)"
}
type Alias PrivacyValueDisallowAll
return fmt .Sprintf ("PrivacyValueDisallowAll%+v" , Alias (*p ))
}
func (*PrivacyValueDisallowAll ) TypeID () uint32 {
return PrivacyValueDisallowAllTypeID
}
func (*PrivacyValueDisallowAll ) TypeName () string {
return "privacyValueDisallowAll"
}
func (p *PrivacyValueDisallowAll ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueDisallowAll" ,
ID : PrivacyValueDisallowAllTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PrivacyValueDisallowAll ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowAll#8b73e763 as nil" )
}
b .PutID (PrivacyValueDisallowAllTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueDisallowAll ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowAll#8b73e763 as nil" )
}
return nil
}
func (p *PrivacyValueDisallowAll ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowAll#8b73e763 to nil" )
}
if err := b .ConsumeID (PrivacyValueDisallowAllTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowAll#8b73e763: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueDisallowAll ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowAll#8b73e763 to nil" )
}
return nil
}
type PrivacyValueDisallowUsers struct {
Users []int64
}
const PrivacyValueDisallowUsersTypeID = 0xe4621141
func (p PrivacyValueDisallowUsers ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueDisallowUsers {}
_ bin .Decoder = &PrivacyValueDisallowUsers {}
_ bin .BareEncoder = &PrivacyValueDisallowUsers {}
_ bin .BareDecoder = &PrivacyValueDisallowUsers {}
_ PrivacyRuleClass = &PrivacyValueDisallowUsers {}
)
func (p *PrivacyValueDisallowUsers ) Zero () bool {
if p == nil {
return true
}
if !(p .Users == nil ) {
return false
}
return true
}
func (p *PrivacyValueDisallowUsers ) String () string {
if p == nil {
return "PrivacyValueDisallowUsers(nil)"
}
type Alias PrivacyValueDisallowUsers
return fmt .Sprintf ("PrivacyValueDisallowUsers%+v" , Alias (*p ))
}
func (p *PrivacyValueDisallowUsers ) FillFrom (from interface {
GetUsers () (value []int64 )
}) {
p .Users = from .GetUsers ()
}
func (*PrivacyValueDisallowUsers ) TypeID () uint32 {
return PrivacyValueDisallowUsersTypeID
}
func (*PrivacyValueDisallowUsers ) TypeName () string {
return "privacyValueDisallowUsers"
}
func (p *PrivacyValueDisallowUsers ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueDisallowUsers" ,
ID : PrivacyValueDisallowUsersTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Users" ,
SchemaName : "users" ,
},
}
return typ
}
func (p *PrivacyValueDisallowUsers ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowUsers#e4621141 as nil" )
}
b .PutID (PrivacyValueDisallowUsersTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueDisallowUsers ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowUsers#e4621141 as nil" )
}
b .PutVectorHeader (len (p .Users ))
for _ , v := range p .Users {
b .PutLong (v )
}
return nil
}
func (p *PrivacyValueDisallowUsers ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowUsers#e4621141 to nil" )
}
if err := b .ConsumeID (PrivacyValueDisallowUsersTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowUsers#e4621141: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueDisallowUsers ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowUsers#e4621141 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowUsers#e4621141: field users: %w" , err )
}
if headerLen > 0 {
p .Users = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowUsers#e4621141: field users: %w" , err )
}
p .Users = append (p .Users , value )
}
}
return nil
}
func (p *PrivacyValueDisallowUsers ) GetUsers () (value []int64 ) {
if p == nil {
return
}
return p .Users
}
type PrivacyValueAllowChatParticipants struct {
Chats []int64
}
const PrivacyValueAllowChatParticipantsTypeID = 0x6b134e8e
func (p PrivacyValueAllowChatParticipants ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueAllowChatParticipants {}
_ bin .Decoder = &PrivacyValueAllowChatParticipants {}
_ bin .BareEncoder = &PrivacyValueAllowChatParticipants {}
_ bin .BareDecoder = &PrivacyValueAllowChatParticipants {}
_ PrivacyRuleClass = &PrivacyValueAllowChatParticipants {}
)
func (p *PrivacyValueAllowChatParticipants ) Zero () bool {
if p == nil {
return true
}
if !(p .Chats == nil ) {
return false
}
return true
}
func (p *PrivacyValueAllowChatParticipants ) String () string {
if p == nil {
return "PrivacyValueAllowChatParticipants(nil)"
}
type Alias PrivacyValueAllowChatParticipants
return fmt .Sprintf ("PrivacyValueAllowChatParticipants%+v" , Alias (*p ))
}
func (p *PrivacyValueAllowChatParticipants ) FillFrom (from interface {
GetChats () (value []int64 )
}) {
p .Chats = from .GetChats ()
}
func (*PrivacyValueAllowChatParticipants ) TypeID () uint32 {
return PrivacyValueAllowChatParticipantsTypeID
}
func (*PrivacyValueAllowChatParticipants ) TypeName () string {
return "privacyValueAllowChatParticipants"
}
func (p *PrivacyValueAllowChatParticipants ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueAllowChatParticipants" ,
ID : PrivacyValueAllowChatParticipantsTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Chats" ,
SchemaName : "chats" ,
},
}
return typ
}
func (p *PrivacyValueAllowChatParticipants ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowChatParticipants#6b134e8e as nil" )
}
b .PutID (PrivacyValueAllowChatParticipantsTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueAllowChatParticipants ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowChatParticipants#6b134e8e as nil" )
}
b .PutVectorHeader (len (p .Chats ))
for _ , v := range p .Chats {
b .PutLong (v )
}
return nil
}
func (p *PrivacyValueAllowChatParticipants ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowChatParticipants#6b134e8e to nil" )
}
if err := b .ConsumeID (PrivacyValueAllowChatParticipantsTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowChatParticipants#6b134e8e: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueAllowChatParticipants ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowChatParticipants#6b134e8e to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowChatParticipants#6b134e8e: field chats: %w" , err )
}
if headerLen > 0 {
p .Chats = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowChatParticipants#6b134e8e: field chats: %w" , err )
}
p .Chats = append (p .Chats , value )
}
}
return nil
}
func (p *PrivacyValueAllowChatParticipants ) GetChats () (value []int64 ) {
if p == nil {
return
}
return p .Chats
}
type PrivacyValueDisallowChatParticipants struct {
Chats []int64
}
const PrivacyValueDisallowChatParticipantsTypeID = 0x41c87565
func (p PrivacyValueDisallowChatParticipants ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueDisallowChatParticipants {}
_ bin .Decoder = &PrivacyValueDisallowChatParticipants {}
_ bin .BareEncoder = &PrivacyValueDisallowChatParticipants {}
_ bin .BareDecoder = &PrivacyValueDisallowChatParticipants {}
_ PrivacyRuleClass = &PrivacyValueDisallowChatParticipants {}
)
func (p *PrivacyValueDisallowChatParticipants ) Zero () bool {
if p == nil {
return true
}
if !(p .Chats == nil ) {
return false
}
return true
}
func (p *PrivacyValueDisallowChatParticipants ) String () string {
if p == nil {
return "PrivacyValueDisallowChatParticipants(nil)"
}
type Alias PrivacyValueDisallowChatParticipants
return fmt .Sprintf ("PrivacyValueDisallowChatParticipants%+v" , Alias (*p ))
}
func (p *PrivacyValueDisallowChatParticipants ) FillFrom (from interface {
GetChats () (value []int64 )
}) {
p .Chats = from .GetChats ()
}
func (*PrivacyValueDisallowChatParticipants ) TypeID () uint32 {
return PrivacyValueDisallowChatParticipantsTypeID
}
func (*PrivacyValueDisallowChatParticipants ) TypeName () string {
return "privacyValueDisallowChatParticipants"
}
func (p *PrivacyValueDisallowChatParticipants ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueDisallowChatParticipants" ,
ID : PrivacyValueDisallowChatParticipantsTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Chats" ,
SchemaName : "chats" ,
},
}
return typ
}
func (p *PrivacyValueDisallowChatParticipants ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowChatParticipants#41c87565 as nil" )
}
b .PutID (PrivacyValueDisallowChatParticipantsTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueDisallowChatParticipants ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueDisallowChatParticipants#41c87565 as nil" )
}
b .PutVectorHeader (len (p .Chats ))
for _ , v := range p .Chats {
b .PutLong (v )
}
return nil
}
func (p *PrivacyValueDisallowChatParticipants ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowChatParticipants#41c87565 to nil" )
}
if err := b .ConsumeID (PrivacyValueDisallowChatParticipantsTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowChatParticipants#41c87565: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueDisallowChatParticipants ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueDisallowChatParticipants#41c87565 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowChatParticipants#41c87565: field chats: %w" , err )
}
if headerLen > 0 {
p .Chats = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode privacyValueDisallowChatParticipants#41c87565: field chats: %w" , err )
}
p .Chats = append (p .Chats , value )
}
}
return nil
}
func (p *PrivacyValueDisallowChatParticipants ) GetChats () (value []int64 ) {
if p == nil {
return
}
return p .Chats
}
type PrivacyValueAllowCloseFriends struct {
}
const PrivacyValueAllowCloseFriendsTypeID = 0xf7e8d89b
func (p PrivacyValueAllowCloseFriends ) construct () PrivacyRuleClass { return &p }
var (
_ bin .Encoder = &PrivacyValueAllowCloseFriends {}
_ bin .Decoder = &PrivacyValueAllowCloseFriends {}
_ bin .BareEncoder = &PrivacyValueAllowCloseFriends {}
_ bin .BareDecoder = &PrivacyValueAllowCloseFriends {}
_ PrivacyRuleClass = &PrivacyValueAllowCloseFriends {}
)
func (p *PrivacyValueAllowCloseFriends ) Zero () bool {
if p == nil {
return true
}
return true
}
func (p *PrivacyValueAllowCloseFriends ) String () string {
if p == nil {
return "PrivacyValueAllowCloseFriends(nil)"
}
type Alias PrivacyValueAllowCloseFriends
return fmt .Sprintf ("PrivacyValueAllowCloseFriends%+v" , Alias (*p ))
}
func (*PrivacyValueAllowCloseFriends ) TypeID () uint32 {
return PrivacyValueAllowCloseFriendsTypeID
}
func (*PrivacyValueAllowCloseFriends ) TypeName () string {
return "privacyValueAllowCloseFriends"
}
func (p *PrivacyValueAllowCloseFriends ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "privacyValueAllowCloseFriends" ,
ID : PrivacyValueAllowCloseFriendsTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (p *PrivacyValueAllowCloseFriends ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowCloseFriends#f7e8d89b as nil" )
}
b .PutID (PrivacyValueAllowCloseFriendsTypeID )
return p .EncodeBare (b )
}
func (p *PrivacyValueAllowCloseFriends ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode privacyValueAllowCloseFriends#f7e8d89b as nil" )
}
return nil
}
func (p *PrivacyValueAllowCloseFriends ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowCloseFriends#f7e8d89b to nil" )
}
if err := b .ConsumeID (PrivacyValueAllowCloseFriendsTypeID ); err != nil {
return fmt .Errorf ("unable to decode privacyValueAllowCloseFriends#f7e8d89b: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PrivacyValueAllowCloseFriends ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode privacyValueAllowCloseFriends#f7e8d89b to nil" )
}
return nil
}
const PrivacyRuleClassName = "PrivacyRule"
type PrivacyRuleClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () PrivacyRuleClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func (p *PrivacyValueAllowChatParticipants ) AsInput () *InputPrivacyValueAllowChatParticipants {
value := new (InputPrivacyValueAllowChatParticipants )
value .Chats = p .GetChats ()
return value
}
func (p *PrivacyValueDisallowChatParticipants ) AsInput () *InputPrivacyValueDisallowChatParticipants {
value := new (InputPrivacyValueDisallowChatParticipants )
value .Chats = p .GetChats ()
return value
}
func DecodePrivacyRule (buf *bin .Buffer ) (PrivacyRuleClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case PrivacyValueAllowContactsTypeID :
v := PrivacyValueAllowContacts {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueAllowAllTypeID :
v := PrivacyValueAllowAll {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueAllowUsersTypeID :
v := PrivacyValueAllowUsers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueDisallowContactsTypeID :
v := PrivacyValueDisallowContacts {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueDisallowAllTypeID :
v := PrivacyValueDisallowAll {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueDisallowUsersTypeID :
v := PrivacyValueDisallowUsers {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueAllowChatParticipantsTypeID :
v := PrivacyValueAllowChatParticipants {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueDisallowChatParticipantsTypeID :
v := PrivacyValueDisallowChatParticipants {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
case PrivacyValueAllowCloseFriendsTypeID :
v := PrivacyValueAllowCloseFriends {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode PrivacyRuleClass: %w" , bin .NewUnexpectedID (id ))
}
}
type PrivacyRuleBox struct {
PrivacyRule PrivacyRuleClass
}
func (b *PrivacyRuleBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode PrivacyRuleBox to nil" )
}
v , err := DecodePrivacyRule (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .PrivacyRule = v
return nil
}
func (b *PrivacyRuleBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .PrivacyRule == nil {
return fmt .Errorf ("unable to encode PrivacyRuleClass as nil" )
}
return b .PrivacyRule .Encode (buf )
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .