-
Notifications
You must be signed in to change notification settings - Fork 102
/
messageStatistics.go
executable file
·53 lines (43 loc) · 1.44 KB
/
messageStatistics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// AUTOGENERATED - DO NOT EDIT
package tdlib
import (
"encoding/json"
)
// MessageStatistics A detailed statistics about a message
type MessageStatistics struct {
tdCommon
MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` // A graph containing number of message views and shares
}
// MessageType return the string telegram-type of MessageStatistics
func (messageStatistics *MessageStatistics) MessageType() string {
return "messageStatistics"
}
// NewMessageStatistics creates a new MessageStatistics
//
// @param messageInteractionGraph A graph containing number of message views and shares
func NewMessageStatistics(messageInteractionGraph StatisticalGraph) *MessageStatistics {
messageStatisticsTemp := MessageStatistics{
tdCommon: tdCommon{Type: "messageStatistics"},
MessageInteractionGraph: messageInteractionGraph,
}
return &messageStatisticsTemp
}
// UnmarshalJSON unmarshal to json
func (messageStatistics *MessageStatistics) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
tempObj := struct {
tdCommon
}{}
err = json.Unmarshal(b, &tempObj)
if err != nil {
return err
}
messageStatistics.tdCommon = tempObj.tdCommon
fieldMessageInteractionGraph, _ := unmarshalStatisticalGraph(objMap["message_interaction_graph"])
messageStatistics.MessageInteractionGraph = fieldMessageInteractionGraph
return nil
}