Documentation ¶
Overview ¶
Package dialogs contains dialog iteration helper.
Index ¶
- type DialogKey
- type Elem
- func (e Elem) Deleted() bool
- func (e Elem) Messages(raw *tg.Client) *messages.GetHistoryQueryBuilder
- func (e Elem) Participants(raw *tg.Client) (*participants.GetParticipantsQueryBuilder, bool)
- func (e Elem) RecentLocations(raw *tg.Client) *messages.GetRecentLocationsQueryBuilder
- func (e Elem) Replies(raw *tg.Client) *messages.GetRepliesQueryBuilder
- func (e Elem) Search(raw *tg.Client) *messages.SearchQueryBuilder
- func (e Elem) UnreadMentions(raw *tg.Client) *messages.GetUnreadMentionsQueryBuilder
- func (e Elem) UserPhotos(raw *tg.Client) (*photos.GetUserPhotosQueryBuilder, bool)
- type GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) BatchSize(batchSize int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
- func (b *GetDialogsQueryBuilder) Count(ctx context.Context) (int, error)
- func (b *GetDialogsQueryBuilder) FolderID(paramFolderID int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
- func (b *GetDialogsQueryBuilder) Iter() *Iterator
- func (b *GetDialogsQueryBuilder) OffsetDate(offsetDate int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) OffsetID(offsetID int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesDialogsClass, error)
- type Iterator
- func (m *Iterator) Err() error
- func (m *Iterator) FetchTotal(ctx context.Context) (int, error)
- func (m *Iterator) Next(ctx context.Context) bool
- func (m *Iterator) OffsetDate(offsetDate int) *Iterator
- func (m *Iterator) OffsetID(offsetID int) *Iterator
- func (m *Iterator) OffsetPeer(offsetPeer tg.InputPeerClass) *Iterator
- func (m *Iterator) Total(ctx context.Context) (int, error)
- func (m *Iterator) Value() Elem
- type PeerKind
- type Query
- type QueryBuilder
- type QueryFunc
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DialogKey ¶ added in v0.54.0
DialogKey is a generic peer key.
func (*DialogKey) FromInputPeer ¶ added in v0.54.0
func (d *DialogKey) FromInputPeer(peer tg.InputPeerClass) error
FromInputPeer fills key using given peer.
type Elem ¶
type Elem struct { Dialog tg.DialogClass Peer tg.InputPeerClass Last tg.NotEmptyMessage Entities peer.Entities }
Elem is a dialog iterator element.
func (Elem) Messages ¶ added in v0.33.0
func (e Elem) Messages(raw *tg.Client) *messages.GetHistoryQueryBuilder
Messages returns new messages history query builder for current dialog.
func (Elem) Participants ¶ added in v0.33.0
func (e Elem) Participants(raw *tg.Client) (*participants.GetParticipantsQueryBuilder, bool)
Participants returns new channel participants query builder for current dialog. If peer is not channel, returns false.
func (Elem) RecentLocations ¶ added in v0.33.0
func (e Elem) RecentLocations(raw *tg.Client) *messages.GetRecentLocationsQueryBuilder
RecentLocations returns new live location history query builder for current dialog.
func (Elem) Replies ¶ added in v0.33.0
func (e Elem) Replies(raw *tg.Client) *messages.GetRepliesQueryBuilder
Replies returns new replies query builder for current dialog.
func (Elem) Search ¶ added in v0.33.0
func (e Elem) Search(raw *tg.Client) *messages.SearchQueryBuilder
Search returns new search query builder for current dialog.
func (Elem) UnreadMentions ¶ added in v0.33.0
func (e Elem) UnreadMentions(raw *tg.Client) *messages.GetUnreadMentionsQueryBuilder
UnreadMentions returns new unread mentions query builder for current dialog.
func (Elem) UserPhotos ¶ added in v0.33.0
UserPhotos returns new user photo query builder for current dialog. If peer is not user, returns false.
type GetDialogsQueryBuilder ¶
type GetDialogsQueryBuilder struct {
// contains filtered or unexported fields
}
GetDialogsQueryBuilder is query builder of MessagesGetDialogs.
func (*GetDialogsQueryBuilder) BatchSize ¶
func (b *GetDialogsQueryBuilder) BatchSize(batchSize int) *GetDialogsQueryBuilder
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 (*GetDialogsQueryBuilder) Collect ¶
func (b *GetDialogsQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
Collect creates iterator and collects all elements to slice.
func (*GetDialogsQueryBuilder) Count ¶
func (b *GetDialogsQueryBuilder) Count(ctx context.Context) (int, error)
Count fetches remote state to get number of elements.
func (*GetDialogsQueryBuilder) FolderID ¶
func (b *GetDialogsQueryBuilder) FolderID(paramFolderID int) *GetDialogsQueryBuilder
FolderID sets FolderID field of GetDialogs query.
func (*GetDialogsQueryBuilder) ForEach ¶
func (b *GetDialogsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
ForEach calls given callback on each iterator element.
func (*GetDialogsQueryBuilder) Iter ¶
func (b *GetDialogsQueryBuilder) Iter() *Iterator
Iter returns iterator using built query.
func (*GetDialogsQueryBuilder) OffsetDate ¶
func (b *GetDialogsQueryBuilder) OffsetDate(offsetDate int) *GetDialogsQueryBuilder
OffsetDate sets offsetDate from which iterate start.
func (*GetDialogsQueryBuilder) OffsetID ¶
func (b *GetDialogsQueryBuilder) OffsetID(offsetID int) *GetDialogsQueryBuilder
OffsetID sets offsetID from which iterate start.
func (*GetDialogsQueryBuilder) Query ¶
func (b *GetDialogsQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesDialogsClass, error)
Query implements Query interface.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is a dialog stream iterator.
func NewIterator ¶
NewIterator creates new iterator.
func (*Iterator) FetchTotal ¶
FetchTotal fetches and returns count of elements.
func (*Iterator) Next ¶
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) OffsetDate ¶
OffsetDate sets OffsetDate request parameter.
func (*Iterator) OffsetPeer ¶
func (m *Iterator) OffsetPeer(offsetPeer tg.InputPeerClass) *Iterator
OffsetPeer sets OffsetPeer request parameter.
type Query ¶
Query is an abstraction for dialogs 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) GetDialogs ¶
func (q *QueryBuilder) GetDialogs() *GetDialogsQueryBuilder
GetDialogs creates query builder of MessagesGetDialogs.