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 ContactsAcceptContactRequest struct {
ID InputUserClass
}
const ContactsAcceptContactRequestTypeID = 0xf831a20f
var (
_ bin .Encoder = &ContactsAcceptContactRequest {}
_ bin .Decoder = &ContactsAcceptContactRequest {}
_ bin .BareEncoder = &ContactsAcceptContactRequest {}
_ bin .BareDecoder = &ContactsAcceptContactRequest {}
)
func (a *ContactsAcceptContactRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .ID == nil ) {
return false
}
return true
}
func (a *ContactsAcceptContactRequest ) String () string {
if a == nil {
return "ContactsAcceptContactRequest(nil)"
}
type Alias ContactsAcceptContactRequest
return fmt .Sprintf ("ContactsAcceptContactRequest%+v" , Alias (*a ))
}
func (a *ContactsAcceptContactRequest ) FillFrom (from interface {
GetID () (value InputUserClass )
}) {
a .ID = from .GetID ()
}
func (*ContactsAcceptContactRequest ) TypeID () uint32 {
return ContactsAcceptContactRequestTypeID
}
func (*ContactsAcceptContactRequest ) TypeName () string {
return "contacts.acceptContact"
}
func (a *ContactsAcceptContactRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.acceptContact" ,
ID : ContactsAcceptContactRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
}
return typ
}
func (a *ContactsAcceptContactRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode contacts.acceptContact#f831a20f as nil" )
}
b .PutID (ContactsAcceptContactRequestTypeID )
return a .EncodeBare (b )
}
func (a *ContactsAcceptContactRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode contacts.acceptContact#f831a20f as nil" )
}
if a .ID == nil {
return fmt .Errorf ("unable to encode contacts.acceptContact#f831a20f: field id is nil" )
}
if err := a .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contacts.acceptContact#f831a20f: field id: %w" , err )
}
return nil
}
func (a *ContactsAcceptContactRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode contacts.acceptContact#f831a20f to nil" )
}
if err := b .ConsumeID (ContactsAcceptContactRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.acceptContact#f831a20f: %w" , err )
}
return a .DecodeBare (b )
}
func (a *ContactsAcceptContactRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode contacts.acceptContact#f831a20f to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode contacts.acceptContact#f831a20f: field id: %w" , err )
}
a .ID = value
}
return nil
}
func (a *ContactsAcceptContactRequest ) GetID () (value InputUserClass ) {
if a == nil {
return
}
return a .ID
}
func (c *Client ) ContactsAcceptContact (ctx context .Context , id InputUserClass ) (UpdatesClass , error ) {
var result UpdatesBox
request := &ContactsAcceptContactRequest {
ID : id ,
}
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , nil
}
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 .