slack

package
v0.0.0-...-22766d1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

API exports API of slack package

View Source
var Slack = Model{}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID         string
	Name       string
	Created    string
	Creator    string
	IsArchived bool
	IsGeneral  bool
	IsMember   bool
	IsStarred  bool
	// Members            array
	Topic    Topic
	Purpose  Purpose
	LastRead string
	// Latest             object
	UnreadCount        int
	UnreadCountDisplay int
	IsIM               bool
}

type Channels

type Channels struct {
	Len int
	// contains filtered or unexported fields
}

func (*Channels) AddChannels

func (cs *Channels) AddChannels(channels []slackApi.Channel)

func (*Channels) Get

func (cs *Channels) Get(i int) Channel

func (*Channels) GetByID

func (cs *Channels) GetByID(channelID string, userID string) Channel

GetByID returns a Channel by id

func (*Channels) GetChannels

func (cs *Channels) GetChannels(excludeArchived bool)

type IM

type IM struct {
	IsIM          bool   `json:"isIm"`
	User          string `json:"user"`
	IsUserDeleted bool   `json:"isUserDeleted"`
}

IM describes an instantMessageChannel

type IMs

type IMs struct {
	Len int
	// contains filtered or unexported fields
}

IMs is a list of IM

func (*IMs) AddIMs

func (ims *IMs) AddIMs(instantMessageChannels []slackApi.IM)

AddIMs parses IM channels from backend and saves them

func (*IMs) Close

func (ims *IMs) Close()

Close closes the currently open channel

func (*IMs) Get

func (ims *IMs) Get(i int) IM

Get returns an IM

func (*IMs) GetChannel

func (ims *IMs) GetChannel(i int) Channel

GetChannel returns a channel informations of an IM

func (*IMs) GetIMs

func (ims *IMs) GetIMs()

GetIMs returns all IM-channels

func (*IMs) Open

func (ims *IMs) Open(userID string)

Open opens an channel based on a userID and sets the current channel

type Message

type Message struct {
	Type       string `json:"type"`
	Channel    string `json:"channel"`
	User       string `json:"user"`
	Text       string `json:"text"`
	Timestamp  string `json:"timestamp"`
	IsStarred  bool   `json:"isStarred"`
	ID         int
	Processing bool `json:"processing"`
}

type Messages

type Messages struct {
	Len int
	// contains filtered or unexported fields
}

func (*Messages) Add

func (ms *Messages) Add(msg *slackApi.Msg)

func (*Messages) GetAll

func (ms *Messages) GetAll(channelID string) string

func (*Messages) GetAllWithHistory

func (ms *Messages) GetAllWithHistory(channelType string, channelID string, timestamp string) string

func (*Messages) GetLatest

func (ms *Messages) GetLatest(channelID string) Message

GetLatest returns the latest message for given channel

func (*Messages) MarkSent

func (ms *Messages) MarkSent(ID int)

func (*Messages) SendMessage

func (ms *Messages) SendMessage(channelID string, text string)

type Model

type Model struct {
	Messages Messages
	Users    Users
	Channels Channels
	IMs      IMs
}

SlackModel represents the entity models for storing information by @API

func (*Model) Connect

func (s *Model) Connect(tkn string)

Connect establishes a connection to slack API

func (*Model) Disconnect

func (s *Model) Disconnect()

Disconnect from slack API

type Purpose

type Purpose struct {
	Value   string
	Creator string
	LastSet string
}

type Topic

type Topic struct {
	Value   string
	Creator string
	LastSet string
}

type User

type User struct {
	Profile           UserProfile `json:"profile"`
	ID                string      `json:"id"`
	Name              string      `json:"name"`
	Deleted           bool        `json:"deleted"`
	Color             string      `json:"color"`
	RealName          string      `json:"realName"`
	TZ                string      `json:"tz"`
	TZLabel           string      `json:"tzLabel"`
	TZOffset          int         `json:"tzOffset"`
	IsBot             bool        `json:"isBot"`
	IsAdmin           bool        `json:"isAdmin"`
	IsOwner           bool        `json:"isOwner"`
	IsPrimaryOwner    bool        `json:"isPrimaryOwner"`
	IsRestricted      bool        `json:"isRestricted"`
	IsUltraRestricted bool        `json:"isUltraRestricted"`
	Has2FA            bool        `json:"has2FA"`
	HasFiles          bool        `json:"hasFiles"`
	Presence          string      `json:"presence"`
}

User is a Slack user accounts

type UserProfile

type UserProfile struct {
	FirstName          string `json:"firstName"`
	LastName           string `json:"lastName"`
	RealName           string `json:"realName"`
	RealNameNormalized string `json:"realNameNormalized"`
	Email              string `json:"email"`
	Skype              string `json:"skype"`
	Phone              string `json:"phone"`
	Image24            string `json:"image24"`
	Image32            string `json:"image32"`
	Image48            string `json:"image48"`
	Image72            string `json:"image72"`
	Image192           string `json:"image192"`
	ImageOriginal      string `json:"imageOriginal"`
	Title              string `json:"title"`
	BotID              string `json:"botId,omitempty"`
	APIAppID           string `json:"apiAppId,omitempty"`
}

UserProfile holds the personal information of a @User

type Users

type Users struct {
	Len int
	// contains filtered or unexported fields
}

Users holding collection of all users

func (*Users) AddUsers

func (us *Users) AddUsers(users []slackApi.User)

AddUsers converts users from backend

func (*Users) Get

func (us *Users) Get(ID string) string

Get returns a all (or a single user) as JSON string

Jump to

Keyboard shortcuts

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