gaehost

package
v0.0.0-...-89493d8 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: Apache-2.0 Imports: 20 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

func MarkTelegramChatAsForbidden

func MarkTelegramChatAsForbidden(c context.Context, botID string, tgChatID int64, dtForbidden time.Time) error

MarkTelegramChatAsForbidden marks tg chat as forbidden

func MarkViberChatAsForbidden

func MarkViberChatAsForbidden(c context.Context, tgChatID int64, dtForbidden time.Time) error

MarkViberChatAsForbidden marks chat as forbidden - TODO: is not used? consider deletion

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 (*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() db.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

type GaeFbmChatStore

type GaeFbmChatStore struct {
	GaeBotChatStore
}

GaeFbmChatStore DAL for FBM

type GaeTelegramChatStore

type GaeTelegramChatStore struct {
	GaeBotChatStore
}

GaeTelegramChatStore DAL to telegram chat entity

func NewGaeFbmChatStore

func NewGaeFbmChatStore() *GaeTelegramChatStore

NewGaeFbmChatStore creates new DAL for FBM

func NewGaeTelegramChatStore

func NewGaeTelegramChatStore(newTelegramChatEntity func() bots.BotChat) *GaeTelegramChatStore

NewGaeTelegramChatStore creates DAL to Telegram chat entity

type TelegramChatInstanceEntityGae

type TelegramChatInstanceEntityGae struct {
	telegram.ChatInstanceEntityBase
}

TelegramChatInstanceEntityGae DAL to Telegram chat entity

func (*TelegramChatInstanceEntityGae) Load

Load Telegram chat entity

func (*TelegramChatInstanceEntityGae) Save

func (entity *TelegramChatInstanceEntityGae) Save() (properties []datastore.Property, err error)

Save saves Telegram chat entity

Jump to

Keyboard shortcuts

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