-- import "github.com/autom8ter/goconnect"
var NOEXIST = func(key string) error {
return errors.New("customer not found- key: " + key)
}
type CallbackFunc func(customer2 *stripe.Customer) error
type GoConnect struct {
}
GoConnect holds the required configuration variables to create a GoConnect Instance. Use Init() to validate a GoConnect instance.
func New(cfg *api.Config) *GoConnect
func NewFromEnv(customerIndex api.CustomerIndex, debug bool) *GoConnect
TWILIO_ACCOUNT, TWILIO_KEY, SENDGRID_KEY, SLACK_KEY, STRIPE_KEY, EMAIL_ADDRESS, EMAIL_NAME, SLACK_LOG_USERNAME, SLACK_LOG_CHANNEL
func (g *GoConnect) AddChannelReminder(r *api.ChannelReminder) (string, error)
func (g *GoConnect) AddPin(ctx context.Context, p *api.Pin) error
func (g *GoConnect) AddReaction(ctx context.Context, r *api.UserReminder) error
func (g *GoConnect) AddStar(ctx context.Context, star *api.Star) error
func (g *GoConnect) AddUserReminder(r *api.UserReminder) (string, error)
func (g *GoConnect) CallCustomer(customerKey, from, callback string) (*gotwilio.VoiceResponse, error)
Call calls a number
func (g *GoConnect) CallUser(ctx context.Context, email string, from string, callback string) (*gotwilio.VoiceResponse, error)
func (g *GoConnect) CancelSubscription(key string, planName string) error
func (g *GoConnect) Config() *api.Config
func (g *GoConnect) CreateCustomer(email, description, plan, name, phone string) (*stripe.Customer, error)
func (g *GoConnect) CreateMonthlyPlan(amount int64, id, prodId, prodName, nickname string) (*stripe.Plan, error)
func (g *GoConnect) CreateVideoRoom() (*gotwilio.VideoResponse, error)
Fax faxes a number
func (g *GoConnect) CreateYearlyPlan(amount int64, id, prodId, prodName, nickname string) (*stripe.Plan, error)
func (g *GoConnect) CustomerCallBack(key string, funcs ...CallbackFunc) error
func (g *GoConnect) CustomerCard(customerKey string) (*stripe.Card, error)
func (g *GoConnect) CustomerExists(key string) bool
func (g *GoConnect) CustomerIsSubscribedToPlan(customerKey string, planFriendlyName string) bool
func (g *GoConnect) CustomerKeys() []string
func (g *GoConnect) CustomerMetadata(customerKey string) (map[string]string, error)
func (g *GoConnect) CustomerSubscriptions(customerKey string) ([]*stripe.Subscription, error)
func (g *GoConnect) Customers() map[string]*stripe.Customer
Customers returns your current stripe customer cache
func (g *GoConnect) EmailCustomer(customerKey, subject, plain, html string) error
func (g *GoConnect) EmailUser(ctx context.Context, email *api.RecipientEmail) error
func (g *GoConnect) FaxCustomer(customerKey, from, mediaUrl, quality, callback string, storeMedia bool) (*gotwilio.FaxResource, error)
Fax faxes a number
func (g *GoConnect) GetCall(id string) (*gotwilio.VoiceResponse, error)
func (g *GoConnect) GetCustomer(key string) (*stripe.Customer, bool)
func (g *GoConnect) GetFax(id string) (*gotwilio.FaxResource, error)
func (g *GoConnect) GetSMS(id string) (*gotwilio.SmsResponse, error)
func (g *GoConnect) GetSlackChannelHistory(ctx context.Context, channel, latest, oldest string, count int, inclusive bool) (*slack.History, error)
func (g *GoConnect) GetSlackThreadReplies(ctx context.Context, channel string, thread string) ([]slack.Message, error)
func (g *GoConnect) GetUserByEmail(ctx context.Context, email string) (*slack.User, error)
func (g *GoConnect) GetVideoRoom(id string) (*gotwilio.VideoResponse, error)
func (g *GoConnect) HandleSlackEvents(funcs ...hooks.EventHandler)
func (g *GoConnect) Hook(ctx context.Context, attachments ...slack.Attachment) error
func (g *GoConnect) Init() error
Init starts syncing the customer cache and validates the GoConnect instance
func (g *GoConnect) LogHook(ctx context.Context, hook *api.LogHook) error
func (g *GoConnect) NewTwilioProxyService(name, callback, ofSessionCallback, interceptCallback, geoMatch, numSelectionBehavior string, defTTL int) (*gotwilio.ProxyService, error)
func (g *GoConnect) SMSCustomer(customerKey, from, body, mediaUrl, callback, app string) (*gotwilio.SmsResponse, error)
func (g *GoConnect) SMSUser(ctx context.Context, email string, from string, body, mediaUrl string, callback, app string) (*gotwilio.SmsResponse, error)
func (g *GoConnect) SendCall(c *api.Call) (*gotwilio.VoiceResponse, error)
Call calls a number
func (g *GoConnect) SendEmail(r *api.RecipientEmail) error
func (g *GoConnect) SendFax(f *api.Fax) (*gotwilio.FaxResource, error)
Fax faxes a number
func (g *GoConnect) SendSMS(s *api.SMS) (*gotwilio.SmsResponse, error)
SendSMS sends an sms if mediaurl if empty, mms otherwise.
func (g *GoConnect) Serve(addr string, plugs ...Plugin) error
func (g *GoConnect) SubscribeCustomer(key string, plan, cardnum, month, year, cvc string) (*stripe.Subscription, error)
func (g *GoConnect) SwitchIndex(typ api.CustomerIndex)
func (g *GoConnect) SyncCustomers()
func (g *GoConnect) UserIsAdmin(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsAppUser(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsBot(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsOwner(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsPrimaryOwner(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsRestricted(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsStranger(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserIsUltraRestricted(ctx context.Context, email string) (bool, error)
func (g *GoConnect) UserPhoneNumber(ctx context.Context, email string) (string, error)
func (g *GoConnect) Util() *objectify.Handler
Util returns an objectify util tool ref:github.com/autom8ter/objectify
type Plugin interface {
driver.Plugin
RegisterWithClient(g *GoConnect)
}