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 ContactsGetBlockedRequest struct {
Flags bin .Fields
MyStoriesFrom bool
Offset int
Limit int
}
const ContactsGetBlockedRequestTypeID = 0x9a868f80
var (
_ bin .Encoder = &ContactsGetBlockedRequest {}
_ bin .Decoder = &ContactsGetBlockedRequest {}
_ bin .BareEncoder = &ContactsGetBlockedRequest {}
_ bin .BareDecoder = &ContactsGetBlockedRequest {}
)
func (g *ContactsGetBlockedRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .Flags .Zero ()) {
return false
}
if !(g .MyStoriesFrom == false ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *ContactsGetBlockedRequest ) String () string {
if g == nil {
return "ContactsGetBlockedRequest(nil)"
}
type Alias ContactsGetBlockedRequest
return fmt .Sprintf ("ContactsGetBlockedRequest%+v" , Alias (*g ))
}
func (g *ContactsGetBlockedRequest ) FillFrom (from interface {
GetMyStoriesFrom () (value bool )
GetOffset () (value int )
GetLimit () (value int )
}) {
g .MyStoriesFrom = from .GetMyStoriesFrom ()
g .Offset = from .GetOffset ()
g .Limit = from .GetLimit ()
}
func (*ContactsGetBlockedRequest ) TypeID () uint32 {
return ContactsGetBlockedRequestTypeID
}
func (*ContactsGetBlockedRequest ) TypeName () string {
return "contacts.getBlocked"
}
func (g *ContactsGetBlockedRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "contacts.getBlocked" ,
ID : ContactsGetBlockedRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MyStoriesFrom" ,
SchemaName : "my_stories_from" ,
Null : !g .Flags .Has (0 ),
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *ContactsGetBlockedRequest ) SetFlags () {
if !(g .MyStoriesFrom == false ) {
g .Flags .Set (0 )
}
}
func (g *ContactsGetBlockedRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode contacts.getBlocked#9a868f80 as nil" )
}
b .PutID (ContactsGetBlockedRequestTypeID )
return g .EncodeBare (b )
}
func (g *ContactsGetBlockedRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode contacts.getBlocked#9a868f80 as nil" )
}
g .SetFlags ()
if err := g .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode contacts.getBlocked#9a868f80: field flags: %w" , err )
}
b .PutInt (g .Offset )
b .PutInt (g .Limit )
return nil
}
func (g *ContactsGetBlockedRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode contacts.getBlocked#9a868f80 to nil" )
}
if err := b .ConsumeID (ContactsGetBlockedRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode contacts.getBlocked#9a868f80: %w" , err )
}
return g .DecodeBare (b )
}
func (g *ContactsGetBlockedRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode contacts.getBlocked#9a868f80 to nil" )
}
{
if err := g .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode contacts.getBlocked#9a868f80: field flags: %w" , err )
}
}
g .MyStoriesFrom = g .Flags .Has (0 )
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.getBlocked#9a868f80: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode contacts.getBlocked#9a868f80: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *ContactsGetBlockedRequest ) SetMyStoriesFrom (value bool ) {
if value {
g .Flags .Set (0 )
g .MyStoriesFrom = true
} else {
g .Flags .Unset (0 )
g .MyStoriesFrom = false
}
}
func (g *ContactsGetBlockedRequest ) GetMyStoriesFrom () (value bool ) {
if g == nil {
return
}
return g .Flags .Has (0 )
}
func (g *ContactsGetBlockedRequest ) GetOffset () (value int ) {
if g == nil {
return
}
return g .Offset
}
func (g *ContactsGetBlockedRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) ContactsGetBlocked (ctx context .Context , request *ContactsGetBlockedRequest ) (ContactsBlockedClass , error ) {
var result ContactsBlockedBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Blocked , 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 .