Documentation ¶
Overview ¶
Package structures provides functions to parse Slack data types.
Index ¶
- Variables
- func FormatSlackTS(ts time.Time) string
- func HasExcludePrefix(s string) bool
- func IsURL(s string) bool
- func IsValidSlackURL(s string) bool
- func ParseSlackTS(timestamp string) (time.Time, error)
- func ParseThreadID(threadID string) (time.Time, error)
- func ResolveURLs(idsOrURLs []string) ([]string, error)
- type EntityList
- type SlackLink
- type UserIndex
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FormatSlackTS ¶
func HasExcludePrefix ¶ added in v2.0.1
func IsValidSlackURL ¶ added in v2.0.1
IsValidSlackURL returns true if the value looks like valid Slack URL, false if not.
func ParseSlackTS ¶
ParseSlackTS parses the slack timestamp.
func ParseThreadID ¶
ParseThreadID parses the thread id (ie. p1577694990000400) and returns time.Time.
func ResolveURLs ¶ added in v2.0.1
ResolveURLs normalises all channels to ID form. If the idsOrURLs[i] is a channel ID, it is unmodified, if it is URL - it is parsed and replaced with the channel ID. If the channel is marked for exclusion in the list it will retain this status.
Types ¶
type EntityList ¶ added in v2.0.1
EntityList is an Inclusion/Exclusion list
func LoadEntityList ¶ added in v2.0.1
func LoadEntityList(filename string) (*EntityList, error)
MakeEntityList creates an EntityList from a slice of IDs or URLs (entites).
func MakeEntityList ¶ added in v2.0.1
func MakeEntityList(entities []string) (*EntityList, error)
MakeEntityList creates an EntityList from a slice of IDs or URLs (entites).
func (*EntityList) HasExcludes ¶ added in v2.0.1
func (el *EntityList) HasExcludes() bool
func (*EntityList) HasIncludes ¶ added in v2.0.1
func (el *EntityList) HasIncludes() bool
func (*EntityList) Index ¶ added in v2.0.1
func (el *EntityList) Index() map[string]bool
Index returns a map where key is entity, and value show if the entity should be processed (true) or not (false).
func (*EntityList) IsEmpty ¶ added in v2.0.1
func (el *EntityList) IsEmpty() bool
type SlackLink ¶ added in v2.0.1
func ParseLink ¶ added in v2.0.1
ParseLink parses the slack link string. It supports the following formats:
- XXXXXXX - channel ID
- XXXXXXX:99999999.99999 - channel ID and thread ID
- https://<valid slack URL> - slack URL link.
It returns the SlackLink or error.
func ParseURL ¶
ParseURL parses the slack link in the format of https://xxxx.slack.com/archives/XXXXX[/p99999999]
type UserIndex ¶
UserIndex is a mapping of user ID to the *slack.User.
func NewUserIndex ¶
NewUserIndex creates a new UserIndex from slack Users slice
func (UserIndex) ChannelName ¶
ChannelName return the "beautified" name of the channel.
func (UserIndex) IsDeleted ¶
IsDeleted checks if the user is deleted and returns appropriate value. It will assume user is not deleted, if it's not present in the user index.