summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sromku/go-gitter/model.go
blob: 7a3d0729544f3c86cebee7cd37dccb0da5a02b1e (plain) (blame)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package gitter

import "time"

// A Room in Gitter can represent a GitHub Organization, a GitHub Repository, a Gitter Channel or a One-to-one conversation.
// In the case of the Organizations and Repositories, the access control policies are inherited from GitHub.
type Room struct {

	// Room ID
	ID string `json:"id"`

	// Room name
	Name string `json:"name"`

	// Room topic. (default: GitHub repo description)
	Topic string `json:"topic"`

	// Room URI on Gitter
	URI string `json:"uri"`

	// Indicates if the room is a one-to-one chat
	OneToOne bool `json:"oneToOne"`

	// Count of users in the room
	UserCount int `json:"userCount"`

	// Number of unread messages for the current user
	UnreadItems int `json:"unreadItems"`

	// Number of unread mentions for the current user
	Mentions int `json:"mentions"`

	// Last time the current user accessed the room in ISO format
	LastAccessTime time.Time `json:"lastAccessTime"`

	// Indicates if the current user has disabled notifications
	Lurk bool `json:"lurk"`

	// Path to the room on gitter
	URL string `json:"url"`

	// Type of the room
	// - ORG: A room that represents a GitHub Organization.
	// - REPO: A room that represents a GitHub Repository.
	// - ONETOONE: A one-to-one chat.
	// - ORG_CHANNEL: A Gitter channel nested under a GitHub Organization.
	// - REPO_CHANNEL A Gitter channel nested under a GitHub Repository.
	// - USER_CHANNEL A Gitter channel nested under a GitHub User.
	GithubType string `json:"githubType"`

	// Tags that define the room
	Tags []string `json:"tags"`

	RoomMember bool `json:"roomMember"`

	// Room version.
	Version int `json:"v"`
}

type User struct {

	// Gitter User ID
	ID string `json:"id"`

	// Gitter/GitHub username
	Username string `json:"username"`

	// Gitter/GitHub user real name
	DisplayName string `json:"displayName"`

	// Path to the user on Gitter
	URL string `json:"url"`

	// User avatar URI (small)
	AvatarURLSmall string `json:"avatarUrlSmall"`

	// User avatar URI (medium)
	AvatarURLMedium string `json:"avatarUrlMedium"`
}

type Message struct {

	// ID of the message
	ID string `json:"id"`

	// Original message in plain-text/markdown
	Text string `json:"text"`

	// HTML formatted message
	HTML string `json:"html"`

	// ISO formatted date of the message
	Sent time.Time `json:"sent"`

	// ISO formatted date of the message if edited
	EditedAt time.Time `json:"editedAt"`

	// User that sent the message
	From User `json:"fromUser"`

	// Boolean that indicates if the current user has read the message.
	Unread bool `json:"unread"`

	// Number of users that have read the message
	ReadBy int `json:"readBy"`

	// List of URLs present in the message
	Urls []URL `json:"urls"`

	// List of @Mentions in the message
	Mentions []Mention `json:"mentions"`

	// List of #Issues referenced in the message
	Issues []Issue `json:"issues"`

	// Version
	Version int `json:"v"`
}

// Mention holds data about mentioned user in the message
type Mention struct {

	// User's username
	ScreenName string `json:"screenName"`

	// Gitter User ID
	UserID string `json:"userID"`
}

// Issue references issue in the message
type Issue struct {

	// Issue number
	Number string `json:"number"`
}

// URL presented in the message
type URL struct {

	// URL
	URL string `json:"url"`
}