github.com/tada-team/tdproto@v1.51.57/server_processing.go (about) 1 package tdproto 2 3 func NewServerProcessing(num, total int, action, message, body string, hasError bool, actionType ActionType) (r ServerProcessing) { 4 r.Name = r.GetName() 5 r.Params.Action = action 6 r.Params.ActionType = actionType 7 r.Params.Message = message 8 r.Params.HasError = hasError 9 r.Params.Num = num 10 r.Params.Total = total 11 r.Params.Body = body 12 return r 13 } 14 15 // Status of background operation 16 type ServerProcessing struct { 17 BaseEvent 18 Params serverProcessingParams `json:"params"` 19 } 20 21 func (p ServerProcessing) GetName() string { return "server.processing" } 22 23 // Params of the server.processing event 24 type serverProcessingParams struct { 25 // Action name 26 Action string `json:"action"` 27 28 // ActionType. Ex: [contact_import || task_import || archive_unpacking || generate_chats] 29 ActionType ActionType `json:"action_type,omitempty"` 30 31 // Message 32 Message string `json:"message"` 33 34 // Body 35 Body string `json:"body,omitempty"` 36 37 // Has error 38 HasError bool `json:"has_error"` 39 40 // Current processing item 41 Num int `json:"num"` 42 43 // Total processing items 44 Total int `json:"total"` 45 }