3000 lines
74 KiB
Go
Generated
3000 lines
74 KiB
Go
Generated
// Code generated by itergen, DO NOT EDIT.
|
|
|
|
package cached
|
|
|
|
import (
|
|
"context"
|
|
"sync/atomic"
|
|
|
|
"github.com/go-faster/errors"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
|
|
)
|
|
|
|
// No-op definition for keeping imports.
|
|
var _ = context.Background()
|
|
|
|
type innerAccountGetChannelDefaultEmojiStatuses struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountEmojiStatuses
|
|
}
|
|
|
|
type AccountGetChannelDefaultEmojiStatuses struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetChannelDefaultEmojiStatuses creates new AccountGetChannelDefaultEmojiStatuses.
|
|
func NewAccountGetChannelDefaultEmojiStatuses(raw *tg.Client) *AccountGetChannelDefaultEmojiStatuses {
|
|
q := &AccountGetChannelDefaultEmojiStatuses{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) store(v innerAccountGetChannelDefaultEmojiStatuses) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) load() (innerAccountGetChannelDefaultEmojiStatuses, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetChannelDefaultEmojiStatuses)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountEmojiStatuses must not be mutated.
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) Value() *tg.AccountEmojiStatuses {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) Get(ctx context.Context) (*tg.AccountEmojiStatuses, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetChannelDefaultEmojiStatuses) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetChannelDefaultEmojiStatuses(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetChannelDefaultEmojiStatuses")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountEmojiStatuses:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetChannelDefaultEmojiStatuses{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountEmojiStatusesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetChannelRestrictedStatusEmojis struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.EmojiList
|
|
}
|
|
|
|
type AccountGetChannelRestrictedStatusEmojis struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetChannelRestrictedStatusEmojis creates new AccountGetChannelRestrictedStatusEmojis.
|
|
func NewAccountGetChannelRestrictedStatusEmojis(raw *tg.Client) *AccountGetChannelRestrictedStatusEmojis {
|
|
q := &AccountGetChannelRestrictedStatusEmojis{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) store(v innerAccountGetChannelRestrictedStatusEmojis) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) load() (innerAccountGetChannelRestrictedStatusEmojis, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetChannelRestrictedStatusEmojis)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned EmojiList must not be mutated.
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) Value() *tg.EmojiList {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) Get(ctx context.Context) (*tg.EmojiList, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetChannelRestrictedStatusEmojis) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetChannelRestrictedStatusEmojis(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetChannelRestrictedStatusEmojis")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.EmojiList:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetChannelRestrictedStatusEmojis{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.EmojiListNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetChatThemes struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountThemes
|
|
}
|
|
|
|
type AccountGetChatThemes struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetChatThemes creates new AccountGetChatThemes.
|
|
func NewAccountGetChatThemes(raw *tg.Client) *AccountGetChatThemes {
|
|
q := &AccountGetChatThemes{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetChatThemes) store(v innerAccountGetChatThemes) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetChatThemes) load() (innerAccountGetChatThemes, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetChatThemes)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountThemes must not be mutated.
|
|
func (s *AccountGetChatThemes) Value() *tg.AccountThemes {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetChatThemes) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetChatThemes) Get(ctx context.Context) (*tg.AccountThemes, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetChatThemes) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetChatThemes(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetChatThemes")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountThemes:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetChatThemes{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountThemesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetCollectibleEmojiStatuses struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountEmojiStatuses
|
|
}
|
|
|
|
type AccountGetCollectibleEmojiStatuses struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetCollectibleEmojiStatuses creates new AccountGetCollectibleEmojiStatuses.
|
|
func NewAccountGetCollectibleEmojiStatuses(raw *tg.Client) *AccountGetCollectibleEmojiStatuses {
|
|
q := &AccountGetCollectibleEmojiStatuses{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetCollectibleEmojiStatuses) store(v innerAccountGetCollectibleEmojiStatuses) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetCollectibleEmojiStatuses) load() (innerAccountGetCollectibleEmojiStatuses, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetCollectibleEmojiStatuses)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountEmojiStatuses must not be mutated.
|
|
func (s *AccountGetCollectibleEmojiStatuses) Value() *tg.AccountEmojiStatuses {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetCollectibleEmojiStatuses) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetCollectibleEmojiStatuses) Get(ctx context.Context) (*tg.AccountEmojiStatuses, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetCollectibleEmojiStatuses) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetCollectibleEmojiStatuses(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetCollectibleEmojiStatuses")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountEmojiStatuses:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetCollectibleEmojiStatuses{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountEmojiStatusesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetDefaultBackgroundEmojis struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.EmojiList
|
|
}
|
|
|
|
type AccountGetDefaultBackgroundEmojis struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetDefaultBackgroundEmojis creates new AccountGetDefaultBackgroundEmojis.
|
|
func NewAccountGetDefaultBackgroundEmojis(raw *tg.Client) *AccountGetDefaultBackgroundEmojis {
|
|
q := &AccountGetDefaultBackgroundEmojis{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetDefaultBackgroundEmojis) store(v innerAccountGetDefaultBackgroundEmojis) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetDefaultBackgroundEmojis) load() (innerAccountGetDefaultBackgroundEmojis, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetDefaultBackgroundEmojis)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned EmojiList must not be mutated.
|
|
func (s *AccountGetDefaultBackgroundEmojis) Value() *tg.EmojiList {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetDefaultBackgroundEmojis) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetDefaultBackgroundEmojis) Get(ctx context.Context) (*tg.EmojiList, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetDefaultBackgroundEmojis) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetDefaultBackgroundEmojis(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetDefaultBackgroundEmojis")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.EmojiList:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetDefaultBackgroundEmojis{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.EmojiListNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetDefaultEmojiStatuses struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountEmojiStatuses
|
|
}
|
|
|
|
type AccountGetDefaultEmojiStatuses struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetDefaultEmojiStatuses creates new AccountGetDefaultEmojiStatuses.
|
|
func NewAccountGetDefaultEmojiStatuses(raw *tg.Client) *AccountGetDefaultEmojiStatuses {
|
|
q := &AccountGetDefaultEmojiStatuses{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetDefaultEmojiStatuses) store(v innerAccountGetDefaultEmojiStatuses) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetDefaultEmojiStatuses) load() (innerAccountGetDefaultEmojiStatuses, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetDefaultEmojiStatuses)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountEmojiStatuses must not be mutated.
|
|
func (s *AccountGetDefaultEmojiStatuses) Value() *tg.AccountEmojiStatuses {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetDefaultEmojiStatuses) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetDefaultEmojiStatuses) Get(ctx context.Context) (*tg.AccountEmojiStatuses, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetDefaultEmojiStatuses) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetDefaultEmojiStatuses(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetDefaultEmojiStatuses")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountEmojiStatuses:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetDefaultEmojiStatuses{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountEmojiStatusesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetDefaultGroupPhotoEmojis struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.EmojiList
|
|
}
|
|
|
|
type AccountGetDefaultGroupPhotoEmojis struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetDefaultGroupPhotoEmojis creates new AccountGetDefaultGroupPhotoEmojis.
|
|
func NewAccountGetDefaultGroupPhotoEmojis(raw *tg.Client) *AccountGetDefaultGroupPhotoEmojis {
|
|
q := &AccountGetDefaultGroupPhotoEmojis{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) store(v innerAccountGetDefaultGroupPhotoEmojis) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) load() (innerAccountGetDefaultGroupPhotoEmojis, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetDefaultGroupPhotoEmojis)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned EmojiList must not be mutated.
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) Value() *tg.EmojiList {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) Get(ctx context.Context) (*tg.EmojiList, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetDefaultGroupPhotoEmojis) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetDefaultGroupPhotoEmojis(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetDefaultGroupPhotoEmojis")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.EmojiList:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetDefaultGroupPhotoEmojis{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.EmojiListNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetDefaultProfilePhotoEmojis struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.EmojiList
|
|
}
|
|
|
|
type AccountGetDefaultProfilePhotoEmojis struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetDefaultProfilePhotoEmojis creates new AccountGetDefaultProfilePhotoEmojis.
|
|
func NewAccountGetDefaultProfilePhotoEmojis(raw *tg.Client) *AccountGetDefaultProfilePhotoEmojis {
|
|
q := &AccountGetDefaultProfilePhotoEmojis{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) store(v innerAccountGetDefaultProfilePhotoEmojis) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) load() (innerAccountGetDefaultProfilePhotoEmojis, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetDefaultProfilePhotoEmojis)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned EmojiList must not be mutated.
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) Value() *tg.EmojiList {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) Get(ctx context.Context) (*tg.EmojiList, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetDefaultProfilePhotoEmojis) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetDefaultProfilePhotoEmojis(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetDefaultProfilePhotoEmojis")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.EmojiList:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetDefaultProfilePhotoEmojis{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.EmojiListNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetRecentEmojiStatuses struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountEmojiStatuses
|
|
}
|
|
|
|
type AccountGetRecentEmojiStatuses struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetRecentEmojiStatuses creates new AccountGetRecentEmojiStatuses.
|
|
func NewAccountGetRecentEmojiStatuses(raw *tg.Client) *AccountGetRecentEmojiStatuses {
|
|
q := &AccountGetRecentEmojiStatuses{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetRecentEmojiStatuses) store(v innerAccountGetRecentEmojiStatuses) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetRecentEmojiStatuses) load() (innerAccountGetRecentEmojiStatuses, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetRecentEmojiStatuses)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountEmojiStatuses must not be mutated.
|
|
func (s *AccountGetRecentEmojiStatuses) Value() *tg.AccountEmojiStatuses {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetRecentEmojiStatuses) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetRecentEmojiStatuses) Get(ctx context.Context) (*tg.AccountEmojiStatuses, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetRecentEmojiStatuses) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetRecentEmojiStatuses(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetRecentEmojiStatuses")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountEmojiStatuses:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetRecentEmojiStatuses{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountEmojiStatusesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetSavedMusicIDs struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountSavedMusicIDs
|
|
}
|
|
|
|
type AccountGetSavedMusicIDs struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetSavedMusicIDs creates new AccountGetSavedMusicIDs.
|
|
func NewAccountGetSavedMusicIDs(raw *tg.Client) *AccountGetSavedMusicIDs {
|
|
q := &AccountGetSavedMusicIDs{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetSavedMusicIDs) store(v innerAccountGetSavedMusicIDs) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetSavedMusicIDs) load() (innerAccountGetSavedMusicIDs, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetSavedMusicIDs)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountSavedMusicIDs must not be mutated.
|
|
func (s *AccountGetSavedMusicIDs) Value() *tg.AccountSavedMusicIDs {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetSavedMusicIDs) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetSavedMusicIDs) Get(ctx context.Context) (*tg.AccountSavedMusicIDs, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetSavedMusicIDs) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetSavedMusicIDs(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetSavedMusicIDs")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountSavedMusicIDs:
|
|
hash := s.computeHash(variant)
|
|
|
|
s.store(innerAccountGetSavedMusicIDs{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountSavedMusicIDsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetSavedRingtones struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountSavedRingtones
|
|
}
|
|
|
|
type AccountGetSavedRingtones struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetSavedRingtones creates new AccountGetSavedRingtones.
|
|
func NewAccountGetSavedRingtones(raw *tg.Client) *AccountGetSavedRingtones {
|
|
q := &AccountGetSavedRingtones{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetSavedRingtones) store(v innerAccountGetSavedRingtones) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetSavedRingtones) load() (innerAccountGetSavedRingtones, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetSavedRingtones)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountSavedRingtones must not be mutated.
|
|
func (s *AccountGetSavedRingtones) Value() *tg.AccountSavedRingtones {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetSavedRingtones) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetSavedRingtones) Get(ctx context.Context) (*tg.AccountSavedRingtones, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetSavedRingtones) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetSavedRingtones(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetSavedRingtones")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountSavedRingtones:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetSavedRingtones{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountSavedRingtonesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetThemes struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountThemes
|
|
}
|
|
|
|
type AccountGetThemes struct {
|
|
// Query to send.
|
|
req *tg.AccountGetThemesRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetThemes creates new AccountGetThemes.
|
|
func NewAccountGetThemes(raw *tg.Client, initial *tg.AccountGetThemesRequest) *AccountGetThemes {
|
|
q := &AccountGetThemes{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetThemes) store(v innerAccountGetThemes) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetThemes) load() (innerAccountGetThemes, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetThemes)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountThemes must not be mutated.
|
|
func (s *AccountGetThemes) Value() *tg.AccountThemes {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetThemes) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetThemes) Get(ctx context.Context) (*tg.AccountThemes, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetThemes) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.AccountGetThemes(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetThemes")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountThemes:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetThemes{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountThemesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerAccountGetWallPapers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AccountWallPapers
|
|
}
|
|
|
|
type AccountGetWallPapers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewAccountGetWallPapers creates new AccountGetWallPapers.
|
|
func NewAccountGetWallPapers(raw *tg.Client) *AccountGetWallPapers {
|
|
q := &AccountGetWallPapers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *AccountGetWallPapers) store(v innerAccountGetWallPapers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *AccountGetWallPapers) load() (innerAccountGetWallPapers, bool) {
|
|
v, ok := s.last.Load().(innerAccountGetWallPapers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AccountWallPapers must not be mutated.
|
|
func (s *AccountGetWallPapers) Value() *tg.AccountWallPapers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *AccountGetWallPapers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *AccountGetWallPapers) Get(ctx context.Context) (*tg.AccountWallPapers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *AccountGetWallPapers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.AccountGetWallPapers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute AccountGetWallPapers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AccountWallPapers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerAccountGetWallPapers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AccountWallPapersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerContactsGetContacts struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.ContactsContacts
|
|
}
|
|
|
|
type ContactsGetContacts struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewContactsGetContacts creates new ContactsGetContacts.
|
|
func NewContactsGetContacts(raw *tg.Client) *ContactsGetContacts {
|
|
q := &ContactsGetContacts{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *ContactsGetContacts) store(v innerContactsGetContacts) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *ContactsGetContacts) load() (innerContactsGetContacts, bool) {
|
|
v, ok := s.last.Load().(innerContactsGetContacts)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned ContactsContacts must not be mutated.
|
|
func (s *ContactsGetContacts) Value() *tg.ContactsContacts {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *ContactsGetContacts) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *ContactsGetContacts) Get(ctx context.Context) (*tg.ContactsContacts, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *ContactsGetContacts) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.ContactsGetContacts(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute ContactsGetContacts")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.ContactsContacts:
|
|
hash := s.computeHash(variant)
|
|
|
|
s.store(innerContactsGetContacts{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.ContactsContactsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetAllStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesAllStickers
|
|
}
|
|
|
|
type MessagesGetAllStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetAllStickers creates new MessagesGetAllStickers.
|
|
func NewMessagesGetAllStickers(raw *tg.Client) *MessagesGetAllStickers {
|
|
q := &MessagesGetAllStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetAllStickers) store(v innerMessagesGetAllStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetAllStickers) load() (innerMessagesGetAllStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetAllStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesAllStickers must not be mutated.
|
|
func (s *MessagesGetAllStickers) Value() *tg.MessagesAllStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetAllStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetAllStickers) Get(ctx context.Context) (*tg.MessagesAllStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetAllStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetAllStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetAllStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesAllStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetAllStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesAllStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetAttachMenuBots struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.AttachMenuBots
|
|
}
|
|
|
|
type MessagesGetAttachMenuBots struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetAttachMenuBots creates new MessagesGetAttachMenuBots.
|
|
func NewMessagesGetAttachMenuBots(raw *tg.Client) *MessagesGetAttachMenuBots {
|
|
q := &MessagesGetAttachMenuBots{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetAttachMenuBots) store(v innerMessagesGetAttachMenuBots) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetAttachMenuBots) load() (innerMessagesGetAttachMenuBots, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetAttachMenuBots)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned AttachMenuBots must not be mutated.
|
|
func (s *MessagesGetAttachMenuBots) Value() *tg.AttachMenuBots {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetAttachMenuBots) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetAttachMenuBots) Get(ctx context.Context) (*tg.AttachMenuBots, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetAttachMenuBots) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetAttachMenuBots(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetAttachMenuBots")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.AttachMenuBots:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetAttachMenuBots{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.AttachMenuBotsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetDefaultTagReactions struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesReactions
|
|
}
|
|
|
|
type MessagesGetDefaultTagReactions struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetDefaultTagReactions creates new MessagesGetDefaultTagReactions.
|
|
func NewMessagesGetDefaultTagReactions(raw *tg.Client) *MessagesGetDefaultTagReactions {
|
|
q := &MessagesGetDefaultTagReactions{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetDefaultTagReactions) store(v innerMessagesGetDefaultTagReactions) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetDefaultTagReactions) load() (innerMessagesGetDefaultTagReactions, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetDefaultTagReactions)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesReactions must not be mutated.
|
|
func (s *MessagesGetDefaultTagReactions) Value() *tg.MessagesReactions {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetDefaultTagReactions) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetDefaultTagReactions) Get(ctx context.Context) (*tg.MessagesReactions, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetDefaultTagReactions) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetDefaultTagReactions(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetDefaultTagReactions")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesReactions:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetDefaultTagReactions{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesReactionsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetEmojiStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesAllStickers
|
|
}
|
|
|
|
type MessagesGetEmojiStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetEmojiStickers creates new MessagesGetEmojiStickers.
|
|
func NewMessagesGetEmojiStickers(raw *tg.Client) *MessagesGetEmojiStickers {
|
|
q := &MessagesGetEmojiStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetEmojiStickers) store(v innerMessagesGetEmojiStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetEmojiStickers) load() (innerMessagesGetEmojiStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetEmojiStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesAllStickers must not be mutated.
|
|
func (s *MessagesGetEmojiStickers) Value() *tg.MessagesAllStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetEmojiStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetEmojiStickers) Get(ctx context.Context) (*tg.MessagesAllStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetEmojiStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetEmojiStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetEmojiStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesAllStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetEmojiStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesAllStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetFavedStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesFavedStickers
|
|
}
|
|
|
|
type MessagesGetFavedStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetFavedStickers creates new MessagesGetFavedStickers.
|
|
func NewMessagesGetFavedStickers(raw *tg.Client) *MessagesGetFavedStickers {
|
|
q := &MessagesGetFavedStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetFavedStickers) store(v innerMessagesGetFavedStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetFavedStickers) load() (innerMessagesGetFavedStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetFavedStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesFavedStickers must not be mutated.
|
|
func (s *MessagesGetFavedStickers) Value() *tg.MessagesFavedStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetFavedStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetFavedStickers) Get(ctx context.Context) (*tg.MessagesFavedStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetFavedStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetFavedStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetFavedStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesFavedStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetFavedStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesFavedStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetFeaturedEmojiStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesFeaturedStickers
|
|
}
|
|
|
|
type MessagesGetFeaturedEmojiStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetFeaturedEmojiStickers creates new MessagesGetFeaturedEmojiStickers.
|
|
func NewMessagesGetFeaturedEmojiStickers(raw *tg.Client) *MessagesGetFeaturedEmojiStickers {
|
|
q := &MessagesGetFeaturedEmojiStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetFeaturedEmojiStickers) store(v innerMessagesGetFeaturedEmojiStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetFeaturedEmojiStickers) load() (innerMessagesGetFeaturedEmojiStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetFeaturedEmojiStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesFeaturedStickers must not be mutated.
|
|
func (s *MessagesGetFeaturedEmojiStickers) Value() *tg.MessagesFeaturedStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetFeaturedEmojiStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetFeaturedEmojiStickers) Get(ctx context.Context) (*tg.MessagesFeaturedStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetFeaturedEmojiStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetFeaturedEmojiStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetFeaturedEmojiStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesFeaturedStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetFeaturedEmojiStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesFeaturedStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetFeaturedStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesFeaturedStickers
|
|
}
|
|
|
|
type MessagesGetFeaturedStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetFeaturedStickers creates new MessagesGetFeaturedStickers.
|
|
func NewMessagesGetFeaturedStickers(raw *tg.Client) *MessagesGetFeaturedStickers {
|
|
q := &MessagesGetFeaturedStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetFeaturedStickers) store(v innerMessagesGetFeaturedStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetFeaturedStickers) load() (innerMessagesGetFeaturedStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetFeaturedStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesFeaturedStickers must not be mutated.
|
|
func (s *MessagesGetFeaturedStickers) Value() *tg.MessagesFeaturedStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetFeaturedStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetFeaturedStickers) Get(ctx context.Context) (*tg.MessagesFeaturedStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetFeaturedStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetFeaturedStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetFeaturedStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesFeaturedStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetFeaturedStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesFeaturedStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetMaskStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesAllStickers
|
|
}
|
|
|
|
type MessagesGetMaskStickers struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetMaskStickers creates new MessagesGetMaskStickers.
|
|
func NewMessagesGetMaskStickers(raw *tg.Client) *MessagesGetMaskStickers {
|
|
q := &MessagesGetMaskStickers{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetMaskStickers) store(v innerMessagesGetMaskStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetMaskStickers) load() (innerMessagesGetMaskStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetMaskStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesAllStickers must not be mutated.
|
|
func (s *MessagesGetMaskStickers) Value() *tg.MessagesAllStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetMaskStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetMaskStickers) Get(ctx context.Context) (*tg.MessagesAllStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetMaskStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetMaskStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetMaskStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesAllStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetMaskStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesAllStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetQuickReplies struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesQuickReplies
|
|
}
|
|
|
|
type MessagesGetQuickReplies struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetQuickReplies creates new MessagesGetQuickReplies.
|
|
func NewMessagesGetQuickReplies(raw *tg.Client) *MessagesGetQuickReplies {
|
|
q := &MessagesGetQuickReplies{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetQuickReplies) store(v innerMessagesGetQuickReplies) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetQuickReplies) load() (innerMessagesGetQuickReplies, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetQuickReplies)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesQuickReplies must not be mutated.
|
|
func (s *MessagesGetQuickReplies) Value() *tg.MessagesQuickReplies {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetQuickReplies) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetQuickReplies) Get(ctx context.Context) (*tg.MessagesQuickReplies, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetQuickReplies) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetQuickReplies(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetQuickReplies")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesQuickReplies:
|
|
hash := s.computeHash(variant)
|
|
|
|
s.store(innerMessagesGetQuickReplies{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesQuickRepliesNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetRecentReactions struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesReactions
|
|
}
|
|
|
|
type MessagesGetRecentReactions struct {
|
|
// Query to send.
|
|
req *tg.MessagesGetRecentReactionsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetRecentReactions creates new MessagesGetRecentReactions.
|
|
func NewMessagesGetRecentReactions(raw *tg.Client, initial *tg.MessagesGetRecentReactionsRequest) *MessagesGetRecentReactions {
|
|
q := &MessagesGetRecentReactions{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetRecentReactions) store(v innerMessagesGetRecentReactions) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetRecentReactions) load() (innerMessagesGetRecentReactions, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetRecentReactions)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesReactions must not be mutated.
|
|
func (s *MessagesGetRecentReactions) Value() *tg.MessagesReactions {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetRecentReactions) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetRecentReactions) Get(ctx context.Context) (*tg.MessagesReactions, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetRecentReactions) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesGetRecentReactions(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetRecentReactions")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesReactions:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetRecentReactions{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesReactionsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetRecentStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesRecentStickers
|
|
}
|
|
|
|
type MessagesGetRecentStickers struct {
|
|
// Query to send.
|
|
req *tg.MessagesGetRecentStickersRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetRecentStickers creates new MessagesGetRecentStickers.
|
|
func NewMessagesGetRecentStickers(raw *tg.Client, initial *tg.MessagesGetRecentStickersRequest) *MessagesGetRecentStickers {
|
|
q := &MessagesGetRecentStickers{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetRecentStickers) store(v innerMessagesGetRecentStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetRecentStickers) load() (innerMessagesGetRecentStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetRecentStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesRecentStickers must not be mutated.
|
|
func (s *MessagesGetRecentStickers) Value() *tg.MessagesRecentStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetRecentStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetRecentStickers) Get(ctx context.Context) (*tg.MessagesRecentStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetRecentStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesGetRecentStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetRecentStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesRecentStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetRecentStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesRecentStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetSavedGifs struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesSavedGifs
|
|
}
|
|
|
|
type MessagesGetSavedGifs struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetSavedGifs creates new MessagesGetSavedGifs.
|
|
func NewMessagesGetSavedGifs(raw *tg.Client) *MessagesGetSavedGifs {
|
|
q := &MessagesGetSavedGifs{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetSavedGifs) store(v innerMessagesGetSavedGifs) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetSavedGifs) load() (innerMessagesGetSavedGifs, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetSavedGifs)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesSavedGifs must not be mutated.
|
|
func (s *MessagesGetSavedGifs) Value() *tg.MessagesSavedGifs {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetSavedGifs) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetSavedGifs) Get(ctx context.Context) (*tg.MessagesSavedGifs, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetSavedGifs) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.MessagesGetSavedGifs(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetSavedGifs")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesSavedGifs:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetSavedGifs{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesSavedGifsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetSavedReactionTags struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesSavedReactionTags
|
|
}
|
|
|
|
type MessagesGetSavedReactionTags struct {
|
|
// Query to send.
|
|
req *tg.MessagesGetSavedReactionTagsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetSavedReactionTags creates new MessagesGetSavedReactionTags.
|
|
func NewMessagesGetSavedReactionTags(raw *tg.Client, initial *tg.MessagesGetSavedReactionTagsRequest) *MessagesGetSavedReactionTags {
|
|
q := &MessagesGetSavedReactionTags{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetSavedReactionTags) store(v innerMessagesGetSavedReactionTags) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetSavedReactionTags) load() (innerMessagesGetSavedReactionTags, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetSavedReactionTags)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesSavedReactionTags must not be mutated.
|
|
func (s *MessagesGetSavedReactionTags) Value() *tg.MessagesSavedReactionTags {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetSavedReactionTags) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetSavedReactionTags) Get(ctx context.Context) (*tg.MessagesSavedReactionTags, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetSavedReactionTags) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesGetSavedReactionTags(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetSavedReactionTags")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesSavedReactionTags:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetSavedReactionTags{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesSavedReactionTagsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetStickers struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesStickers
|
|
}
|
|
|
|
type MessagesGetStickers struct {
|
|
// Query to send.
|
|
req *tg.MessagesGetStickersRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetStickers creates new MessagesGetStickers.
|
|
func NewMessagesGetStickers(raw *tg.Client, initial *tg.MessagesGetStickersRequest) *MessagesGetStickers {
|
|
q := &MessagesGetStickers{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetStickers) store(v innerMessagesGetStickers) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetStickers) load() (innerMessagesGetStickers, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetStickers)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesStickers must not be mutated.
|
|
func (s *MessagesGetStickers) Value() *tg.MessagesStickers {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetStickers) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetStickers) Get(ctx context.Context) (*tg.MessagesStickers, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetStickers) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesGetStickers(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetStickers")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesStickers:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetStickers{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesStickersNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesGetTopReactions struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesReactions
|
|
}
|
|
|
|
type MessagesGetTopReactions struct {
|
|
// Query to send.
|
|
req *tg.MessagesGetTopReactionsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesGetTopReactions creates new MessagesGetTopReactions.
|
|
func NewMessagesGetTopReactions(raw *tg.Client, initial *tg.MessagesGetTopReactionsRequest) *MessagesGetTopReactions {
|
|
q := &MessagesGetTopReactions{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesGetTopReactions) store(v innerMessagesGetTopReactions) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesGetTopReactions) load() (innerMessagesGetTopReactions, bool) {
|
|
v, ok := s.last.Load().(innerMessagesGetTopReactions)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesReactions must not be mutated.
|
|
func (s *MessagesGetTopReactions) Value() *tg.MessagesReactions {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesGetTopReactions) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesGetTopReactions) Get(ctx context.Context) (*tg.MessagesReactions, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesGetTopReactions) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesGetTopReactions(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesGetTopReactions")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesReactions:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesGetTopReactions{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesReactionsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesSearchCustomEmoji struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.EmojiList
|
|
}
|
|
|
|
type MessagesSearchCustomEmoji struct {
|
|
// Query to send.
|
|
req *tg.MessagesSearchCustomEmojiRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesSearchCustomEmoji creates new MessagesSearchCustomEmoji.
|
|
func NewMessagesSearchCustomEmoji(raw *tg.Client, initial *tg.MessagesSearchCustomEmojiRequest) *MessagesSearchCustomEmoji {
|
|
q := &MessagesSearchCustomEmoji{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesSearchCustomEmoji) store(v innerMessagesSearchCustomEmoji) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesSearchCustomEmoji) load() (innerMessagesSearchCustomEmoji, bool) {
|
|
v, ok := s.last.Load().(innerMessagesSearchCustomEmoji)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned EmojiList must not be mutated.
|
|
func (s *MessagesSearchCustomEmoji) Value() *tg.EmojiList {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesSearchCustomEmoji) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesSearchCustomEmoji) Get(ctx context.Context) (*tg.EmojiList, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesSearchCustomEmoji) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesSearchCustomEmoji(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesSearchCustomEmoji")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.EmojiList:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesSearchCustomEmoji{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.EmojiListNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesSearchEmojiStickerSets struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesFoundStickerSets
|
|
}
|
|
|
|
type MessagesSearchEmojiStickerSets struct {
|
|
// Query to send.
|
|
req *tg.MessagesSearchEmojiStickerSetsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesSearchEmojiStickerSets creates new MessagesSearchEmojiStickerSets.
|
|
func NewMessagesSearchEmojiStickerSets(raw *tg.Client, initial *tg.MessagesSearchEmojiStickerSetsRequest) *MessagesSearchEmojiStickerSets {
|
|
q := &MessagesSearchEmojiStickerSets{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesSearchEmojiStickerSets) store(v innerMessagesSearchEmojiStickerSets) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesSearchEmojiStickerSets) load() (innerMessagesSearchEmojiStickerSets, bool) {
|
|
v, ok := s.last.Load().(innerMessagesSearchEmojiStickerSets)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesFoundStickerSets must not be mutated.
|
|
func (s *MessagesSearchEmojiStickerSets) Value() *tg.MessagesFoundStickerSets {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesSearchEmojiStickerSets) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesSearchEmojiStickerSets) Get(ctx context.Context) (*tg.MessagesFoundStickerSets, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesSearchEmojiStickerSets) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesSearchEmojiStickerSets(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesSearchEmojiStickerSets")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesFoundStickerSets:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesSearchEmojiStickerSets{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesFoundStickerSetsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerMessagesSearchStickerSets struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.MessagesFoundStickerSets
|
|
}
|
|
|
|
type MessagesSearchStickerSets struct {
|
|
// Query to send.
|
|
req *tg.MessagesSearchStickerSetsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewMessagesSearchStickerSets creates new MessagesSearchStickerSets.
|
|
func NewMessagesSearchStickerSets(raw *tg.Client, initial *tg.MessagesSearchStickerSetsRequest) *MessagesSearchStickerSets {
|
|
q := &MessagesSearchStickerSets{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *MessagesSearchStickerSets) store(v innerMessagesSearchStickerSets) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *MessagesSearchStickerSets) load() (innerMessagesSearchStickerSets, bool) {
|
|
v, ok := s.last.Load().(innerMessagesSearchStickerSets)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned MessagesFoundStickerSets must not be mutated.
|
|
func (s *MessagesSearchStickerSets) Value() *tg.MessagesFoundStickerSets {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *MessagesSearchStickerSets) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *MessagesSearchStickerSets) Get(ctx context.Context) (*tg.MessagesFoundStickerSets, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *MessagesSearchStickerSets) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.MessagesSearchStickerSets(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute MessagesSearchStickerSets")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.MessagesFoundStickerSets:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerMessagesSearchStickerSets{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.MessagesFoundStickerSetsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerPaymentsGetStarGiftActiveAuctions struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.PaymentsStarGiftActiveAuctions
|
|
}
|
|
|
|
type PaymentsGetStarGiftActiveAuctions struct {
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewPaymentsGetStarGiftActiveAuctions creates new PaymentsGetStarGiftActiveAuctions.
|
|
func NewPaymentsGetStarGiftActiveAuctions(raw *tg.Client) *PaymentsGetStarGiftActiveAuctions {
|
|
q := &PaymentsGetStarGiftActiveAuctions{
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *PaymentsGetStarGiftActiveAuctions) store(v innerPaymentsGetStarGiftActiveAuctions) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *PaymentsGetStarGiftActiveAuctions) load() (innerPaymentsGetStarGiftActiveAuctions, bool) {
|
|
v, ok := s.last.Load().(innerPaymentsGetStarGiftActiveAuctions)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned PaymentsStarGiftActiveAuctions must not be mutated.
|
|
func (s *PaymentsGetStarGiftActiveAuctions) Value() *tg.PaymentsStarGiftActiveAuctions {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *PaymentsGetStarGiftActiveAuctions) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *PaymentsGetStarGiftActiveAuctions) Get(ctx context.Context) (*tg.PaymentsStarGiftActiveAuctions, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *PaymentsGetStarGiftActiveAuctions) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := lastHash
|
|
result, err := s.raw.PaymentsGetStarGiftActiveAuctions(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute PaymentsGetStarGiftActiveAuctions")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.PaymentsStarGiftActiveAuctions:
|
|
hash := s.computeHash(variant)
|
|
|
|
s.store(innerPaymentsGetStarGiftActiveAuctions{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.PaymentsStarGiftActiveAuctionsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerPaymentsGetStarGiftCollections struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.PaymentsStarGiftCollections
|
|
}
|
|
|
|
type PaymentsGetStarGiftCollections struct {
|
|
// Query to send.
|
|
req *tg.PaymentsGetStarGiftCollectionsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewPaymentsGetStarGiftCollections creates new PaymentsGetStarGiftCollections.
|
|
func NewPaymentsGetStarGiftCollections(raw *tg.Client, initial *tg.PaymentsGetStarGiftCollectionsRequest) *PaymentsGetStarGiftCollections {
|
|
q := &PaymentsGetStarGiftCollections{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *PaymentsGetStarGiftCollections) store(v innerPaymentsGetStarGiftCollections) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *PaymentsGetStarGiftCollections) load() (innerPaymentsGetStarGiftCollections, bool) {
|
|
v, ok := s.last.Load().(innerPaymentsGetStarGiftCollections)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned PaymentsStarGiftCollections must not be mutated.
|
|
func (s *PaymentsGetStarGiftCollections) Value() *tg.PaymentsStarGiftCollections {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *PaymentsGetStarGiftCollections) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *PaymentsGetStarGiftCollections) Get(ctx context.Context) (*tg.PaymentsStarGiftCollections, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *PaymentsGetStarGiftCollections) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.PaymentsGetStarGiftCollections(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute PaymentsGetStarGiftCollections")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.PaymentsStarGiftCollections:
|
|
hash := s.computeHash(variant)
|
|
|
|
s.store(innerPaymentsGetStarGiftCollections{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.PaymentsStarGiftCollectionsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|
|
|
|
type innerStoriesGetAlbums struct {
|
|
// Last received hash.
|
|
hash int64
|
|
// Last received result.
|
|
value *tg.StoriesAlbums
|
|
}
|
|
|
|
type StoriesGetAlbums struct {
|
|
// Query to send.
|
|
req *tg.StoriesGetAlbumsRequest
|
|
// Result state.
|
|
last atomic.Value
|
|
|
|
// Reference to RPC client to make requests.
|
|
raw *tg.Client
|
|
}
|
|
|
|
// NewStoriesGetAlbums creates new StoriesGetAlbums.
|
|
func NewStoriesGetAlbums(raw *tg.Client, initial *tg.StoriesGetAlbumsRequest) *StoriesGetAlbums {
|
|
q := &StoriesGetAlbums{
|
|
req: initial,
|
|
raw: raw,
|
|
}
|
|
|
|
return q
|
|
}
|
|
|
|
func (s *StoriesGetAlbums) store(v innerStoriesGetAlbums) {
|
|
s.last.Store(v)
|
|
}
|
|
|
|
func (s *StoriesGetAlbums) load() (innerStoriesGetAlbums, bool) {
|
|
v, ok := s.last.Load().(innerStoriesGetAlbums)
|
|
return v, ok
|
|
}
|
|
|
|
// Value returns last received result.
|
|
// NB: May be nil. Returned StoriesAlbums must not be mutated.
|
|
func (s *StoriesGetAlbums) Value() *tg.StoriesAlbums {
|
|
inner, _ := s.load()
|
|
return inner.value
|
|
}
|
|
|
|
// Hash returns last received hash.
|
|
func (s *StoriesGetAlbums) Hash() int64 {
|
|
inner, _ := s.load()
|
|
return inner.hash
|
|
}
|
|
|
|
// Get updates data if needed and returns it.
|
|
func (s *StoriesGetAlbums) Get(ctx context.Context) (*tg.StoriesAlbums, error) {
|
|
if _, err := s.Fetch(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return s.Value(), nil
|
|
}
|
|
|
|
// Fetch updates data if needed and returns true if data was modified.
|
|
func (s *StoriesGetAlbums) Fetch(ctx context.Context) (bool, error) {
|
|
lastHash := s.Hash()
|
|
|
|
req := s.req
|
|
req.Hash = lastHash
|
|
result, err := s.raw.StoriesGetAlbums(ctx, req)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "execute StoriesGetAlbums")
|
|
}
|
|
|
|
switch variant := result.(type) {
|
|
case *tg.StoriesAlbums:
|
|
hash := variant.Hash
|
|
|
|
s.store(innerStoriesGetAlbums{
|
|
hash: hash,
|
|
value: variant,
|
|
})
|
|
return true, nil
|
|
case *tg.StoriesAlbumsNotModified:
|
|
if lastHash == 0 {
|
|
return false, errors.Errorf("got unexpected %T result", result)
|
|
}
|
|
return false, nil
|
|
default:
|
|
return false, errors.Errorf("unexpected type %T", result)
|
|
}
|
|
}
|