hooks

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMsgCreatedEvent

func ApplyMsgCreatedEvent(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, session *models.Session, e flows.Event) error

ApplyMsgCreatedEvent creates the db msg for the passed in event

func NoopHandler

func NoopHandler(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, session *models.Session, event flows.Event) error

NoopHandler is our hook for events we ignore in a run

Types

type CommitContactLanguageChanges

type CommitContactLanguageChanges struct{}

our hook for language changes

func (*CommitContactLanguageChanges) Apply

func (h *CommitContactLanguageChanges) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply applies our contact language change before our commit

type CommitContactNameChanges

type CommitContactNameChanges struct{}

our hook for name changes

func (*CommitContactNameChanges) Apply

func (h *CommitContactNameChanges) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply commits our contact name changes as a bulk update for the passed in map of sessions

type CommitSessionMessages

type CommitSessionMessages struct{}

CommitSessionMessages is our hook for comitting session messages

func (*CommitSessionMessages) Apply

func (h *CommitSessionMessages) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply takes care of inserting all the messages in the passed in sessions assigning topups to them as needed.

type ContactFieldChangedHook

type ContactFieldChangedHook struct{}

ContactFieldChangedHook is our hook for contact field changes

func (*ContactFieldChangedHook) Apply

func (h *ContactFieldChangedHook) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply squashes and writes all the field updates for the contacts

type ContactGroupsChangedHook

type ContactGroupsChangedHook struct{}

ContactGroupsChangedHook is our hook for all group changes

func (*ContactGroupsChangedHook) Apply

func (h *ContactGroupsChangedHook) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply squashes and adds or removes all our contact groups

type ContactURNAddedHook

type ContactURNAddedHook struct{}

ContactURNAddedHook is our hook for when a URN is added to a contact

func (*ContactURNAddedHook) Apply

func (h *ContactURNAddedHook) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply adds all our URNS in a batch

type FieldDelete

type FieldDelete struct {
	ContactID flows.ContactID  `db:"contact_id"`
	FieldUUID models.FieldUUID `db:"field_uuid"`
}

type FieldUpdate

type FieldUpdate struct {
	ContactID flows.ContactID `db:"contact_id"`
	Updates   string          `db:"updates"`
}

type FieldValue

type FieldValue struct {
	Text string `json:"text"`
}

type SendSessionMessages

type SendSessionMessages struct{}

SendSessionMessages is our hook for sending session messages

func (*SendSessionMessages) Apply

func (h *SendSessionMessages) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply sends all non-android messages to courier

type UnsubscribeResthookHook

type UnsubscribeResthookHook struct{}

UnsubscribeResthookHook is our hook for when a webhook is called

func (*UnsubscribeResthookHook) Apply

func (h *UnsubscribeResthookHook) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply squashes and applies all our resthook unsubscriptions

type UpdateCampaignEventsHook

type UpdateCampaignEventsHook struct{}

UpdateCampaignEventsHook is our hook to update any campaign events

func (*UpdateCampaignEventsHook) Apply

func (h *UpdateCampaignEventsHook) Apply(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *models.OrgAssets, sessions map[*models.Session][]interface{}) error

Apply will update all the campaigns for the passed in sessions, minimizing the number of queries to do so

Jump to

Keyboard shortcuts

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