msteams

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 10 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 {
	// 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

func (c *Client) GetAccessToken() (string, error)

GetAccessToken returns an access token on behalf of a user

func (*Client) GetChannelID

func (c *Client) GetChannelID(groupID, channelNameOrID, accessToken string) (string, error)

GetChannelID implements the Microsoft Teams GetChannelID function

func (*Client) GetGroupID

func (c *Client) GetGroupID(groupNameOrID, accessToken string) (string, error)

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

func WithBaseURL(baseLoginURL, baseGraphURL string) NewOption

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

Jump to

Keyboard shortcuts

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