tdproto

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 5 Imported by: 10

Documentation

Index

Constants

View Source
const (
	DirectChatType = ChatType("direct")
	GroupChatType  = ChatType("group")
	TaskChatType   = ChatType("task")
)
View Source
const (
	ContactPrefix        = "d-"
	GroupPrefix          = "g-"
	TaskPrefix           = "t-"
	ContactSectionPrefix = "sd-"
	GroupSectionPrefix   = "sg-"
	TaskSectionPrefix    = "st-"
)

Variables

This section is empty.

Functions

func IsValidUid added in v0.0.4

func IsValidUid(s string) bool

Types

type ChatType added in v0.0.4

type ChatType string

func (ChatType) IsDirect added in v0.0.4

func (ct ChatType) IsDirect() bool

func (ChatType) IsGroup added in v0.0.4

func (ct ChatType) IsGroup() bool

func (ChatType) IsTask added in v0.0.4

func (ct ChatType) IsTask() bool

func (ChatType) JidPrefix added in v0.0.4

func (ct ChatType) JidPrefix() string

func (ChatType) String added in v0.0.4

func (ct ChatType) String() string

type Features

type Features struct {
	// current host
	Host string `json:"host"`

	// build/revision of server side
	Build string `json:"build"`

	// desktop application version
	DesktopVersion string `json:"desktop_version"`

	// webclient version
	FrontVersion string `json:"front_version"`

	// Application title
	AppTitle string `json:"app_title"`

	// Static files server address
	Userver string `json:"userver"`

	// Link to AppStore
	IOSApp string `json:"ios_app"`

	// Link to Google Play
	AndroidApp string `json:"android_app"`

	// Default UI theme
	Theme string `json:"theme"`

	// Minimal application version required for this server. Used for breaking changes
	MinAppVersion string `json:"min_app_version"`

	// Free registration allowed
	FreeRegistration bool `json:"free_registration"`

	// Maximum size of user's upload
	MaxUploadMb int `json:"max_upload_mb"`

	// Maximum number of forwarded messages
	MaxLinkedMessages int `json:"max_linked_messages"`

	// Maximum chars for text message
	MaxMessageLength int `json:"max_message_length"`

	// Maximum length for project and contact's sections names
	MaxSectionLength int `json:"max_section_length"`

	// Maximum length for tags
	MaxTagLength int `json:"max_tag_length"`

	// Maximum length for task title
	MaxTaskTitleLength int `json:"max_task_title_length"`

	// Maximum teams for one account
	MaxTeams int `json:"max_teams"`

	// Max inactivity seconds
	AfkAge int `json:"afk_age"`

	// Password authentication enabled
	AuthByPassword bool `json:"auth_by_password,omitempty"`

	// QR-code / link authentication enabled
	AuthByQrCode bool `json:"auth_by_qr_code,omitempty"`

	// SMS authentication enabled
	AuthBySms bool `json:"auth_by_sms,omitempty"`

	// Calls functions enabled
	Calls bool `json:"calls"`

	// Calls functions enabled for mobile applications
	MoblieCalls bool `json:"mobile_calls"`

	// Calls record enabled
	CallsRecord bool `json:"calls_record"`

	// ICE servers for WebRTC
	ICEServers []ICEServer `json:"ice_servers"`

	// True for onpremise installation
	CustomServer bool `json:"custom_server"`

	// name of instalation
	InstallationType string `json:"installation_type"`

	// testing installation
	IsTesting bool `json:"is_testing"`

	// yandex metrika counter id
	Metrika string `json:"metrika"`

	// minimal chars number for starting global search
	MinSearchLength int `json:"min_search_length"`

	// resend message in n seconds if no confirmation from server given
	ResendTimeout int `json:"resend_timeout"`

	// frontent sentry.io settings
	SentryDsnJS string `json:"sentry_dsn_js"`

	// message drafts saved on server
	ServerDrafts bool `json:"server_drafts"`

	// web-push notifacations related fields
	FirebaseAppId    string `json:"firebase_app_id"`
	FirebaseSenderId string `json:"firebase_sender_id"`
	SafariPushId     string `json:"safari_push_id"`

	// experimetal functions
	Terms                Terms `json:"terms"`
	SingleGroupTeams     bool  `json:"single_group_teams"`
	WikiPages            bool  `json:"wiki_pages"`
	AllowAdminMute       bool  `json:"allow_admin_mute,omitempty"`
	OnlyOneDevicePerCall bool  `json:"only_one_device_per_call,omitempty"`

	// obsolete fields. Always true
	TaskChecklist  bool `json:"task_checklist"`
	ReadonlyGroups bool `json:"readonly_groups"`
	TaskDashboard  bool `json:"task_dashboard"`
	TaskMessages   bool `json:"task_messages"`
	TaskPublic     bool `json:"task_public"`
	TaskTags       bool `json:"task_tags"`
}

{hostname}/features.js / {hostname}/features.json structure

