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 MediaAreaCoordinates struct {
X float64
Y float64
W float64
H float64
Rotation float64
}
const MediaAreaCoordinatesTypeID = 0x3d1ea4e
var (
_ bin .Encoder = &MediaAreaCoordinates {}
_ bin .Decoder = &MediaAreaCoordinates {}
_ bin .BareEncoder = &MediaAreaCoordinates {}
_ bin .BareDecoder = &MediaAreaCoordinates {}
)
func (m *MediaAreaCoordinates ) Zero () bool {
if m == nil {
return true
}
if !(m .X == 0 ) {
return false
}
if !(m .Y == 0 ) {
return false
}
if !(m .W == 0 ) {
return false
}
if !(m .H == 0 ) {
return false
}
if !(m .Rotation == 0 ) {
return false
}
return true
}
func (m *MediaAreaCoordinates ) String () string {
if m == nil {
return "MediaAreaCoordinates(nil)"
}
type Alias MediaAreaCoordinates
return fmt .Sprintf ("MediaAreaCoordinates%+v" , Alias (*m ))
}
func (m *MediaAreaCoordinates ) FillFrom (from interface {
GetX () (value float64 )
GetY () (value float64 )
GetW () (value float64 )
GetH () (value float64 )
GetRotation () (value float64 )
}) {
m .X = from .GetX ()
m .Y = from .GetY ()
m .W = from .GetW ()
m .H = from .GetH ()
m .Rotation = from .GetRotation ()
}
func (*MediaAreaCoordinates ) TypeID () uint32 {
return MediaAreaCoordinatesTypeID
}
func (*MediaAreaCoordinates ) TypeName () string {
return "mediaAreaCoordinates"
}
func (m *MediaAreaCoordinates ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "mediaAreaCoordinates" ,
ID : MediaAreaCoordinatesTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "X" ,
SchemaName : "x" ,
},
{
Name : "Y" ,
SchemaName : "y" ,
},
{
Name : "W" ,
SchemaName : "w" ,
},
{
Name : "H" ,
SchemaName : "h" ,
},
{
Name : "Rotation" ,
SchemaName : "rotation" ,
},
}
return typ
}
func (m *MediaAreaCoordinates ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode mediaAreaCoordinates#3d1ea4e as nil" )
}
b .PutID (MediaAreaCoordinatesTypeID )
return m .EncodeBare (b )
}
func (m *MediaAreaCoordinates ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode mediaAreaCoordinates#3d1ea4e as nil" )
}
b .PutDouble (m .X )
b .PutDouble (m .Y )
b .PutDouble (m .W )
b .PutDouble (m .H )
b .PutDouble (m .Rotation )
return nil
}
func (m *MediaAreaCoordinates ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode mediaAreaCoordinates#3d1ea4e to nil" )
}
if err := b .ConsumeID (MediaAreaCoordinatesTypeID ); err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MediaAreaCoordinates ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode mediaAreaCoordinates#3d1ea4e to nil" )
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: field x: %w" , err )
}
m .X = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: field y: %w" , err )
}
m .Y = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: field w: %w" , err )
}
m .W = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: field h: %w" , err )
}
m .H = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode mediaAreaCoordinates#3d1ea4e: field rotation: %w" , err )
}
m .Rotation = value
}
return nil
}
func (m *MediaAreaCoordinates ) GetX () (value float64 ) {
if m == nil {
return
}
return m .X
}
func (m *MediaAreaCoordinates ) GetY () (value float64 ) {
if m == nil {
return
}
return m .Y
}
func (m *MediaAreaCoordinates ) GetW () (value float64 ) {
if m == nil {
return
}
return m .W
}
func (m *MediaAreaCoordinates ) GetH () (value float64 ) {
if m == nil {
return
}
return m .H
}
func (m *MediaAreaCoordinates ) GetRotation () (value float64 ) {
if m == nil {
return
}
return m .Rotation
}
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 .