core

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 8 Imported by: 12

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

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) error
	ProactiveMessage(ctx context.Context, ref schema.ConversationReference, handler activity.Handler) error
	DeleteActivity(ctx context.Context, activityID string, ref schema.ConversationReference) error
	UpdateActivity(ctx context.Context, activity schema.Activity) 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
	ChannelAuthTenant  string
	OauthEndpoint      string
	OpenIDMetadata     string
	ChannelService     string
	CredentialProvider auth.CredentialProvider
}

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 added in v0.2.1

func (bf *BotFrameworkAdapter) DeleteActivity(ctx context.Context, activityID string, ref schema.ConversationReference) error

DeleteActivity Deletes an existing activity by Activity ID

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 added in v0.2.0

func (bf *BotFrameworkAdapter) ProactiveMessage(ctx context.Context, ref schema.ConversationReference, handler activity.Handler) 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) error

ProcessActivity receives an activity, processes it as specified in by the 'handler' and sends it to the connector service.

func (*BotFrameworkAdapter) UpdateActivity added in v0.2.3

func (bf *BotFrameworkAdapter) UpdateActivity(ctx context.Context, req schema.Activity) error

UpdateActivity Updates an existing activity

type MockTokenValidator added in v0.2.2

type MockTokenValidator struct {
}

MockTokenValidator stub for bypassing the authentication

func (*MockTokenValidator) AuthenticateRequest added in v0.2.2

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

Directories

Path Synopsis
Package activity acts as a handler for any received activity and the user defined operation on that activity.
Package activity acts as a handler for any received activity and the user defined operation on that activity.

Jump to

Keyboard shortcuts

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