hipchat

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2017 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package hipchat is used for implementing a StatusService in BusyBee.

It is not recommended to use this package outside of BusyBee. To use with BusyBee make sure to import this package. You can do so by adding the following:

import _ "github.com/dixonwille/busybee/hipchat"

But since you will need the Configuration Struct it may just be easier to use it like normal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conf interface{}, bb *busybee.BusyBee) (busybee.UpdateStatuser, error)

New returns a new instance of Hipchat.

func NewConf added in v0.1.2

func NewConf() interface{}

NewConf creates a new Hipchat configuration.

Types

type Conf added in v0.1.2

type Conf struct {
	Host  string `quest:"What is the hipchat host?"`
	Token string `quest:"What is your hipchat token?,encrypt"`
}

Conf holds all the needed information to create a new hipchat service.

type Error

type Error struct {
	Error *ErrorBody `json:"error"`
}

Error is a response from hipchat that returns an error.

func NewError

func NewError() *Error

NewError returns a new instance of HipchatError.

func (*Error) Decode

func (he *Error) Decode(reader io.Reader) error

Decode reads from reader and updates the model with the data.

type ErrorBody

type ErrorBody struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Type    string `json:"type"`
}

ErrorBody is the main body of the error response.

type Hipchat

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

Hipchat is of type StatusService that can be used to get and update the status of a user.

func (*Hipchat) GetUser

func (h *Hipchat) GetUser(uid string) (*User, error)

GetUser gets the hipchat user with uid. uid is the users @Mention name.

func (*Hipchat) UpdateStatus

func (h *Hipchat) UpdateStatus(uid string, status busybee.Status) error

UpdateStatus will update the status of the user to the status specified. Will not update if the user is already on specified status. Updates the show if in meeting to DnD always. Updates the show if DnD to Available but never Away to Available. Updates the Status message to "In a meeting (BusyBee)" if changing to DnD. Updates the Status message to "I'm free (BusyBee)" if changing to Available.

type User

type User struct {
	ID          int           `json:"id,omitempty"`
	Name        string        `json:"name"`
	MentionName string        `json:"mention_name"`
	Presence    *UserPresence `json:"presence"`
	Email       string        `json:"email"`
	Roles       []string      `json:"roles"`
	Title       string        `json:"title"`
	GroupAdmin  bool          `json:"is_group_admin"`
	TimeZone    string        `json:"timezone"`
}

User is a user in hipchat.

func NewUser

func NewUser() *User

NewUser creates a new instance of a hipchat user.

func (*User) Decode

func (hu *User) Decode(reader io.Reader) error

Decode reads from reader and updates the model with the data.

func (*User) Encode

func (hu *User) Encode(writer io.Writer) error

Encode takes the model and writes it to writer.

type UserPresence

type UserPresence struct {
	Status string `json:"status"`
	Show   string `json:"show"`
}

UserPresence is part of the body in a hipchat user. This states whether the user is busy or not "show" and a reason "status".

Jump to

Keyboard shortcuts

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