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 PhotosGetUserPhotosRequest struct {
UserID InputUserClass
Offset int
MaxID int64
Limit int
}
const PhotosGetUserPhotosRequestTypeID = 0x91cd32a8
var (
_ bin .Encoder = &PhotosGetUserPhotosRequest {}
_ bin .Decoder = &PhotosGetUserPhotosRequest {}
_ bin .BareEncoder = &PhotosGetUserPhotosRequest {}
_ bin .BareDecoder = &PhotosGetUserPhotosRequest {}
)
func (g *PhotosGetUserPhotosRequest ) Zero () bool {
if g == nil {
return true
}
if !(g .UserID == nil ) {
return false
}
if !(g .Offset == 0 ) {
return false
}
if !(g .MaxID == 0 ) {
return false
}
if !(g .Limit == 0 ) {
return false
}
return true
}
func (g *PhotosGetUserPhotosRequest ) String () string {
if g == nil {
return "PhotosGetUserPhotosRequest(nil)"
}
type Alias PhotosGetUserPhotosRequest
return fmt .Sprintf ("PhotosGetUserPhotosRequest%+v" , Alias (*g ))
}
func (g *PhotosGetUserPhotosRequest ) FillFrom (from interface {
GetUserID () (value InputUserClass )
GetOffset () (value int )
GetMaxID () (value int64 )
GetLimit () (value int )
}) {
g .UserID = from .GetUserID ()
g .Offset = from .GetOffset ()
g .MaxID = from .GetMaxID ()
g .Limit = from .GetLimit ()
}
func (*PhotosGetUserPhotosRequest ) TypeID () uint32 {
return PhotosGetUserPhotosRequestTypeID
}
func (*PhotosGetUserPhotosRequest ) TypeName () string {
return "photos.getUserPhotos"
}
func (g *PhotosGetUserPhotosRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "photos.getUserPhotos" ,
ID : PhotosGetUserPhotosRequestTypeID ,
}
if g == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "UserID" ,
SchemaName : "user_id" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
{
Name : "MaxID" ,
SchemaName : "max_id" ,
},
{
Name : "Limit" ,
SchemaName : "limit" ,
},
}
return typ
}
func (g *PhotosGetUserPhotosRequest ) Encode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode photos.getUserPhotos#91cd32a8 as nil" )
}
b .PutID (PhotosGetUserPhotosRequestTypeID )
return g .EncodeBare (b )
}
func (g *PhotosGetUserPhotosRequest ) EncodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't encode photos.getUserPhotos#91cd32a8 as nil" )
}
if g .UserID == nil {
return fmt .Errorf ("unable to encode photos.getUserPhotos#91cd32a8: field user_id is nil" )
}
if err := g .UserID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode photos.getUserPhotos#91cd32a8: field user_id: %w" , err )
}
b .PutInt (g .Offset )
b .PutLong (g .MaxID )
b .PutInt (g .Limit )
return nil
}
func (g *PhotosGetUserPhotosRequest ) Decode (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode photos.getUserPhotos#91cd32a8 to nil" )
}
if err := b .ConsumeID (PhotosGetUserPhotosRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode photos.getUserPhotos#91cd32a8: %w" , err )
}
return g .DecodeBare (b )
}
func (g *PhotosGetUserPhotosRequest ) DecodeBare (b *bin .Buffer ) error {
if g == nil {
return fmt .Errorf ("can't decode photos.getUserPhotos#91cd32a8 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode photos.getUserPhotos#91cd32a8: field user_id: %w" , err )
}
g .UserID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode photos.getUserPhotos#91cd32a8: field offset: %w" , err )
}
g .Offset = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode photos.getUserPhotos#91cd32a8: field max_id: %w" , err )
}
g .MaxID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode photos.getUserPhotos#91cd32a8: field limit: %w" , err )
}
g .Limit = value
}
return nil
}
func (g *PhotosGetUserPhotosRequest ) GetUserID () (value InputUserClass ) {
if g == nil {
return
}
return g .UserID
}
func (g *PhotosGetUserPhotosRequest ) GetOffset () (value int ) {
if g == nil {
return
}
return g .Offset
}
func (g *PhotosGetUserPhotosRequest ) GetMaxID () (value int64 ) {
if g == nil {
return
}
return g .MaxID
}
func (g *PhotosGetUserPhotosRequest ) GetLimit () (value int ) {
if g == nil {
return
}
return g .Limit
}
func (c *Client ) PhotosGetUserPhotos (ctx context .Context , request *PhotosGetUserPhotosRequest ) (PhotosPhotosClass , error ) {
var result PhotosPhotosBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Photos , 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 .