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 AccountReportProfilePhotoRequest struct {
Peer InputPeerClass
PhotoID InputPhotoClass
Reason ReportReasonClass
Message string
}
const AccountReportProfilePhotoRequestTypeID = 0xfa8cc6f5
var (
_ bin .Encoder = &AccountReportProfilePhotoRequest {}
_ bin .Decoder = &AccountReportProfilePhotoRequest {}
_ bin .BareEncoder = &AccountReportProfilePhotoRequest {}
_ bin .BareDecoder = &AccountReportProfilePhotoRequest {}
)
func (r *AccountReportProfilePhotoRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Peer == nil ) {
return false
}
if !(r .PhotoID == nil ) {
return false
}
if !(r .Reason == nil ) {
return false
}
if !(r .Message == "" ) {
return false
}
return true
}
func (r *AccountReportProfilePhotoRequest ) String () string {
if r == nil {
return "AccountReportProfilePhotoRequest(nil)"
}
type Alias AccountReportProfilePhotoRequest
return fmt .Sprintf ("AccountReportProfilePhotoRequest%+v" , Alias (*r ))
}
func (r *AccountReportProfilePhotoRequest ) FillFrom (from interface {
GetPeer () (value InputPeerClass )
GetPhotoID () (value InputPhotoClass )
GetReason () (value ReportReasonClass )
GetMessage () (value string )
}) {
r .Peer = from .GetPeer ()
r .PhotoID = from .GetPhotoID ()
r .Reason = from .GetReason ()
r .Message = from .GetMessage ()
}
func (*AccountReportProfilePhotoRequest ) TypeID () uint32 {
return AccountReportProfilePhotoRequestTypeID
}
func (*AccountReportProfilePhotoRequest ) TypeName () string {
return "account.reportProfilePhoto"
}
func (r *AccountReportProfilePhotoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "account.reportProfilePhoto" ,
ID : AccountReportProfilePhotoRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "PhotoID" ,
SchemaName : "photo_id" ,
},
{
Name : "Reason" ,
SchemaName : "reason" ,
},
{
Name : "Message" ,
SchemaName : "message" ,
},
}
return typ
}
func (r *AccountReportProfilePhotoRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.reportProfilePhoto#fa8cc6f5 as nil" )
}
b .PutID (AccountReportProfilePhotoRequestTypeID )
return r .EncodeBare (b )
}
func (r *AccountReportProfilePhotoRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode account.reportProfilePhoto#fa8cc6f5 as nil" )
}
if r .Peer == nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field peer is nil" )
}
if err := r .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field peer: %w" , err )
}
if r .PhotoID == nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field photo_id is nil" )
}
if err := r .PhotoID .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field photo_id: %w" , err )
}
if r .Reason == nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field reason is nil" )
}
if err := r .Reason .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode account.reportProfilePhoto#fa8cc6f5: field reason: %w" , err )
}
b .PutString (r .Message )
return nil
}
func (r *AccountReportProfilePhotoRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.reportProfilePhoto#fa8cc6f5 to nil" )
}
if err := b .ConsumeID (AccountReportProfilePhotoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode account.reportProfilePhoto#fa8cc6f5: %w" , err )
}
return r .DecodeBare (b )
}
func (r *AccountReportProfilePhotoRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode account.reportProfilePhoto#fa8cc6f5 to nil" )
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode account.reportProfilePhoto#fa8cc6f5: field peer: %w" , err )
}
r .Peer = value
}
{
value , err := DecodeInputPhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode account.reportProfilePhoto#fa8cc6f5: field photo_id: %w" , err )
}
r .PhotoID = value
}
{
value , err := DecodeReportReason (b )
if err != nil {
return fmt .Errorf ("unable to decode account.reportProfilePhoto#fa8cc6f5: field reason: %w" , err )
}
r .Reason = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode account.reportProfilePhoto#fa8cc6f5: field message: %w" , err )
}
r .Message = value
}
return nil
}
func (r *AccountReportProfilePhotoRequest ) GetPeer () (value InputPeerClass ) {
if r == nil {
return
}
return r .Peer
}
func (r *AccountReportProfilePhotoRequest ) GetPhotoID () (value InputPhotoClass ) {
if r == nil {
return
}
return r .PhotoID
}
func (r *AccountReportProfilePhotoRequest ) GetReason () (value ReportReasonClass ) {
if r == nil {
return
}
return r .Reason
}
func (r *AccountReportProfilePhotoRequest ) GetMessage () (value string ) {
if r == nil {
return
}
return r .Message
}
func (r *AccountReportProfilePhotoRequest ) GetPhotoIDAsNotEmpty () (*InputPhoto , bool ) {
return r .PhotoID .AsNotEmpty ()
}
func (c *Client ) AccountReportProfilePhoto (ctx context .Context , request *AccountReportProfilePhotoRequest ) (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.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 .