Documentation
¶
Overview ¶
Package core is the entry point and the main interface for a user program.
It provides an adapter to the user program using which all the operations can be made on this SDK. See the example to understand how to use this package to perform operations on the Bot Framwework connector service.
Index ¶
- type Adapter
- type AdapterSetting
- type BotFrameworkAdapter
- func (bf *BotFrameworkAdapter) DeleteActivity(ctx context.Context, activityID string, ref schema.ConversationReference) ([]byte, error)
- func (bf *BotFrameworkAdapter) GetConversationMember(ctx context.Context, req schema.Activity) ([]byte, error)
- func (bf *BotFrameworkAdapter) ParseRequest(ctx context.Context, req *http.Request) (schema.Activity, error)
- func (bf *BotFrameworkAdapter) ProactiveMessage(ctx context.Context, ref schema.ConversationReference, ...) ([]byte, error)
- func (bf *BotFrameworkAdapter) ProcessActivity(ctx context.Context, req schema.Activity, handler activity.Handler) ([]byte, error)
- func (bf *BotFrameworkAdapter) UpdateActivity(ctx context.Context, req schema.Activity) ([]byte, error)
- type MockTokenValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
ParseRequest(ctx context.Context, req *http.Request) (schema.Activity, error)
ProcessActivity(ctx context.Context, req schema.Activity, handler activity.Handler) ([]byte, error)
ProactiveMessage(ctx context.Context, ref schema.ConversationReference, handler activity.Handler) ([]byte, error)
DeleteActivity(ctx context.Context, activityID string, ref schema.ConversationReference) ([]byte, error)
UpdateActivity(ctx context.Context, activity schema.Activity) ([]byte, error)
GetConversationMember(ctx context.Context, activity schema.Activity) ([]byte, error)
}
Adapter is the primary interface for the user program to perform operations with the connector service.
func NewBotAdapter ¶
func NewBotAdapter(settings AdapterSetting) (Adapter, error)
NewBotAdapter creates and reuturns a new BotFrameworkAdapter with the specified AdapterSettings.
type AdapterSetting ¶
type AdapterSetting struct {
AppID string
AppPassword string
Cert *adal.ServicePrincipalCertificateSecret
ChannelAuthTenant string
OauthEndpoint string
OpenIDMetadata string
ChannelService string
CredentialProvider auth.CredentialProvider
AuthClient *http.Client
ReplyClient *http.Client
}
AdapterSetting is the configuration for the Adapter.
type BotFrameworkAdapter ¶
type BotFrameworkAdapter struct {
AdapterSetting
auth.TokenValidator
client.Client
}
BotFrameworkAdapter implements Adapter and is currently the only implementation returned to the user program.
func (*BotFrameworkAdapter) DeleteActivity ¶
func (bf *BotFrameworkAdapter) DeleteActivity(ctx context.Context, activityID string, ref schema.ConversationReference) ([]byte, error)
DeleteActivity Deletes an existing activity by Activity ID
func (*BotFrameworkAdapter) GetConversationMember ¶ added in v0.0.5
func (bf *BotFrameworkAdapter) GetConversationMember(ctx context.Context, req schema.Activity) ([]byte, error)
GetConversationMember gets the member details of a conversation sender
func (*BotFrameworkAdapter) ParseRequest ¶
func (bf *BotFrameworkAdapter) ParseRequest(ctx context.Context, req *http.Request) (schema.Activity, error)
ParseRequest parses the received activity in a HTTP reuqest to:
1. Validate the structure.
2. Authenticate the request (using authenticateRequest())
Returns an Activity value on successfull parsing.
func (*BotFrameworkAdapter) ProactiveMessage ¶
func (bf *BotFrameworkAdapter) ProactiveMessage(ctx context.Context, ref schema.ConversationReference, handler activity.Handler) ([]byte, error)
ProactiveMessage sends activity to a conversation. This methods is used for Bot initiated conversation.
func (*BotFrameworkAdapter) ProcessActivity ¶
func (bf *BotFrameworkAdapter) ProcessActivity(ctx context.Context, req schema.Activity, handler activity.Handler) ([]byte, error)
ProcessActivity receives an activity, processes it as specified in by the 'handler' and sends it to the connector service.
func (*BotFrameworkAdapter) UpdateActivity ¶
func (bf *BotFrameworkAdapter) UpdateActivity(ctx context.Context, req schema.Activity) ([]byte, error)
UpdateActivity Updates an existing activity
type MockTokenValidator ¶
type MockTokenValidator struct {
}
MockTokenValidator stub for bypassing the authentication
func (*MockTokenValidator) AuthenticateRequest ¶
func (jv *MockTokenValidator) AuthenticateRequest(ctx context.Context, activity schema.Activity, authHeader string, credentials auth.CredentialProvider, channelService string) (auth.ClaimsIdentity, error)
AuthenticateRequest mock implementation for authentication