Documentation
¶
Index ¶
Constants ¶
const ( // Timeout specifies a time limit for requests made by the // Workplace Client. Timeout = time.Second * 20 )
Variables ¶
This section is empty.
Functions ¶
func ChunkMessage ¶ added in v0.0.3
ChunkMessage splits a string by length according to the chunkSize.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the HTTP client for posting and returning data from the Workplace API.
func (*Client) Notify ¶
func (c *Client) Notify(tx Transmission) error
Notify sends a transmission to the corresponding thread with a preformatted message.
Returns an error if the message could not be marshalled, sent or there was an error creating the request.
type Config ¶
type Config struct {
Token string
}
Config is the configuration passed to create a new Workplace client.
type Notifier ¶
type Notifier interface {
// Notify sends a transmission to the corresponding thread with
// a preformatted message.
//
// Returns an error if the message could not be marshalled,
// sent or there was an error creating the request.
Notify(tx Transmission) error
}
Notifier defines the single method interface that transmits messages to a workplace thread.
type Transmission ¶
type Transmission struct {
// Thread is the corresponding thread ID to send via workplace.
Thread string `json:"thread" validate:"required" example:"t_111222333"`
// Message is the formatted text message that will be sent
// via workplace.
Message string `json:"message" validate:"required" example:"Hey there!"`
}
Transmission represents the data needed in order to send a message via the Workplace API.