client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlackClient

type SlackClient struct {
	Client     *http.Client
	BaseURL    string
	OAuthToken string
}

SlackClient client for slack api calls

func (SlackClient) AttachFileTo

func (client SlackClient) AttachFileTo(channel string, pathToFile string, filename string) ([]byte, int, error)

AttachFileTo method for attachment file send to specific channel

func (SlackClient) Get

func (client SlackClient) Get(endpoint string) ([]byte, int, error)

Get method for GET http requests

func (SlackClient) GetConversationsList

func (client SlackClient) GetConversationsList() (dto.SlackResponseConversationsList, int, error)

GetConversationsList method which returns the conversations list of current workspace

func (SlackClient) GetUsersList

func (client SlackClient) GetUsersList() (dto.SlackResponseUsersList, int, error)

GetUsersList method which returns the users list of current workspace

func (SlackClient) Post

func (client SlackClient) Post(endpoint string, body []byte) ([]byte, int, error)

Post method for POST http requests

func (SlackClient) Put

func (client SlackClient) Put(endpoint string, body []byte) ([]byte, int, error)

Put method for PUT http requests

func (SlackClient) Request

func (client SlackClient) Request(method string, url string, body []byte) ([]byte, int, error)

Request method for API requests

func (SlackClient) SendMessage

SendMessage method for post message send through simple API request

func (SlackClient) SendMessageToWs

func (client SlackClient) SendMessageToWs(ws *websocket.Conn, m dto.SlackRequestEventMessage) error

SendMessageToWs sends message to selected WebSocket EventsAPI

type SlackClientInterface

type SlackClientInterface interface {
	//Http methods
	Request(string, string, []byte) ([]byte, int, error)
	Post(string, []byte) ([]byte, int, error)
	Get(string) ([]byte, int, error)
	Put(string, []byte) ([]byte, int, error)

	//Methods for slackAPI endpoints
	GetConversationsList() (dto.SlackResponseConversationsList, int, error)
	GetUsersList() (dto.SlackResponseUsersList, int, error)
	SendMessageToWs(*websocket.Conn, dto.SlackRequestEventMessage) error

	//PM messages
	SendMessage(dto.SlackRequestChatPostMessage) (dto.SlackResponseChatPostMessage, int, error)

	//Send attachment
	AttachFileTo(channel string, pathToFile string, filename string) ([]byte, int, error)
}

SlackClientInterface interface for slack client

Jump to

Keyboard shortcuts

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