featured

package
v0.53.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package featured contains featured stickers iteration helper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elem

type Elem struct {
	Sticker tg.StickerSetCoveredClass
	// IDs of new featured stickersets
	Unread []int64
}

Elem is a sticker iterator element.

type GetOldFeaturedStickersQueryBuilder

type GetOldFeaturedStickersQueryBuilder struct {
	// contains filtered or unexported fields
}

GetOldFeaturedStickersQueryBuilder is query builder of MessagesGetOldFeaturedStickers.

func (*GetOldFeaturedStickersQueryBuilder) BatchSize

BatchSize sets buffer of message loaded from one request. Be carefully, when set this limit, because Telegram does not return error if limit is too big, so results can be incorrect.

func (*GetOldFeaturedStickersQueryBuilder) Collect

Collect creates iterator and collects all elements to slice.

func (*GetOldFeaturedStickersQueryBuilder) Count

Count fetches remote state to get number of elements.

func (*GetOldFeaturedStickersQueryBuilder) ForEach

ForEach calls given callback on each iterator element.

func (*GetOldFeaturedStickersQueryBuilder) Iter

Iter returns iterator using built query.

func (*GetOldFeaturedStickersQueryBuilder) Query

Query implements Query interface.

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator is a featured stickers stream iterator.

func NewIterator

func NewIterator(query Query, limit int) *Iterator

NewIterator creates new iterator.

func (*Iterator) Err

func (m *Iterator) Err() error

Err returns the error, if any, that was encountered during iteration.

func (*Iterator) FetchTotal

func (m *Iterator) FetchTotal(ctx context.Context) (int, error)

FetchTotal fetches and returns count of elements.

func (*Iterator) Next

func (m *Iterator) Next(ctx context.Context) bool

Next prepares the next message for reading with the Value method. It returns true on success, or false if there is no next message or an error happened while preparing it. Err should be consulted to distinguish between the two cases.

func (*Iterator) Offset

func (m *Iterator) Offset(offset int) *Iterator

Offset sets Offset request parameter.

func (*Iterator) Total

func (m *Iterator) Total(ctx context.Context) (int, error)

Total returns last fetched count of elements. If count was not fetched before, it requests server using FetchTotal.

func (*Iterator) Value

func (m *Iterator) Value() Elem

Value returns current message.

type Query

type Query interface {
	Query(ctx context.Context, req Request) (tg.MessagesFeaturedStickersClass, error)
}

Query is an abstraction for featured request. NB: iterator mutates returned data (sorts, at least).

type QueryBuilder

type QueryBuilder struct {
	// contains filtered or unexported fields
}

QueryBuilder is a helper to create message queries.

func NewQueryBuilder

func NewQueryBuilder(raw *tg.Client) *QueryBuilder

NewQueryBuilder creates new QueryBuilder.

func (*QueryBuilder) GetOldFeaturedStickers

func (q *QueryBuilder) GetOldFeaturedStickers() *GetOldFeaturedStickersQueryBuilder

GetOldFeaturedStickers creates query builder of MessagesGetOldFeaturedStickers.

type QueryFunc

type QueryFunc func(ctx context.Context, req Request) (tg.MessagesFeaturedStickersClass, error)

QueryFunc is a function adapter for Query.

func (QueryFunc) Query

Query implements Query interface.

type Request

type Request struct {
	Offset int
	Limit  int
}

Request is a parameter for Query.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL