Documentation ¶
Index ¶
- func GetErrorCode(err error) string
- type BotFrameworkClient
- type Chat
- type Client
- type Config
- type GraphClient
- func (c *GraphClient) GetAppForTeam(ctx context.Context, app *TeamsApp, teamID string) (*InstalledApp, error)
- func (c *GraphClient) GetAppForUser(ctx context.Context, app *TeamsApp, userID string) (*InstalledApp, error)
- func (c *GraphClient) GetChatForInstalledApp(ctx context.Context, userID, installationID string) (Chat, error)
- func (c *GraphClient) GetTeamsApp(ctx context.Context, teamsAppID string) (*TeamsApp, error)
- func (c *GraphClient) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (c *GraphClient) GetUserByID(ctx context.Context, id string) (*User, error)
- func (c *GraphClient) InstallAppForUser(ctx context.Context, userID, teamAppID string) error
- func (c *GraphClient) UninstallAppForUser(ctx context.Context, userID, teamAppID string) error
- type InstalledApp
- type PostActivityResponse
- type TeamsApp
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BotFrameworkClient ¶
type BotFrameworkClient struct {
Client
}
BotFrameworkClient represents client to MS Graph API
func NewBotFrameworkClient ¶
func NewBotFrameworkClient(config Config) *BotFrameworkClient
NewBotFrameworkClient creates MS Graph API client
func (*BotFrameworkClient) PostAdaptiveCardActivity ¶
func (c *BotFrameworkClient) PostAdaptiveCardActivity(ctx context.Context, botID, chatID, card, updateID string) (string, error)
PostAdaptiveCardActivity sends an activity to the chat, content is AdaptiveCard
type Chat ¶
type Chat struct { ID string `json:"id"` TenantID string `json:"tenantId"` WebURL string `json:"webUrl"` }
Chat represents chat resource
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents generic MS API client
type Config ¶
type Config struct { // AppID application id (uuid, for bots must be underlying app id, not bot's id) AppID string `toml:"app_id"` // AppSecret application secret token AppSecret string `toml:"app_secret"` // TenantID ms tenant id TenantID string `toml:"tenant_id"` // Region bot framework api AP region Region string `toml:"region"` // TeamsAppID represents Teams App ID TeamsAppID string `toml:"teams_app_id"` // contains filtered or unexported fields }
Config represents MS Graph API and Bot API config
func (*Config) SetBaseURLs ¶
SetBaseURLs is used to point MS Graph API to test servers
type GraphClient ¶
type GraphClient struct {
Client
}
GraphClient represents client to MS Graph API
func NewGraphClient ¶
func NewGraphClient(config Config) *GraphClient
NewGraphClient creates MS Graph API client
func (*GraphClient) GetAppForTeam ¶
func (c *GraphClient) GetAppForTeam(ctx context.Context, app *TeamsApp, teamID string) (*InstalledApp, error)
GetAppForTeam returns installedApp for a given app and user This call requires the permission `TeamsAppInstallation.ReadWriteSelfForTeam.All`. This is overkill as we're only reading. Resource Specific Consent is not enabled by default (still in preview) and we cannot rely on it. https://docs.microsoft.com/en-us/microsoftteams/platform/graph-api/rsc/resource-specific-consent
func (*GraphClient) GetAppForUser ¶
func (c *GraphClient) GetAppForUser(ctx context.Context, app *TeamsApp, userID string) (*InstalledApp, error)
GetAppForUser returns installedApp for a given app and user
func (*GraphClient) GetChatForInstalledApp ¶
func (c *GraphClient) GetChatForInstalledApp(ctx context.Context, userID, installationID string) (Chat, error)
GetChatForInstalledApp returns a chat between user and installed app
func (*GraphClient) GetTeamsApp ¶
GetTeamsApp returns the list of installed team apps
func (*GraphClient) GetUserByEmail ¶
GetUserByEmail searches a user by email
func (*GraphClient) GetUserByID ¶
GetUserByID returns a user by ID
func (*GraphClient) InstallAppForUser ¶
func (c *GraphClient) InstallAppForUser(ctx context.Context, userID, teamAppID string) error
InstallAppForUser returns installed apps for user
func (*GraphClient) UninstallAppForUser ¶
func (c *GraphClient) UninstallAppForUser(ctx context.Context, userID, teamAppID string) error
UninstallAppForUser returns installed apps for user
type InstalledApp ¶
InstalledApp represents teamsAppInstallation resource
type PostActivityResponse ¶
type PostActivityResponse struct {
ID string `json:"id"`
}
PostActivityResponse represents json response with a single id field
type TeamsApp ¶
type TeamsApp struct { ID string `json:"id"` ExternalID string `json:"externalId"` DisplayName string `json:"displayName"` DistributionMethod string `json:"distributionMethod"` }
TeamsApp represents teamsApp resource