type HasJid added in v0.0.4

type HasJid interface {
	JID() *JID
}

type ICEServer

type ICEServer struct {
	Urls string `json:"urls"`
}

type JID added in v0.0.4

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

func NewJID added in v0.0.4

func NewJID(val string) *JID

func (JID) ChatType added in v0.0.4

func (jid JID) ChatType() ChatType

func (JID) Empty added in v0.0.4

func (jid JID) Empty() bool

func (JID) Equal added in v0.0.4

func (jid JID) Equal(other JID) bool

func (JID) IsDirect added in v0.0.4

func (jid JID) IsDirect() bool

func (JID) IsGroup added in v0.0.4

func (jid JID) IsGroup() bool

func (JID) IsSection added in v0.0.4

func (jid JID) IsSection() bool

func (JID) IsTask added in v0.0.4

func (jid JID) IsTask() bool

func (JID) JID added in v0.0.4

func (jid JID) JID() *JID

func (JID) MarshalJSON added in v0.0.4

func (jid JID) MarshalJSON() ([]byte, error)

func (JID) String added in v0.0.4

func (jid JID) String() string

func (JID) Uid added in v0.0.4

func (jid JID) Uid() string

func (*JID) UnmarshalJSON added in v0.0.4

func (jid *JID) UnmarshalJSON(data []byte) error

func (JID) Valid added in v0.0.4

func (jid JID) Valid() bool

func (JID) Value added in v0.0.4

func (jid JID) Value() string

type JIDs added in v0.0.4

type JIDs []JID

type Mediasubtype added in v0.0.4

type Mediasubtype string
const (
	MediaSubtypeSticker Mediasubtype = "sticker"
	MediaSubtypeNewtask Mediasubtype = "newtask"
)

type Mediatype added in v0.0.4

type Mediatype string
const (
	MediatypePlain    Mediatype = "plain"
	MediatypeChange   Mediatype = "change"
	MediatypeDeleted  Mediatype = "deleted"
	MediatypeFile     Mediatype = "file"
	MediatypeImage    Mediatype = "image"
	MediatypeVideo    Mediatype = "video"
	MediatypeAudiomsg Mediatype = "audiomsg"
	MediatypeContact  Mediatype = "contact"
	MediatypePdf      Mediatype = "pdf"
)

type Message added in v0.0.4

type Message struct {
	// message content struct
	Content MessageContent `json:"content"`

	// simple plaintext message representation
	PushText string `json:"push_text,omitempty"`

	// sender jid
	From JID `json:"from"`

	// recipient jid
	To JID `json:"to"`

	// message uid
	MessageId string `json:"message_id"`

	// message creation datetime (set by server side)
	Created string `json:"created"`

	// object version
	Gentime int64 `json:"gentime"`

	// chat type
	ChatType ChatType `json:"chat_type"`

	// chat jid
	Chat JID `json:"chat,omitempty"`

	// external/internals links
	Links MessageLinks `json:"links,omitempty"`

	// importance flag
	Important bool `json:"important,omitempty"`

	// datetime of message modification or deletion
	Edited string `json:"edited,omitempty"`

	// message was seen by anybody in chat. True or null
	Received bool `json:"received,omitempty"`

	// unused yet
	NumReceived int `json:"num_received,omitempty"`

	// disable link previews. True or null
	Nopreview bool `json:"nopreview,omitempty"`

	// has link previews. True or null
	HasPreviews bool `json:"has_previews,omitempty"`

	// previous message id in this chat. Uid or null
	Prev string `json:"prev,omitempty"`

	// this message is first in this chat. True or null
	IsFirst bool `json:"is_first,omitempty"`

	// this message is first in this chat. True or null
	IsLast bool `json:"is_last,omitempty"`

	// message reactions struct. Can be null
	Reactions []MessageReaction `json:"reactions,omitempty"`

	// message that was replied to, if any
	ReplyTo *Message `json:"reply_to,omitempty"`

	// forwarded messages. Can be null. Also contains double of ReplyTo for backward compatibility
	LinkedMessages []Message `json:"linked_messages,omitempty"`

	// has mention (@). True or null
	Notice bool `json:"notice,omitempty"`

	// message has no pushes and did not affect any counters
	Silently bool `json:"silently,omitempty"`

	// author can change this message until date. Can be null
	EditableUntil string `json:"editable_until,omitempty"`

	// index number of this message. Starts from 0. Null for deleted messages. Changes when any previous message wad deleted.
	Num *int `json:"num,omitempty"`

	// debug information if any
	Debug string `json:"_debug,omitempty"`
}

type MessageContent added in v0.0.4

type MessageContent struct {
	Text          string       `json:"text"`
	Type          Mediatype    `json:"type"`
	Subtype       Mediasubtype `json:"subtype,omitempty"`
	Upload        string       `mediatype:"audiomsg,image,video,file" json:"upload,omitempty"`
	MediaUrl      string       `mediatype:"audiomsg,image,video,file" json:"mediaURL,omitempty"`
	Size          int          `mediatype:"audiomsg,image,video,file" json:"size,omitempty"`
	Duration      *uint        `mediatype:"audiomsg,video" json:"duration,omitempty"`
	Processing    bool         `mediatype:"video" json:"processing,omitempty"`
	PreviewHeight int          `mediatype:"image,video" json:"previewHeight,omitempty"`
	PreviewWidth  int          `mediatype:"image,video" json:"previewWidth,omitempty"`
	PreviewUrl    string       `mediatype:"image,video" json:"previewURL,omitempty"`
	Preview2xUrl  string       `mediatype:"image,video" json:"preview2xURL,omitempty"`
	Name          string       `mediatype:"image,video,file" json:"name,omitempty"`
	Animated      bool         `mediatype:"image" json:"animated,omitempty"`
	Title         string       `mediatype:"change" json:"title,omitempty"`
	New           *string      `mediatype:"change" json:"new,omitempty"`
	Old           *string      `mediatype:"change" json:"old,omitempty"`
	Actor         *JID         `mediatype:"change" json:"actor,omitempty"`
	Comment       string       `mediatype:"progress" json:"comment,omitempty"`
	I             uint         `mediatype:"progress" json:"i,omitempty"`
	Total         uint         `mediatype:"progress" json:"total,omitempty"`
	GivenName     *string      `mediatype:"contact" json:"given_name,omitempty"`
	FamilyName    *string      `mediatype:"contact" json:"family_name,omitempty"`
	Patronymic    *string      `mediatype:"contact" json:"patronymic,omitempty"`
	Phones        *[]string    `mediatype:"contact" json:"phones,omitempty"`
	Emails        *[]string    `mediatype:"contact" json:"emails,omitempty"`
	Stickerpack   string       `mediasubtype:"sticker" json:"stickerpack,omitempty"`
	PdfVersion    *PdfVersion  `json:"pdf_version,omitempty"`
}
type MessageLink struct {
	Pattern   string              `json:"pattern"`
	Url       string              `json:"url"`
	Text      string              `json:"text"`
	Preview   *MessageLinkPreview `json:"preview,omitempty"`
	Uploads   []Upload            `json:"uploads,omitempty"`
	NoPreview bool                `json:"nopreview,omitempty"`
	YoutubeId string              `json:"youtube_id,omitempty"`
}

type MessageLinkPreview added in v0.0.4

type MessageLinkPreview struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
}
type MessageLinks []MessageLink

func (MessageLinks) Sort added in v0.0.4

func (links MessageLinks) Sort()

type MessageReaction added in v0.0.4

type MessageReaction struct {
	Name    string                  `json:"name"`
	Counter int                     `json:"counter"`
	Details []MessageReactionDetail `json:"details"`
}

type MessageReactionDetail added in v0.0.4

type MessageReactionDetail struct {
	Created string `json:"created"`
	Sender  string `json:"sender"`
	Name    string `json:"name"`
}

type PdfVersion added in v0.0.4

type PdfVersion struct {
	Url         string `json:"url"`
	TextPreview string `json:"text_preview,omitempty"`
}

type Terms

type Terms struct {
	EnInTeam       string
	EnTeam         string
	EnTeamAccess   string
	EnTeamAdmin    string
	EnTeamAdmins   string
	EnTeamGuest    string
	EnTeamMember   string
	EnTeamMembers  string
	EnTeamOwner    string
	EnTeamSettings string
	RuTeamSettings string
	EnTeams        string
	EnToTeam       string
	RuInTeam       string
	RuTeam         string
	RuTeamAccess   string
	RuTeamAdmin    string
	RuTeamAdmins   string
	RuTeamD        string
	RuTeamGuest    string
	RuTeamMember   string
	RuTeamMembers  string
	RuTeamOwner    string
	RuTeamP        string
	RuTeamR        string
	RuTeams        string
	RuTeamsD       string
	RuTeamsP       string
	RuTeamsR       string
	RuTeamsT       string
	RuTeamsV       string
	RuTeamT        string
	RuTeamV        string
	RuToTeam       string
}

type Upload added in v0.0.4

type Upload struct {
	Uid         string         `json:"uid"`
	Size        int            `json:"size"`
	Duration    uint           `json:"duration,omitempty"`
	Name        string         `json:"name"`
	Url         string         `json:"url"`
	Preview     *UploadPreview `json:"preview,omitempty"`
	ContentType string         `json:"content_type"`
	Animated    bool           `json:"animated,omitempty"`
	Processing  bool           `json:"processing,omitempty"`
	PdfVersion  *PdfVersion    `json:"pdf_version,omitempty"`
}

type UploadPreview added in v0.0.4

type UploadPreview struct {
	Url    string `json:"url"`
	Url2x  string `json:"url_2x"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

Jump to

Keyboard shortcuts

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