Documentation
¶
Index ¶
- Constants
- Variables
- func Decrypt(data string) string
- func DeleteInstallCallback(triggerID string) (err error)
- func Encrypt(data string) string
- func New() (db *leveldb.DB)
- func PutInstallCallback(triggerID string, data InstallCallback) error
- func PutOrg(org *OrganizationCredentials) error
- func PutOrgDepartments(slackTeamID string, data DepartmentCache) error
- func PutSlackUserToken(slackTeamID string, slackUserID string, token SlackToken) error
- func PutWIOMessage(slackTeamID string, message []WhoIsOutMessage) error
- type DepartmentCache
- type InstallCallback
- type OrganizationCredentials
- type SlackToken
- type TimeOff
- type TimeOffType
- type WhoIsOutMessage
- type WhoIsOutMessageEmployee
- type WhoIsOutMessageSlackUser
Constants ¶
const ( TeamPrefix = "TEAM" UserPrefix = "USER" WhoIsOutPrefix = "WIO" CallbackPrefix = "CALLBACK" DepartmentsPrefix = "DEPARTMENTS" )
Variables ¶
var Cryptokey []byte
var DB = New()
Functions ¶
func DeleteInstallCallback ¶
DeleteInstallCallback removes an installation callback meta information.
func PutInstallCallback ¶
func PutInstallCallback(triggerID string, data InstallCallback) error
PutInstallCallback saves an installation callback meta information to process with the further callback.
func PutOrg ¶
func PutOrg(org *OrganizationCredentials) error
PutOrg saves an organization credentials
func PutOrgDepartments ¶
func PutOrgDepartments(slackTeamID string, data DepartmentCache) error
PutOrgDepartments put a list of available departments to the cache
func PutSlackUserToken ¶
func PutSlackUserToken(slackTeamID string, slackUserID string, token SlackToken) error
PutSlackUserToken saves an auth token of the Slack user for the specific workspace.
func PutWIOMessage ¶
func PutWIOMessage(slackTeamID string, message []WhoIsOutMessage) error
PutWIOMessage refreshes the "who is out" message for the specific Slack workspace.
Types ¶
type DepartmentCache ¶
type DepartmentCache struct {
Departments map[int]string `json:"departments"`
ExpiresAt int64 `json:"expiresAt"`
}
DepartmentCache represents the list of departments in cache
func GetOrgDepartments ¶
func GetOrgDepartments(slackTeamID string) (*DepartmentCache, bool)
GetOrgDepartments gets a list of departments from the cache
type InstallCallback ¶
type InstallCallback struct {
ResponseURL string `json:"response_url"`
BambooHROrg string `json:"bamboohr_org"`
BambooHRSecret string `json:"bamboohr_secret"`
}
func GetInstallCallback ¶
func GetInstallCallback(triggerID string) (*InstallCallback, error)
GetInstallCallback gets an installation callback meta information.
type OrganizationCredentials ¶
type OrganizationCredentials struct {
SlackTeamID string `json:"-"`
SlackAdminUserID string `json:"admin_user"`
SlackToken SlackToken `json:"-"`
BambooHROrg string `json:"bamboohr_org"`
BambooHRSecret string `json:"bamboohr_secret"`
}
func GetOrg ¶
func GetOrg(slackTeamID string) (OrganizationCredentials, bool)
GetOrg gets an organization credentials for the specific Slack team
func GetOrgs ¶
func GetOrgs() []OrganizationCredentials
GetOrgs gets a list of all installed organizations with their credentials
type SlackToken ¶
type SlackToken slack.OAuthResponse
func GetSlackUserToken ¶
func GetSlackUserToken(slackTeamID string, slackUserID string) (SlackToken, bool)
GetSlackUserToken gets an auth token of the Slack user for the specific workspace.
type TimeOff ¶
type TimeOff struct {
Type *TimeOffType `json:"type"`
Start string `json:"start"`
End string `json:"end"`
}
type TimeOffType ¶
type TimeOffType struct {
OrderNumber int `json:"orderNumber"`
BambooHRType string `json:"bambooHRType"`
Text string `json:"text"`
Icon string `json:"icon"`
}
TimeOffType struct is used as the config definition
type WhoIsOutMessage ¶
type WhoIsOutMessage struct {
Employee WhoIsOutMessageEmployee `json:"employee"`
TimeOff TimeOff `json:"timeOff"`
}
WhoIsOutMessage is used to parse the who-is-out message
func GetWIOMessage ¶
func GetWIOMessage(slackTeamID string) ([]WhoIsOutMessage, error)
GetWIOMessage gets the "who is out" message for the specific Slack workspace, which is cached in the database and gets refreshed by the poller.
type WhoIsOutMessageEmployee ¶
type WhoIsOutMessageEmployee struct {
SlackUser WhoIsOutMessageSlackUser `json:"slack"`
Info *bamboohr.EmployeeInfo `json:"info,omitempty"`
}