gaehost

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GaeLogger = (log.Logger)(logger{}) // TODO: move outside of bots framework

GaeLogger is a logger for GAE environment

Functions

This section is empty.

Types

type EntityTypeValidator

type EntityTypeValidator interface {
}

EntityTypeValidator validate entity types

type GaeAppUserStore

type GaeAppUserStore struct {
	GaeBaseStore
	// contains filtered or unexported fields
}

GaeAppUserStore DAL

func NewGaeAppUserStore

func NewGaeAppUserStore(appUserEntityKind string, appUserEntityType reflect.Type, newUserEntity func() bots.BotAppUser) GaeAppUserStore

NewGaeAppUserStore created new DAL

func (GaeAppUserStore) CreateAppUser

func (s GaeAppUserStore) CreateAppUser(c context.Context, botID string, actor bots.WebhookActor) (int64, bots.BotAppUser, error)

CreateAppUser creates app user entity in DB

func (GaeAppUserStore) GetAppUserByID

func (s GaeAppUserStore) GetAppUserByID(c context.Context, appUserID int64, appUser bots.BotAppUser) error

GetAppUserByID returns application user ID

type GaeBaseStore

type GaeBaseStore struct {
	// contains filtered or unexported fields
}

GaeBaseStore is base store for GAE

func NewGaeBaseStore

func NewGaeBaseStore(entityKind string) GaeBaseStore

NewGaeBaseStore creates base store for GAE

type GaeBotChatStore

type GaeBotChatStore struct {
	GaeBaseStore

	NewBotChatKey func(c context.Context, botID, botChatId string) *datastore.Key
	// contains filtered or unexported fields
}

GaeBotChatStore persists chat to GAE datastore

func NewGaeBotChatStore added in v0.5.1

func NewGaeBotChatStore(
	entityKind string,
	newBotChatKey func(c context.Context, botID, botChatId string) *datastore.Key,
	validateBotChatEntityType func(entity bots.BotChat),
	newBotChatEntity func() bots.BotChat,
) *GaeBotChatStore

func (*GaeBotChatStore) Close

func (s *GaeBotChatStore) Close(c context.Context) error

Close is called on request completion

func (*GaeBotChatStore) GetBotChatEntityByID

func (s *GaeBotChatStore) GetBotChatEntityByID(c context.Context, botID, botChatID string) (botChatEntity bots.BotChat, err error)

GetBotChatEntityByID returns bot chat entity by ID

func (*GaeBotChatStore) NewBotChatEntity

func (s *GaeBotChatStore) NewBotChatEntity(c context.Context, botID string, botChat bots.WebhookChat, appUserID int64, botUserID string, isAccessGranted bool) bots.BotChat

NewBotChatEntity creates new bot chat entity

func (*GaeBotChatStore) SaveBotChat

func (s *GaeBotChatStore) SaveBotChat(c context.Context, botID, botChatID string, chatEntity bots.BotChat) error

SaveBotChat saves bot chat

type GaeBotHost

type GaeBotHost struct {
}

GaeBotHost represent information on current hosting platform

func (GaeBotHost) Context

func (h GaeBotHost) Context(r *http.Request) context.Context

Context creates context for http.Request

func (GaeBotHost) DB

func (h GaeBotHost) DB() dal.Database

DB returns database instance

func (GaeBotHost) GetBotCoreStores

func (h GaeBotHost) GetBotCoreStores(platform string, appContext bots.BotAppContext, r *http.Request) (stores bots.BotCoreStores)

GetBotCoreStores returns bot DAL

func (GaeBotHost) GetHTTPClient

func (h GaeBotHost) GetHTTPClient(c context.Context) *http.Client

GetHTTPClient creates an HTTP client using AppEngine's URL fetch

type GaeBotUserStore

type GaeBotUserStore struct {
	GaeBaseStore
	// contains filtered or unexported fields
}

GaeBotUserStore persist user to GAE datastore

func (GaeBotUserStore) CreateBotUser

func (s GaeBotUserStore) CreateBotUser(c context.Context, botID string, apiUser bots.WebhookActor) (bots.BotUser, error)

CreateBotUser creates bot user

func (GaeBotUserStore) GetBotUserByID

func (s GaeBotUserStore) GetBotUserByID(c context.Context, botUserID interface{}) (bots.BotUser, error)

GetBotUserByID returns bot user by ID

func (GaeBotUserStore) SaveBotUser

func (s GaeBotUserStore) SaveBotUser(c context.Context, botUserID interface{}, userEntity bots.BotUser) error

SaveBotUser saves bot user by ID

Jump to

Keyboard shortcuts

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