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 ContactsUpdateContactNoteRequest struct {
ID InputUserClass
Note TextWithEntities
}
const ContactsUpdateContactNoteRequestTypeID = 0x139f63fb
var (
_ bin .Encoder = &ContactsUpdateContactNoteRequest {}
_ bin .Decoder = &ContactsUpdateContactNoteRequest {}
_ bin .BareEncoder = &ContactsUpdateContactNoteRequest {}
_ bin .BareDecoder = &ContactsUpdateContactNoteRequest {}
)
func (u *ContactsUpdateContactNoteRequest ) Zero () bool {
if u == nil {
return true
}
if !(u .ID == nil ) {
return false
}
if !(u .Note .Zero ()) {
return false
}
return true
}
func (u *ContactsUpdateContactNoteRequest ) String () string {
if u == nil {
return "ContactsUpdateContactNoteRequest(nil)"
}
type Alias ContactsUpdateContactNoteRequest
return fmt .Sprintf ("ContactsUpdateContactNoteRequest%+v" , Alias (*u ))
}
func (u *ContactsUpdateContactNoteRequest ) FillFrom (from interface {
GetID () (value InputUserClass )
GetNote () (value TextWithEntities )
}) {
u .ID = from .GetID ()
u .Note = from .GetNote ()
}
func (*ContactsUpdateContactNoteRequest ) TypeID () uint32 {
return ContactsUpdateContactNoteRequestTypeID
}
func (*ContactsUpdateContactNoteRequest ) TypeName () string {
return "contacts.updateContactNote"
}
func (u *ContactsUpdateContactNoteRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.updateContactNote" ,
ID : ContactsUpdateContactNoteRequestTypeID ,
}
if u == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Note" ,
SchemaName : "note" ,
},
}
return typ
}
func (u *ContactsUpdateContactNoteRequest ) Encode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode contacts.updateContactNote#139f63fb as nil" )
}
b .PutID (ContactsUpdateContactNoteRequestTypeID )
return u .EncodeBare (b )
}
func (u *ContactsUpdateContactNoteRequest ) EncodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't encode contacts.updateContactNote#139f63fb as nil" )
}
if u .ID == nil {
return fmt .Errorf ("unable to encode contacts.updateContactNote#139f63fb: field id is nil" )
}
if err := u .ID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contacts.updateContactNote#139f63fb: field id: %w" , err )
}
if err := u .Note .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contacts.updateContactNote#139f63fb: field note: %w" , err )
}
return nil
}
func (u *ContactsUpdateContactNoteRequest ) Decode (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode contacts.updateContactNote#139f63fb to nil" )
}
if err := b .ConsumeID (ContactsUpdateContactNoteRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.updateContactNote#139f63fb: %w" , err )
}
return u .DecodeBare (b )
}
func (u *ContactsUpdateContactNoteRequest ) DecodeBare (b *bin .Buffer ) error {
if u == nil {
return fmt .Errorf ("can't decode contacts.updateContactNote#139f63fb to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode contacts.updateContactNote#139f63fb: field id: %w" , err )
}
u .ID = value
}
{
if err := u .Note .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode contacts.updateContactNote#139f63fb: field note: %w" , err )
}
}
return nil
}
func (u *ContactsUpdateContactNoteRequest ) GetID () (value InputUserClass ) {
if u == nil {
return
}
return u .ID
}
func (u *ContactsUpdateContactNoteRequest ) GetNote () (value TextWithEntities ) {
if u == nil {
return
}
return u .Note
}
func (c *Client ) ContactsUpdateContactNote (ctx context .Context , request *ContactsUpdateContactNoteRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , nil
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .