github.com/tada-team/tdproto@v1.51.57/chat.go (about)

     1  package tdproto
     2  
     3  // Minimal chat representation
     4  type ChatShort struct {
     5  	// Group/Task/Contact id
     6  	Jid JID `json:"jid"`
     7  
     8  	// Chat type
     9  	ChatType ChatType `json:"chat_type"`
    10  
    11  	// Title
    12  	DisplayName string `json:"display_name"`
    13  
    14  	// Icon data
    15  	Icons IconData `json:"icons"`
    16  }
    17  
    18  // Minimal chat representation for deletion
    19  type DeletedChat struct {
    20  	// Group/Task/Contact id
    21  	Jid JID `json:"jid"`
    22  
    23  	// Chat type
    24  	ChatType ChatType `json:"chat_type"`
    25  
    26  	// Chat fields (related to concrete participant) version
    27  	Gentime int64 `json:"gentime"`
    28  
    29  	// Archive flag. Always true for this structure
    30  	IsArchive bool `json:"is_archive"`
    31  }
    32  
    33  // Chat (direct, group, task) representation
    34  type Chat struct {
    35  	// Group/Task/Contact id
    36  	Jid JID `json:"jid"`
    37  
    38  	// Chat type
    39  	ChatType ChatType `json:"chat_type"`
    40  
    41  	// Base fields (not related to concrete participant) version
    42  	BaseGentime int64 `json:"base_gentime,omitempty"`
    43  
    44  	// Chat fields related to concrete participant) version
    45  	Gentime int64 `json:"gentime"`
    46  
    47  	// Creation date, iso datetime
    48  	Created ISODateTimeString `json:"created"`
    49  
    50  	// Title
    51  	DisplayName string `json:"display_name"`
    52  
    53  	// Public Status
    54  	PublicStatus *PublicStatus `json:"public_status,omitempty"`
    55  
    56  	// Icons info
    57  	Icons IconData `json:"icons"`
    58  
    59  	// Include unread messages to counters
    60  	CountersEnabled bool `json:"counters_enabled,omitempty"`
    61  
    62  	// Can I call to this chat
    63  	CanCall bool `json:"can_call,omitempty"`
    64  
    65  	// Can I send message to this chat
    66  	CanSendMessage bool `json:"can_send_message,omitempty"`
    67  
    68  	// Why I can't send message to this chat (if can't)
    69  	CantSendMessageReason string `json:"cant_send_message_reason,omitempty"`
    70  
    71  	// Description collapsed. Used for tasks only
    72  	Collapsed bool `json:"collapsed,omitempty"`
    73  
    74  	// Last message draft, if any
    75  	Draft string `json:"draft,omitempty"`
    76  
    77  	// Deprecated: use DraftRevision instead.
    78  	// Last message draft version, if any
    79  	DraftGentime int64 `json:"draft_gentime,omitempty"`
    80  
    81  	// Last message draft version, if any. unixtime(ms)
    82  	DraftRevision int64 `json:"draft_revision,omitempty"`
    83  
    84  	// Hidden chat
    85  	Hidden bool `json:"hidden,omitempty"`
    86  
    87  	// Push notifications enabled
    88  	NotificationsEnabled bool `json:"notifications_enabled,omitempty"`
    89  
    90  	// Number of important messages
    91  	NumImportants int `json:"num_importants,omitempty"`
    92  
    93  	// Unread counter
    94  	NumUnread uint `json:"num_unread,omitempty"`
    95  
    96  	// Mentions (@) counter
    97  	NumUnreadNotices uint `json:"num_unread_notices,omitempty"`
    98  
    99  	// Last message object
   100  	LastMessage *Message `json:"last_message,omitempty"`
   101  
   102  	// Last read message id, if any
   103  	LastReadMessageId string `json:"last_read_message_id,omitempty"`
   104  
   105  	// Project / section id, if any
   106  	Section string `json:"section,omitempty"`
   107  
   108  	// List of editable fields
   109  	ChangeableFields []string `json:"changeable_fields,omitempty"`
   110  
   111  	// Is chat pinned on top
   112  	Pinned bool `json:"pinned,omitempty"`
   113  
   114  	// Sort ordering for pinned chat
   115  	PinnedSortOrdering int `json:"pinned_sort_ordering,omitempty"`
   116  
   117  	// Non-archive participants number
   118  	NumMembers *uint `json:"num_members,omitempty"`
   119  
   120  	// Can I delete this chat
   121  	CanDelete bool `json:"can_delete,omitempty"`
   122  
   123  	// Group or task description
   124  	Description string `json:"description,omitempty"`
   125  
   126  	// Markup entities for description field. Experimental
   127  	Markup []MarkupEntity `json:"markup,omitempty" tdproto:"readonly"`
   128  
   129  	// Present in feed (main screen)
   130  	Feed bool `json:"feed,omitempty"`
   131  
   132  	// Pinned message for this chat
   133  	PinnedMessage *Message `json:"pinned_message,omitempty"`
   134  
   135  	// Custom color index from table of colors. Tasks only
   136  	ColorIndex *uint16 `chattype:"task" json:"color_index,omitempty"`
   137  
   138  	// Items in checklist. Tasks only
   139  	NumItems *uint `chattype:"task" json:"num_items,omitempty"`
   140  
   141  	// Checked items in checklist. Tasks only
   142  	NumCheckedItems *uint `chattype:"task" json:"num_checked_items,omitempty"`
   143  
   144  	// Assignee contact id. Tasks only
   145  	Assignee JID `chattype:"task" json:"assignee,omitempty"`
   146  
   147  	// Task number in this team
   148  	Num uint `chattype:"task" json:"num,omitempty"`
   149  
   150  	// Task followers id's. TODO: rename to "followers"
   151  	Observers []JID `chattype:"task" json:"observers,omitempty"`
   152  
   153  	// Task creator
   154  	Owner JID `chattype:"task" json:"owner,omitempty"`
   155  
   156  	// Task status. May be custom
   157  	TaskStatus string `chattype:"task" json:"task_status,omitempty"`
   158  
   159  	// Task title. Generated from number and description
   160  	Title string `chattype:"task" json:"title,omitempty"`
   161  
   162  	// Task done date in iso format, if any
   163  	Done ISODateTimeString `chattype:"task" json:"done,omitempty"`
   164  
   165  	// Task done reason, if any
   166  	DoneReason string `chattype:"task" json:"done_reason,omitempty"`
   167  
   168  	// Task deadline in iso format, if any
   169  	Deadline ISODateTimeString `chattype:"task" json:"deadline,omitempty"`
   170  
   171  	// Is task deadline expired
   172  	DeadlineExpired bool `chattype:"task" json:"deadline_expired,omitempty"`
   173  
   174  	// Links in description
   175  	Links MessageLinks `chattype:"task" json:"links,omitempty"`
   176  
   177  	// Task tags list, if any
   178  	Tags []string `chattype:"task" json:"tags,omitempty"`
   179  
   180  	// Task importance, if available in team
   181  	Importance *int `chattype:"task" json:"importance,omitempty"`
   182  
   183  	// Task urgency, if available in team
   184  	Urgency *int `chattype:"task" json:"urgency,omitempty"`
   185  
   186  	// Task spent time, number
   187  	SpentTime *int `chattype:"task" json:"spent_time,omitempty"`
   188  
   189  	// Task complexity, number
   190  	Complexity *int `chattype:"task" json:"complexity,omitempty"`
   191  
   192  	// Used for "Create task from messages..."
   193  	LinkedMessages []interface{} `chattype:"task" json:"linked_messages,omitempty"`
   194  
   195  	// Upload uids for request, upload objects for response
   196  	Uploads []Upload `chattype:"task" json:"uploads,omitempty"`
   197  
   198  	// Checklist items. Task only
   199  	Items []TaskItem `chattype:"task" json:"items,omitempty"`
   200  
   201  	// Parent tasks
   202  	Parents []Subtask `chattype:"task" json:"parents,omitempty"`
   203  
   204  	// Tab names
   205  	Tabs []TaskTabKey `chattype:"task" json:"tabs,omitempty"`
   206  
   207  	// My status in group chat
   208  	Status *GroupStatus `chattype:"group" json:"status,omitempty"`
   209  
   210  	// Group chat members
   211  	Members []GroupMembership `chattype:"group" json:"members,omitempty"`
   212  
   213  	// Can I add member to this group chat
   214  	CanAddMember bool `chattype:"group" json:"can_add_member,omitempty"`
   215  
   216  	// Can I remove member from this group chat
   217  	CanRemoveMember bool `chattype:"group" json:"can_remove_member,omitempty"`
   218  
   219  	// Can I change member status in this group chat
   220  	CanChangeMemberStatus bool `chattype:"group" json:"can_change_member_status,omitempty"`
   221  
   222  	// deprecated: use changeable fields
   223  	CanChangeSettings bool `chattype:"group" json:"can_change_settings,omitempty"`
   224  
   225  	// Any new team member will be added to this group chat
   226  	DefaultForAll bool `chattype:"group" json:"default_for_all,omitempty"`
   227  
   228  	// Readonly for non-admins group chat (Like Channels in Telegram but switchable)
   229  	ReadonlyForMembers bool `chattype:"group" json:"readonly_for_members,omitempty"`
   230  
   231  	// Delete messages in this chat in seconds. Experimental function
   232  	AutocleanupAge *int `chattype:"group" json:"autocleanup_age,omitempty"`
   233  
   234  	// Can other team member see this task/group chat
   235  	Public bool `chattype:"group,task" json:"public,omitempty"`
   236  
   237  	// Can I join to this public group/task
   238  	CanJoin bool `chattype:"group,task" json:"can_join,omitempty"`
   239  
   240  	// Can I delete any message in this chat
   241  	CanDeleteAnyMessage bool `json:"can_delete_any_message,omitempty"`
   242  
   243  	// Can I change Important flag in any message in this chat
   244  	CanSetImportantAnyMessage bool `json:"can_set_important_any_message,omitempty"`
   245  
   246  	// Can I mute all in call
   247  	CanMuteAll bool `json:"can_mute_all,omitempty"`
   248  
   249  	// Date of the last message sent even if it was deleted
   250  	LastActivity ISODateTimeString `json:"last_activity,omitempty"`
   251  
   252  	// Deprecated: use DraftRevision instead.
   253  	DraftNum int64 `json:"draft_num,omitempty"`
   254  
   255  	// Start date of meeting chat
   256  	MeetingStartAt ISODateTimeString `json:"meeting_start_at,omitempty"`
   257  
   258  	// Meeting has frequency
   259  	MeetingFreq bool `json:"meeting_freq,omitempty"`
   260  
   261  	// Meeting duration
   262  	MeetingDuration int32 `json:"meeting_duration,omitempty"`
   263  
   264  	// Parent message uid for thread
   265  	ParentMessageId string `json:"parent_message_id,omitempty"`
   266  
   267  	// Parent chat uid for thread
   268  	ParentChatId JID `json:"parent_chat_id,omitempty"`
   269  }
   270  
   271  // Link to sub/sup task
   272  type Subtask struct {
   273  	// Task id
   274  	Jid JID `json:"jid"`
   275  
   276  	// Assignee contact id. Tasks only
   277  	Assignee JID `json:"assignee"`
   278  
   279  	// Task title. Generated from number and description
   280  	Title string `json:"title"`
   281  
   282  	// Task number in this team
   283  	Num uint `json:"num"`
   284  
   285  	// Title
   286  	DisplayName string `json:"display_name"`
   287  
   288  	// Is task or group public for non-guests
   289  	Public bool `json:"public,omitempty"`
   290  
   291  	// Subtask task status
   292  	TaskStatus string `json:"task_status,omitempty"`
   293  
   294  	// Subtask deadline in iso format, if any
   295  	Deadline ISODateTimeString `json:"deadline,omitempty"`
   296  
   297  	// Is subtask deadline expired
   298  	DeadlineExpired bool `json:"deadline_expired,omitempty"`
   299  
   300  	// Subtask importance, if available in team
   301  	Importance *int `chattype:"task" json:"importance,omitempty"`
   302  
   303  	// Subtask complexity, number
   304  	Complexity *int `chattype:"task" json:"complexity,omitempty"`
   305  }
   306  
   307  // Task checklist item
   308  type TaskItem struct {
   309  	// Id
   310  	Uid string `json:"uid,omitempty"`
   311  
   312  	// Object version
   313  	Gentime int64 `json:"gentime" tdproto:"readonly"`
   314  
   315  	// Sort ordering
   316  	SortOrdering uint `json:"sort_ordering,omitempty"`
   317  
   318  	// Text or "#{OtherTaskNumber}"
   319  	Text string `json:"text"`
   320  
   321  	// Item checked
   322  	Checked bool `json:"checked,omitempty"`
   323  
   324  	// Can I toggle this item
   325  	CanToggle bool `json:"can_toggle,omitempty"`
   326  
   327  	// Can I change this item
   328  	CanChange bool `json:"can_change,omitempty"`
   329  
   330  	// Link to subtask. Optional
   331  	Subtask *Subtask `json:"subtask,omitempty"`
   332  }
   333  
   334  // Group chat membership status
   335  type GroupMembership struct {
   336  	// Contact id
   337  	Jid JID `json:"jid"`
   338  
   339  	// Status in group
   340  	Status GroupStatus `json:"status,omitempty"`
   341  
   342  	// Can I remove this member
   343  	CanRemove bool `json:"can_remove,omitempty"`
   344  }