178 lines
4.4 KiB
Go
Generated
178 lines
4.4 KiB
Go
Generated
// Code generated by gotdgen, DO NOT EDIT.
|
|
|
|
package tg
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"sort"
|
|
"strings"
|
|
|
|
"go.uber.org/multierr"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var (
|
|
_ = bin.Buffer{}
|
|
_ = context.Background()
|
|
_ = fmt.Stringer(nil)
|
|
_ = strings.Builder{}
|
|
_ = errors.Is
|
|
_ = multierr.AppendInto
|
|
_ = sort.Ints
|
|
_ = tdp.Format
|
|
_ = tgerr.Error{}
|
|
_ = tdjson.Encoder{}
|
|
)
|
|
|
|
// MessagesDeclineURLAuthRequest represents TL type `messages.declineUrlAuth#35436bbc`.
|
|
//
|
|
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
|
|
type MessagesDeclineURLAuthRequest struct {
|
|
// URL field of MessagesDeclineURLAuthRequest.
|
|
URL string
|
|
}
|
|
|
|
// MessagesDeclineURLAuthRequestTypeID is TL type id of MessagesDeclineURLAuthRequest.
|
|
const MessagesDeclineURLAuthRequestTypeID = 0x35436bbc
|
|
|
|
// Ensuring interfaces in compile-time for MessagesDeclineURLAuthRequest.
|
|
var (
|
|
_ bin.Encoder = &MessagesDeclineURLAuthRequest{}
|
|
_ bin.Decoder = &MessagesDeclineURLAuthRequest{}
|
|
_ bin.BareEncoder = &MessagesDeclineURLAuthRequest{}
|
|
_ bin.BareDecoder = &MessagesDeclineURLAuthRequest{}
|
|
)
|
|
|
|
func (d *MessagesDeclineURLAuthRequest) Zero() bool {
|
|
if d == nil {
|
|
return true
|
|
}
|
|
if !(d.URL == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (d *MessagesDeclineURLAuthRequest) String() string {
|
|
if d == nil {
|
|
return "MessagesDeclineURLAuthRequest(nil)"
|
|
}
|
|
type Alias MessagesDeclineURLAuthRequest
|
|
return fmt.Sprintf("MessagesDeclineURLAuthRequest%+v", Alias(*d))
|
|
}
|
|
|
|
// FillFrom fills MessagesDeclineURLAuthRequest from given interface.
|
|
func (d *MessagesDeclineURLAuthRequest) FillFrom(from interface {
|
|
GetURL() (value string)
|
|
}) {
|
|
d.URL = from.GetURL()
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*MessagesDeclineURLAuthRequest) TypeID() uint32 {
|
|
return MessagesDeclineURLAuthRequestTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*MessagesDeclineURLAuthRequest) TypeName() string {
|
|
return "messages.declineUrlAuth"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (d *MessagesDeclineURLAuthRequest) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "messages.declineUrlAuth",
|
|
ID: MessagesDeclineURLAuthRequestTypeID,
|
|
}
|
|
if d == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "URL",
|
|
SchemaName: "url",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (d *MessagesDeclineURLAuthRequest) Encode(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
|
|
}
|
|
b.PutID(MessagesDeclineURLAuthRequestTypeID)
|
|
return d.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (d *MessagesDeclineURLAuthRequest) EncodeBare(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't encode messages.declineUrlAuth#35436bbc as nil")
|
|
}
|
|
b.PutString(d.URL)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (d *MessagesDeclineURLAuthRequest) Decode(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil")
|
|
}
|
|
if err := b.ConsumeID(MessagesDeclineURLAuthRequestTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: %w", err)
|
|
}
|
|
return d.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (d *MessagesDeclineURLAuthRequest) DecodeBare(b *bin.Buffer) error {
|
|
if d == nil {
|
|
return fmt.Errorf("can't decode messages.declineUrlAuth#35436bbc to nil")
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode messages.declineUrlAuth#35436bbc: field url: %w", err)
|
|
}
|
|
d.URL = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// GetURL returns value of URL field.
|
|
func (d *MessagesDeclineURLAuthRequest) GetURL() (value string) {
|
|
if d == nil {
|
|
return
|
|
}
|
|
return d.URL
|
|
}
|
|
|
|
// MessagesDeclineURLAuth invokes method messages.declineUrlAuth#35436bbc returning error if any.
|
|
//
|
|
// See https://core.telegram.org/method/messages.declineUrlAuth for reference.
|
|
func (c *Client) MessagesDeclineURLAuth(ctx context.Context, url string) (bool, error) {
|
|
var result BoolBox
|
|
|
|
request := &MessagesDeclineURLAuthRequest{
|
|
URL: url,
|
|
}
|
|
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
|
return false, err
|
|
}
|
|
_, ok := result.Bool.(*BoolTrue)
|
|
return ok, nil
|
|
}
|