Documentation ¶
Index ¶
- type Client
- func (c *Client) GetAccessToken() (string, error)
- func (c *Client) GetChannelID(groupID, channelNameOrID, accessToken string) (string, error)
- func (c *Client) GetGroupID(groupNameOrID, accessToken string) (string, error)
- func (c *Client) PostMessage(groupID, channelID, message, accessToken string, opts ...PostMsgOption) error
- type MSTeams
- type MessageContentType
- type NewOption
- type PostMsgOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages client side of Microsoft Graph api
func NewClient ¶
func NewClient(tenantID, clientID, clientSecret, username, password string, opts ...NewOption) *Client
NewClient creates a new client of MSTeams
func (*Client) GetAccessToken ¶
GetAccessToken returns an access token on behalf of a user
func (*Client) GetChannelID ¶
GetChannelID implements the Microsoft Teams GetChannelID function
func (*Client) GetGroupID ¶
GetGroupID implements the Microsoft Teams GetGroupID function
func (*Client) PostMessage ¶
func (c *Client) PostMessage(groupID, channelID, message, accessToken string, opts ...PostMsgOption) error
PostMessage implements the Microsoft Teams PostMessage function
type MSTeams ¶
type MSTeams interface { // GetAccessToken returns an access token on behalf of a user GetAccessToken() (string, error) //PostMessage posts message to the given Microsoft Teams group and channel PostMessage(groupID, channelID, message, accessToken string, opts ...PostMsgOption) error // GetGroupID returns group id from group name or id GetGroupID(groupNameOrID, accessToken string) (string, error) // GetGroupID returns channel id from channel name or id GetChannelID(groupID, channelNameOrID, accessToken string) (string, error) }
MSTeams is the interface of Microsoft Teams using Microsoft Graph api
type MessageContentType ¶
type MessageContentType string
MessageContentType defines a message content type
const ( PlainText MessageContentType = "text" HTML MessageContentType = "html" )
type NewOption ¶
type NewOption func(*Client)
NewOption allows specifying various configuration
func WithBaseURL ¶
WithBaseURL specifies base api url to override when creating Microsoft Teams Client
type PostMsgOption ¶
type PostMsgOption func(*Client)
PostMsgOption allows specifying various configuration
func WithContentType ¶
func WithContentType(contentType MessageContentType) PostMsgOption