diff options
author | Wim <wim@42.be> | 2016-09-04 20:03:07 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-09-04 20:04:43 +0200 |
commit | 12389d602eecf4adab0e394da19b2b808cb489b1 (patch) | |
tree | 80d6d8c00ed31fdcd60540d7c65afa6e7d2d83d6 /vendor/github.com/sromku/go-gitter/model.go | |
parent | 44144587a0314b7e2c719d279116ac86b657657e (diff) | |
download | matterbridge-msglm-12389d602eecf4adab0e394da19b2b808cb489b1.tar.gz matterbridge-msglm-12389d602eecf4adab0e394da19b2b808cb489b1.tar.bz2 matterbridge-msglm-12389d602eecf4adab0e394da19b2b808cb489b1.zip |
Add Gitter support
Diffstat (limited to 'vendor/github.com/sromku/go-gitter/model.go')
-rw-r--r-- | vendor/github.com/sromku/go-gitter/model.go | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/vendor/github.com/sromku/go-gitter/model.go b/vendor/github.com/sromku/go-gitter/model.go new file mode 100644 index 00000000..7a3d0729 --- /dev/null +++ b/vendor/github.com/sromku/go-gitter/model.go @@ -0,0 +1,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"` +} |