slack

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderType = domain.ProviderType("slack")

Variables

This section is empty.

Functions

func NewErr

func NewErr(statusCode int, systemCode, message, internal string, isFatal bool) domain.IError

func NewSlackProvider

func NewSlackProvider(httpClient provider.IHTTPClient) provider.Provider

Types

type Channel

type Channel struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Client

type Client struct {
	HTTPClient provider.IHTTPClient
}

func (*Client) GetChannels

func (c *Client) GetChannels(request *GetChannelsRequest) ([]map[string]string, domain.IError)

func (*Client) SendMessage

func (c *Client) SendMessage(request *SendMessageRequest) (*SendMessageResponse, domain.IError)

type GetChannelsRequest

type GetChannelsRequest struct {
	BearerToken string `json:"_"`
}

type GetChannelsResponse

type GetChannelsResponse struct {
	Ok               bool             `json:"ok"`
	Channels         []Channel        `json:"channels"`
	ResponseMetadata ResponseMetadata `json:"response_metadata"`
}

type Opts

type Opts struct {
	Secret  *domain.NotifierSecret
	Channel string `mapstructure:"channel"`
}

func (*Opts) Extract

func (*Opts) Validate

func (o *Opts) Validate() domain.IError

type Payload

type Payload struct {
	Text   string      `json:"text"`
	Blocks interface{} `json:"blocks"`
}

func (*Payload) Extract

func (p *Payload) Extract(body []byte) domain.IError

func (*Payload) Validate

func (p *Payload) Validate() domain.IError

type ResponseMetadata added in v1.1.1

type ResponseMetadata struct {
	NextCursor string `json:"next_cursor"`
}

type SendMessageRequest

type SendMessageRequest struct {
	Channel     string      `json:"channel"`
	Blocks      interface{} `json:"blocks,omitempty"`
	Text        string      `json:"text,omitempty"`
	BearerToken string      `json:"-"`
}

type SendMessageResponse

type SendMessageResponse struct {
	Ok bool `json:"ok"`
}

Jump to

Keyboard shortcuts

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