Documentation
¶
Overview ¶
Package hipchat provides a client library for the Hipchat REST API.
Index ¶
Constants ¶
View Source
const ( ColorYellow = "yellow" ColorRed = "red" ColorGreen = "green" ColorPurple = "purple" ColorGray = "gray" ColorRandom = "random" FormatText = "text" FormatHTML = "html" ResponseStatusSent = "sent" )
View Source
const (
ISO8601 = "2006-01-02T15:04:05-0700"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResponse ¶
type AuthResponse struct {
Success, Error *HipchatError
}
type Client ¶
type Client struct {
AuthToken string
BaseURL string
Timeout time.Duration
Transport http.RoundTripper
}
func NewClient ¶
NewClient allocates and returns a Client with the given authToken. By default, the client will use the publicly available HipChat servers. For internal or custom servers, set the BaseURL field of the Client.
func (*Client) PostMessage ¶
func (c *Client) PostMessage(req MessageRequest) error
type ErrorResponse ¶
type ErrorResponse struct {
Error HipchatError
}
type HipchatError ¶
func (HipchatError) Error ¶
func (e HipchatError) Error() string
type Message ¶
type Message struct {
// Date message was sent in ISO-8601 format in request timezone.
ISODate string `json:"date"`
// Name and user_id of sender. user_id will be "api" for API messages and "guest" for guest messages.
From struct {
Name string
UserId interface{} `json:"user_id"`
}
// Message body.
Message string
// Name, size, and URL of uploaded file.
File struct {
Name string
Size int
URL string
}
}
type MessageRequest ¶
type MessageRequest struct {
// Required. ID or name of the room.
RoomId string
// Required. Name the message will appear to be sent from. Must be less
// than 15 characters long. May contain letters, numbers, -, _, and spaces.
From string
// Required. The message body. 10,000 characters max.
Message string
// Determines how the message is treated by our server and rendered
// inside HipChat applications.
// html - Message is rendered as HTML and receives no special treatment.
// Must be valid HTML and entities must be escaped (e.g.: & instead of &).
// May contain basic tags: a, b, i, strong, em, br, img, pre, code.
// Special HipChat features such as @mentions, emoticons, and image previews
// are NOT supported when using this format.
// text - Message is treated just like a message sent by a user. Can include
// @mentions, emoticons, pastes, and auto-detected URLs (Twitter, YouTube, images, etc).
// (default: html)
MessageFormat string
// Whether or not this message should trigger a notification for people
// in the room (change the tab color, play a sound, etc). Each recipient's
// notification preferences are taken into account. 0 = false, 1 = true.
// (default: 0)
Notify bool
// Background color for message. One of "yellow", "red", "green",
// "purple", "gray", or "random".
// (default: yellow)
Color string
// Whether to test authentication. Note: the normal actions will NOT be performed.
// (default: false)
AuthTest bool
}
type Room ¶
type Room struct {
// The ID of the room.
Id int `json:"room_id"`
// The name of the room.
Name string
// The current room topic.
Topic string
// Time of last activity (sent message) in the room in UNIX time (UTC).
// May be 0 in rare cases when the time is unknown.
LastActive int `json:"last_active"`
// Time the room was created in UNIX time (UTC).
Created int
// Whether or not this room is archived.
Archived bool `json:"is_archived"`
// Whether or not this room is private.
Private bool `json:"is_private"`
// User ID of the room owner.
OwnerUserId int `json:"owner_user_id"`
// XMPP/Jabber ID of the room.
XMPPJabberId string `json:"xmpp_jid"`
}
Click to show internal directories.
Click to hide internal directories.