hipchat

package module
v0.0.0-...-8d19fba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2015 License: ISC Imports: 10 Imported by: 0

Documentation

Overview

Package hipchat provides programtic interaction with HipChat's API

Index

Examples

Constants

This section is empty.

Variables

View Source
var BaseURL = "https://api.hipchat.com/v2/"
View Source
var ErrUnknown = errors.New("An unknown error occurred.")

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the primary struct that this package provides. It represents the connection to the HipChat API

func NewClient

func NewClient(authToken string) (*Client, error)
Example
authToken := "le api token here"
client, err := hipchat.NewClient(authToken)
_ = client
fmt.Println(err)
Output:

<nil>

func (*Client) GetRoom

func (c *Client) GetRoom(name_or_id string) (*Room, error)

func (*Client) GetUser

func (c *Client) GetUser(id_or_email string) (*User, error)

func (*Client) Rooms

func (c *Client) Rooms() ([]Room, error)

func (*Client) SendNotification

func (c *Client) SendNotification(room string, message string, color Color) error

SendNotification sends a notification the the room

func (*Client) TraceOff

func (c *Client) TraceOff()

TraceOff turns on API response tracing

func (*Client) TraceOn

func (c *Client) TraceOn(logger *log.Logger)

TraceOn turns on API response tracing to the given logger.

func (*Client) Users

func (c *Client) Users() ([]User, error)

type Color

type Color string
const (
	Yellow Color = "yellow"
	Green  Color = "green"
	Red    Color = "red"
	Purple Color = "purple"
	Gray   Color = "gray"
	Random Color = "random"
)

type Error

type Error struct {
	Code    float64 `json:"code"`
	Message string  `json:"message"`
	Type    string  `json:"type"`
}

func (Error) Error

func (e Error) Error() string

type Room

type Room struct {
	ID                int         `json:"id"`
	Name              string      `json:"name"`
	Created           string      `json:"created"`
	Topic             string      `json:"topic"`
	GuestAccessURL    interface{} `json:"guest_access_url"`
	IsArchived        bool        `json:"is_archived"`
	IsGuestAccessible bool        `json:"is_guest_accessible"`
	LastActive        string      `json:"last_active"`
	Links             struct {
		Self     string `json:"self"`
		Webhooks string `json:"webhooks"`
	} `json:"links"`
	Owner struct {
		ID    int `json:"id"`
		Links struct {
			Self string `json:"self"`
		} `json:"links"`
		MentionName string `json:"mention_name"`
		Name        string `json:"name"`
	} `json:"owner"`
	Participants []struct {
		ID    int `json:"id"`
		Links struct {
			Self string `json:"self"`
		} `json:"links"`
		MentionName string `json:"mention_name"`
		Name        string `json:"name"`
	} `json:"participants"`
	Privacy    string `json:"privacy"`
	Statistics struct {
		Links struct {
			Self string `json:"self"`
		} `json:"links"`
	} `json:"statistics"`
	XmppJid string `json:"xmpp_jid"`
	// contains filtered or unexported fields
}

func (*Room) History

func (r *Room) History() (interface{}, error)

func (*Room) HistoryFrom

func (r *Room) HistoryFrom(from time.Time) (interface{}, error)

func (*Room) SendNotification

func (r *Room) SendNotification(message string, color Color) error

SendNotification sends a notification the the room

func (Room) String

func (r Room) String() string

type User

type User struct {
	ID          int         `json:"id"`
	Name        string      `json:"name"`
	MentionName string      `json:"mention_name"`
	Created     string      `json:"created"`
	AtlassianID interface{} `json:"atlassian_id"`
	Email       string      `json:"email"`
	Group       struct {
		ID    int `json:"id"`
		Links struct {
			Self string `json:"self"`
		} `json:"links"`
		Name string `json:"name"`
	} `json:"group"`
	IsDeleted    bool   `json:"is_deleted"`
	IsGroupAdmin bool   `json:"is_group_admin"`
	IsGuest      bool   `json:"is_guest"`
	LastActive   string `json:"last_active"`
	Links        struct {
		Self string `json:"self"`
	} `json:"links"`
	PhotoURL string `json:"photo_url"`
	Presence struct {
		Client struct {
			Type    string `json:"type"`
			Version string `json:"version"`
		} `json:"client"`
		IsOnline bool `json:"is_online"`
	} `json:"presence"`
	Timezone string `json:"timezone"`
	Title    string `json:"title"`
	XmppJid  string `json:"xmpp_jid"`
}

func (User) String

func (u User) String() string

Directories

Path Synopsis
cmd
hipchat
NAME hipchat − a cli for hipchat SYNOPSIS hipchat [OPTIONS] DESCRIPTION OPTIONS ‐v, ‐‐verbose Be verbose ‐a, ‐‐authToken Hipchat auth token ‐h, ‐‐help Show this help message COMMANDS send room notification Usage: hipchat [OPTIONS] notify [notify‐OPTIONS] ‐r, ‐‐room Room name or ID ‐m, ‐‐message Message to send ‐c, ‐‐color Color of message (yellow, green, red, purple, gray, ran‐ dom) ‐h, ‐‐help Show this help message
NAME hipchat − a cli for hipchat SYNOPSIS hipchat [OPTIONS] DESCRIPTION OPTIONS ‐v, ‐‐verbose Be verbose ‐a, ‐‐authToken Hipchat auth token ‐h, ‐‐help Show this help message COMMANDS send room notification Usage: hipchat [OPTIONS] notify [notify‐OPTIONS] ‐r, ‐‐room Room name or ID ‐m, ‐‐message Message to send ‐c, ‐‐color Color of message (yellow, green, red, purple, gray, ran‐ dom) ‐h, ‐‐help Show this help message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL