Documentation
¶
Index ¶
- Constants
- Variables
- func ConfirmedMutationOutputError(result MutationResult, err error) error
- func ParseAPIID(value string) (int64, error)
- func ValidateFloodWaitLimit(limit time.Duration) error
- type Account
- type App
- func (a App) AuthComplete(ctx context.Context, code, password string) (AuthStatus, error)
- func (a App) AuthStart(ctx context.Context, phone string) (AuthStartStatus, error)
- func (a App) Chats(ctx context.Context, opts ChatOptions) (ChatPage, error)
- func (a App) DeleteMessage(ctx context.Context, peerToken string, msgID int, scope DeleteScope) (MutationResult, error)
- func (a App) DownloadMedia(ctx context.Context, opts MediaDownloadOptions) (MediaDownloadResult, error)
- func (a App) Edit(ctx context.Context, peerToken string, msgID int, text string) (MutationResult, error)
- func (a App) History(ctx context.Context, peerToken string, limit int) (MessagePage, error)
- func (a App) Inbox(ctx context.Context, opts ChatOptions, mode string) (ChatPage, error)
- func (a App) Login(ctx context.Context, opts LoginOptions) (AuthStatus, error)
- func (a App) LogoutRemote(ctx context.Context) error
- func (a App) PeerInfo(token string) PeerInfo
- func (a App) PreviewMutation(ctx context.Context, action, peerToken string, msgID int, scope DeleteScope) (MutationPreview, error)
- func (a App) React(ctx context.Context, peerToken string, msgID int, emoji string) (MutationResult, error)
- func (a App) Read(ctx context.Context, opts ReadOptions) (MessagePage, error)
- func (a App) ResetLocalAuth(ctx context.Context) error
- func (a App) Run(ctx context.Context, fn func(ctx context.Context, c *telegram.Client) error) error
- func (a App) Search(ctx context.Context, opts SearchOptions) (MessagePage, error)
- func (a App) Send(ctx context.Context, peerToken, text string, replyTo int) (MutationResult, error)
- func (a App) SetAPIHash(ctx context.Context, hash string) error
- func (a App) Status(ctx context.Context) (AuthStatus, error)
- type AuthStartStatus
- type AuthStatus
- type Chat
- type ChatOptions
- type ChatPage
- type DeleteScope
- type LoginOptions
- type MediaDownloadOptions
- type MediaDownloadResult
- type Message
- type MessageEntity
- type MessagePage
- type MutationError
- type MutationOutcome
- type MutationPreview
- type MutationResult
- type PeerInfo
- type ReadOptions
- type RetrievalReceipt
- type SearchOptions
Constants ¶
View Source
const ( DefaultFloodWaitLimit = 30 * time.Second MaxFloodWaitLimit = 5 * time.Minute )
Variables ¶
View Source
var ( ErrPendingAuthExpired = errors.New("pending auth expired") ErrPendingAuthInvalid = errors.New("pending auth state is invalid") )
Functions ¶
func ConfirmedMutationOutputError ¶
func ConfirmedMutationOutputError(result MutationResult, err error) error
func ParseAPIID ¶
func ValidateFloodWaitLimit ¶
Types ¶
type App ¶
type App struct {
Config config.Config
Profile string
Paths config.Paths
Secrets secrets.Store
FloodWaitLimit time.Duration
In io.Reader
Out io.Writer
Err io.Writer
}
func (App) AuthComplete ¶
func (App) DeleteMessage ¶
func (a App) DeleteMessage(ctx context.Context, peerToken string, msgID int, scope DeleteScope) (MutationResult, error)
func (App) DownloadMedia ¶
func (a App) DownloadMedia(ctx context.Context, opts MediaDownloadOptions) (MediaDownloadResult, error)
func (App) Login ¶
func (a App) Login(ctx context.Context, opts LoginOptions) (AuthStatus, error)
func (App) PreviewMutation ¶
func (a App) PreviewMutation(ctx context.Context, action, peerToken string, msgID int, scope DeleteScope) (MutationPreview, error)
func (App) Read ¶
func (a App) Read(ctx context.Context, opts ReadOptions) (MessagePage, error)
func (App) Search ¶
func (a App) Search(ctx context.Context, opts SearchOptions) (MessagePage, error)
type AuthStartStatus ¶
type AuthStatus ¶
type Chat ¶
type Chat struct {
Ref string `json:"ref"`
Kind string `json:"kind"`
ID int64 `json:"id"`
Title string `json:"title"`
Username string `json:"username,omitempty"`
UnreadCount int `json:"unread_count"`
UnreadMentionsCount int `json:"unread_mentions_count,omitempty"`
TopMessageID int `json:"top_message_id,omitempty"`
LastMessageDate string `json:"last_message_date,omitempty"`
LastMessagePreview string `json:"last_message_preview,omitempty"`
}
type ChatOptions ¶
type ChatPage ¶
type ChatPage struct {
Items []Chat
Receipt RetrievalReceipt
}
type DeleteScope ¶
type DeleteScope string
const ( DeleteScopeForMe DeleteScope = "for_me" DeleteScopeRevoke DeleteScope = "revoke" )
type LoginOptions ¶
type MediaDownloadOptions ¶
type MediaDownloadResult ¶
type MediaDownloadResult struct {
OK bool `json:"ok"`
PeerRef string `json:"peer_ref"`
MessageID int `json:"message_id"`
Path string `json:"path"`
Bytes int64 `json:"bytes"`
MediaType string `json:"media_type"`
MimeType string `json:"mime_type,omitempty"`
FileName string `json:"file_name"`
StorageType string `json:"storage_type,omitempty"`
DownloadedAt string `json:"downloaded_at"`
}
type Message ¶
type Message struct {
ID int `json:"id"`
Date string `json:"date,omitempty"`
Text string `json:"text,omitempty"`
Outgoing bool `json:"outgoing"`
Post bool `json:"post,omitempty"`
Media string `json:"media,omitempty"`
Service string `json:"service,omitempty"`
SourcePeerRef string `json:"source_peer_ref,omitempty"`
SourcePeerLabel string `json:"source_peer_label,omitempty"`
SenderPeerRef string `json:"sender_peer_ref,omitempty"`
SenderLabel string `json:"sender_label,omitempty"`
ReplyToMessageID int `json:"reply_to_message_id,omitempty"`
ThreadID int `json:"thread_id,omitempty"`
ForumTopic bool `json:"forum_topic,omitempty"`
ForwardedFromPeerRef string `json:"forwarded_from_peer_ref,omitempty"`
ForwardedFromLabel string `json:"forwarded_from_label,omitempty"`
ForwardedDate string `json:"forwarded_date,omitempty"`
EditDate string `json:"edit_date,omitempty"`
GroupedID int64 `json:"grouped_id,omitempty"`
Entities []MessageEntity `json:"entities,omitempty"`
}
type MessageEntity ¶
type MessagePage ¶
type MessagePage struct {
Items []Message
Receipt RetrievalReceipt
}
type MutationError ¶
type MutationError struct {
Outcome MutationOutcome
RetrySafe bool
ReconciliationHandle string
Err error
}
func (MutationError) Error ¶
func (e MutationError) Error() string
func (MutationError) MutationOutcomeCode ¶
func (e MutationError) MutationOutcomeCode() string
func (MutationError) MutationReconciliationHandle ¶
func (e MutationError) MutationReconciliationHandle() string
func (MutationError) MutationRetrySafe ¶
func (e MutationError) MutationRetrySafe() bool
func (MutationError) Unwrap ¶
func (e MutationError) Unwrap() error
type MutationOutcome ¶
type MutationOutcome string
const ( MutationConfirmed MutationOutcome = "confirmed" MutationRejected MutationOutcome = "rejected" MutationOutcomeUnknown MutationOutcome = "outcome_unknown" )
type MutationPreview ¶
type MutationResult ¶
type MutationResult struct {
OK bool `json:"ok"`
Outcome MutationOutcome `json:"outcome"`
RetrySafe bool `json:"retry_safe"`
Action string `json:"action"`
PeerRef string `json:"peer_ref"`
MessageID int `json:"message_id,omitempty"`
MessageIDs []int `json:"message_ids,omitempty"`
ReconciliationHandle string `json:"reconciliation_handle"`
Timestamp string `json:"timestamp"`
}
type ReadOptions ¶
type RetrievalReceipt ¶
type RetrievalReceipt struct {
RequestedCount int `json:"requested_count"`
ReturnedCount int `json:"returned_count"`
Complete *bool `json:"complete"`
Truncated bool `json:"truncated"`
NextCursor string `json:"next_cursor,omitempty"`
InputCursor string `json:"input_cursor,omitempty"`
ServerTotal *int `json:"server_total,omitempty"`
Pages int `json:"pages"`
}
Click to show internal directories.
Click to hide internal directories.