gotd: update to layer 218
This commit is contained in:
Generated
+35
-13
@@ -32,27 +32,44 @@ var (
|
||||
)
|
||||
|
||||
// StarRefProgram represents TL type `starRefProgram#dd0c66f2`.
|
||||
// Indo about an affiliate program offered by a bot¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/bots/referrals
|
||||
//
|
||||
// See https://core.telegram.org/constructor/starRefProgram for reference.
|
||||
type StarRefProgram struct {
|
||||
// Flags field of StarRefProgram.
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// BotID field of StarRefProgram.
|
||||
// ID of the bot that offers the program
|
||||
BotID int64
|
||||
// CommissionPermille field of StarRefProgram.
|
||||
// An affiliate gets a commission of starRefProgram¹.commission_permille‰ Telegram
|
||||
// Stars² for every mini app transaction made by users they refer
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/constructor/starRefProgram
|
||||
// 2) https://core.telegram.org/api/stars
|
||||
CommissionPermille int
|
||||
// DurationMonths field of StarRefProgram.
|
||||
// An affiliate gets a commission for every mini app transaction made by users they refer
|
||||
// for duration_months months after a referral link is imported, starting the bot for
|
||||
// the first time
|
||||
//
|
||||
// Use SetDurationMonths and GetDurationMonths helpers.
|
||||
DurationMonths int
|
||||
// EndDate field of StarRefProgram.
|
||||
// Point in time (Unix timestamp) when the affiliate program will be closed (optional, if
|
||||
// not set the affiliate program isn't scheduled to be closed)
|
||||
//
|
||||
// Use SetEndDate and GetEndDate helpers.
|
||||
EndDate int
|
||||
// DailyRevenuePerUser field of StarRefProgram.
|
||||
// The amount of daily revenue per user in Telegram Stars of the bot that created the
|
||||
// affiliate program. To obtain the approximated revenue per referred user, multiply this
|
||||
// value by commission_permille and divide by 1000.
|
||||
//
|
||||
// Use SetDailyRevenuePerUser and GetDailyRevenuePerUser helpers.
|
||||
DailyRevenuePerUser StarsAmount
|
||||
DailyRevenuePerUser StarsAmountClass
|
||||
}
|
||||
|
||||
// StarRefProgramTypeID is TL type id of StarRefProgram.
|
||||
@@ -85,7 +102,7 @@ func (s *StarRefProgram) Zero() bool {
|
||||
if !(s.EndDate == 0) {
|
||||
return false
|
||||
}
|
||||
if !(s.DailyRevenuePerUser.Zero()) {
|
||||
if !(s.DailyRevenuePerUser == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -107,7 +124,7 @@ func (s *StarRefProgram) FillFrom(from interface {
|
||||
GetCommissionPermille() (value int)
|
||||
GetDurationMonths() (value int, ok bool)
|
||||
GetEndDate() (value int, ok bool)
|
||||
GetDailyRevenuePerUser() (value StarsAmount, ok bool)
|
||||
GetDailyRevenuePerUser() (value StarsAmountClass, ok bool)
|
||||
}) {
|
||||
s.BotID = from.GetBotID()
|
||||
s.CommissionPermille = from.GetCommissionPermille()
|
||||
@@ -183,7 +200,7 @@ func (s *StarRefProgram) SetFlags() {
|
||||
if !(s.EndDate == 0) {
|
||||
s.Flags.Set(1)
|
||||
}
|
||||
if !(s.DailyRevenuePerUser.Zero()) {
|
||||
if !(s.DailyRevenuePerUser == nil) {
|
||||
s.Flags.Set(2)
|
||||
}
|
||||
}
|
||||
@@ -215,6 +232,9 @@ func (s *StarRefProgram) EncodeBare(b *bin.Buffer) error {
|
||||
b.PutInt(s.EndDate)
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
if s.DailyRevenuePerUser == nil {
|
||||
return fmt.Errorf("unable to encode starRefProgram#dd0c66f2: field daily_revenue_per_user is nil")
|
||||
}
|
||||
if err := s.DailyRevenuePerUser.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode starRefProgram#dd0c66f2: field daily_revenue_per_user: %w", err)
|
||||
}
|
||||
@@ -272,9 +292,11 @@ func (s *StarRefProgram) DecodeBare(b *bin.Buffer) error {
|
||||
s.EndDate = value
|
||||
}
|
||||
if s.Flags.Has(2) {
|
||||
if err := s.DailyRevenuePerUser.Decode(b); err != nil {
|
||||
value, err := DecodeStarsAmount(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode starRefProgram#dd0c66f2: field daily_revenue_per_user: %w", err)
|
||||
}
|
||||
s.DailyRevenuePerUser = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -332,14 +354,14 @@ func (s *StarRefProgram) GetEndDate() (value int, ok bool) {
|
||||
}
|
||||
|
||||
// SetDailyRevenuePerUser sets value of DailyRevenuePerUser conditional field.
|
||||
func (s *StarRefProgram) SetDailyRevenuePerUser(value StarsAmount) {
|
||||
func (s *StarRefProgram) SetDailyRevenuePerUser(value StarsAmountClass) {
|
||||
s.Flags.Set(2)
|
||||
s.DailyRevenuePerUser = value
|
||||
}
|
||||
|
||||
// GetDailyRevenuePerUser returns value of DailyRevenuePerUser conditional field and
|
||||
// boolean which is true if field was set.
|
||||
func (s *StarRefProgram) GetDailyRevenuePerUser() (value StarsAmount, ok bool) {
|
||||
func (s *StarRefProgram) GetDailyRevenuePerUser() (value StarsAmountClass, ok bool) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user