slack

package
v0.0.0-...-ce8b31d Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	CustomizeEmojiPath string
	EmojiAddPath       string
	EmojiAdminListPath string
	EmojiRemovePath    string
	Emojis             map[string]Emoji

	TeamName string
	// contains filtered or unexported fields
}

Client provides a simple interface for interacting with the Slack API.

func NewSlackClient

func NewSlackClient(slackTeamName, slackCookie string) (client *Client, err error)

NewSlackClient instantiates a Slack client to a single team for emoji upload.

func (*Client) APIToken

func (client *Client) APIToken() (apiToken string, err error)

APIToken retrieves and returns the API token from an emoji customization call.

func (*Client) CustomizeEmojiURI

func (client *Client) CustomizeEmojiURI() (uri string)

CustomizeEmojiURI returns the URI of the customize/emoji endpoint.

func (*Client) DeleteEmoji

func (client *Client) DeleteEmoji(emojiName string) (err error)

DeleteEmoji deletes a single emoji identified by its name from the connected Slack team's custom emojis.

func (*Client) DeleteEmojis

func (client *Client) DeleteEmojis() (err error)

DeleteEmojis deletes all custom emojis from the connected Slack team.

func (*Client) EmojiAddURI

func (client *Client) EmojiAddURI() (uri string)

EmojiAddURI returns the URI of the api/emoji.add endpoint.

func (*Client) EmojiAdminListURI

func (client *Client) EmojiAdminListURI() (uri string)

EmojiAdminListURI returns the URI of the api/emoji.adminList endpoint.

func (*Client) EmojiRemoveURI

func (client *Client) EmojiRemoveURI() (uri string)

EmojiRemoveURI returns the URI of the api/emoji.remove endpoint.

func (*Client) GetEmojis

func (client *Client) GetEmojis() (emojis map[string]Emoji, err error)

GetEmojis returns the available custom emojis by name in a Slack team.

func (*Client) Host

func (client *Client) Host() (host string)

Host returns the Slack host URL for the configured team.

func (*Client) PostEmoji

func (client *Client) PostEmoji(emojiName, emojiPath string) (err error)

PostEmoji uploads an emoji file specified with its path under the given name.

func (*Client) PostEmojis

func (client *Client) PostEmojis(emojiDirectoryPath, emojiAliasPrefix, emojiAliasSuffix, emojiAliasTakenPrefix, emojiAliasTakenSuffix string) (err error)

PostEmojis uploads all emojis in the specified directory using the file's name without extension as the emoji name prefixed and suffixed with the specified qualifiers.

type Emoji

type Emoji struct {
	AliasFor        string   `json:"alias_for"`
	AvatarHash      string   `json:"avatar_hash"`
	CanDelete       bool     `json:"can_delete"`
	Created         int64    `json:"created"`
	IsAlias         int      `json:"is_alias"`
	IsBad           bool     `json:"is_bad"`
	Name            string   `json:"name"`
	Synonyms        []string `json:"synonyms"`
	TeamID          string   `json:"team_id"`
	URL             string   `json:"url"`
	UserDisplayName string   `json:"user_display_name"`
	UserID          string   `json:"user_id"`
}

Emoji encapsulates the available information on a single Slack emoji.

type EmojiListResponse

type EmojiListResponse struct {
	CustomEmojiTotalCount int64   `json:"custom_emoji_total_count"`
	DisabledEmojis        []Emoji `json:"disabled_emoji"`
	Emojis                []Emoji `json:"emoji"`
	IsOk                  bool    `json:"ok"`
	Paging                Paging  `json:"paging"`
}

EmojiListResponse describes the Slack response for the emoji listing request.

type Paging

type Paging struct {
	Page           int `json:"page"`
	PageCount      int `json:"pages"`
	PageSize       int `json:"count"`
	TotalItemCount int `json:"total"`
}

Paging describes the page information of a Slack response.

Jump to

Keyboard shortcuts

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