Skip to content

Google Cloud Platform, Kubernetes, Twilio, Stripe, Slack, and SendGrid client set and grpc server

Notifications You must be signed in to change notification settings

autom8ter/goconnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goconnect

-- import "github.com/autom8ter/goconnect"

Usage

var NOEXIST = func(key string) error {
	return errors.New("customer not found- key: " + key)
}

type CallbackFunc

type CallbackFunc func(customer2 *stripe.Customer) error

type GoConnect

type GoConnect struct {
}

GoConnect holds the required configuration variables to create a GoConnect Instance. Use Init() to validate a GoConnect instance.

func New

func New(cfg *api.Config) *GoConnect

func NewFromEnv

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 (*GoConnect) AddChannelReminder

func (g *GoConnect) AddChannelReminder(r *api.ChannelReminder) (string, error)

func (*GoConnect) AddPin

func (g *GoConnect) AddPin(ctx context.Context, p *api.Pin) error

func (*GoConnect) AddReaction

func (g *GoConnect) AddReaction(ctx context.Context, r *api.UserReminder) error

func (*GoConnect) AddStar

func (g *GoConnect) AddStar(ctx context.Context, star *api.Star) error

func (*GoConnect) AddUserReminder

func (g *GoConnect) AddUserReminder(r *api.UserReminder) (string, error)

func (*GoConnect) CallCustomer

func (g *GoConnect) CallCustomer(customerKey, from, callback string) (*gotwilio.VoiceResponse, error)

Call calls a number

func (*GoConnect) CallUser

func (g *GoConnect) CallUser(ctx context.Context, email string, from string, callback string) (*gotwilio.VoiceResponse, error)

func (*GoConnect) CancelSubscription

func (g *GoConnect) CancelSubscription(key string, planName string) error

func (*GoConnect) Config

func (g *GoConnect) Config() *api.Config

func (*GoConnect) CreateCustomer

func (g *GoConnect) CreateCustomer(email, description, plan, name, phone string) (*stripe.Customer, error)

func (*GoConnect) CreateMonthlyPlan

func (g *GoConnect) CreateMonthlyPlan(amount int64, id, prodId, prodName, nickname string) (*stripe.Plan, error)

func (*GoConnect) CreateVideoRoom

func (g *GoConnect) CreateVideoRoom() (*gotwilio.VideoResponse, error)

Fax faxes a number

func (*GoConnect) CreateYearlyPlan

func (g *GoConnect) CreateYearlyPlan(amount int64, id, prodId, prodName, nickname string) (*stripe.Plan, error)

func (*GoConnect) CustomerCallBack

func (g *GoConnect) CustomerCallBack(key string, funcs ...CallbackFunc) error

func (*GoConnect) CustomerCard

func (g *GoConnect) CustomerCard(customerKey string) (*stripe.Card, error)

func (*GoConnect) CustomerExists

func (g *GoConnect) CustomerExists(key string) bool

func (*GoConnect) CustomerIsSubscribedToPlan

func (g *GoConnect) CustomerIsSubscribedToPlan(customerKey string, planFriendlyName string) bool

func (*GoConnect) CustomerKeys

func (g *GoConnect) CustomerKeys() []string

func (*GoConnect) CustomerMetadata

func (g *GoConnect) CustomerMetadata(customerKey string) (map[string]string, error)

func (*GoConnect) CustomerSubscriptions

func (g *GoConnect) CustomerSubscriptions(customerKey string) ([]*stripe.Subscription, error)

func (*GoConnect) Customers

func (g *GoConnect) Customers() map[string]*stripe.Customer

Customers returns your current stripe customer cache

func (*GoConnect) EmailCustomer

func (g *GoConnect) EmailCustomer(customerKey, subject, plain, html string) error

func (*GoConnect) EmailUser

func (g *GoConnect) EmailUser(ctx context.Context, email *api.RecipientEmail) error

func (*GoConnect) FaxCustomer

func (g *GoConnect) FaxCustomer(customerKey, from, mediaUrl, quality, callback string, storeMedia bool) (*gotwilio.FaxResource, error)

Fax faxes a number

func (*GoConnect) GetCall

func (g *GoConnect) GetCall(id string) (*gotwilio.VoiceResponse, error)

func (*GoConnect) GetCustomer

func (g *GoConnect) GetCustomer(key string) (*stripe.Customer, bool)

func (*GoConnect) GetFax

func (g *GoConnect) GetFax(id string) (*gotwilio.FaxResource, error)

func (*GoConnect) GetSMS

func (g *GoConnect) GetSMS(id string) (*gotwilio.SmsResponse, error)

func (*GoConnect) GetSlackChannelHistory

func (g *GoConnect) GetSlackChannelHistory(ctx context.Context, channel, latest, oldest string, count int, inclusive bool) (*slack.History, error)

func (*GoConnect) GetSlackThreadReplies

func (g *GoConnect) GetSlackThreadReplies(ctx context.Context, channel string, thread string) ([]slack.Message, error)

func (*GoConnect) GetUserByEmail

func (g *GoConnect) GetUserByEmail(ctx context.Context, email string) (*slack.User, error)

func (*GoConnect) GetVideoRoom

func (g *GoConnect) GetVideoRoom(id string) (*gotwilio.VideoResponse, error)

func (*GoConnect) HandleSlackEvents

func (g *GoConnect) HandleSlackEvents(funcs ...hooks.EventHandler)

func (*GoConnect) Hook

func (g *GoConnect) Hook(ctx context.Context, attachments ...slack.Attachment) error

func (*GoConnect) Init

func (g *GoConnect) Init() error

Init starts syncing the customer cache and validates the GoConnect instance

func (*GoConnect) LogHook

func (g *GoConnect) LogHook(ctx context.Context, hook *api.LogHook) error

func (*GoConnect) NewTwilioProxyService

func (g *GoConnect) NewTwilioProxyService(name, callback, ofSessionCallback, interceptCallback, geoMatch, numSelectionBehavior string, defTTL int) (*gotwilio.ProxyService, error)

func (*GoConnect) SMSCustomer

func (g *GoConnect) SMSCustomer(customerKey, from, body, mediaUrl, callback, app string) (*gotwilio.SmsResponse, error)

func (*GoConnect) SMSUser

func (g *GoConnect) SMSUser(ctx context.Context, email string, from string, body, mediaUrl string, callback, app string) (*gotwilio.SmsResponse, error)

func (*GoConnect) SendCall

func (g *GoConnect) SendCall(c *api.Call) (*gotwilio.VoiceResponse, error)

Call calls a number

func (*GoConnect) SendEmail

func (g *GoConnect) SendEmail(r *api.RecipientEmail) error

func (*GoConnect) SendFax

func (g *GoConnect) SendFax(f *api.Fax) (*gotwilio.FaxResource, error)

Fax faxes a number

func (*GoConnect) SendSMS

func (g *GoConnect) SendSMS(s *api.SMS) (*gotwilio.SmsResponse, error)

SendSMS sends an sms if mediaurl if empty, mms otherwise.

func (*GoConnect) Serve

func (g *GoConnect) Serve(addr string, plugs ...Plugin) error

func (*GoConnect) SubscribeCustomer

func (g *GoConnect) SubscribeCustomer(key string, plan, cardnum, month, year, cvc string) (*stripe.Subscription, error)

func (*GoConnect) SwitchIndex

func (g *GoConnect) SwitchIndex(typ api.CustomerIndex)

func (*GoConnect) SyncCustomers

func (g *GoConnect) SyncCustomers()

func (*GoConnect) UserIsAdmin

func (g *GoConnect) UserIsAdmin(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsAppUser

func (g *GoConnect) UserIsAppUser(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsBot

func (g *GoConnect) UserIsBot(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsOwner

func (g *GoConnect) UserIsOwner(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsPrimaryOwner

func (g *GoConnect) UserIsPrimaryOwner(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsRestricted

func (g *GoConnect) UserIsRestricted(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsStranger

func (g *GoConnect) UserIsStranger(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserIsUltraRestricted

func (g *GoConnect) UserIsUltraRestricted(ctx context.Context, email string) (bool, error)

func (*GoConnect) UserPhoneNumber

func (g *GoConnect) UserPhoneNumber(ctx context.Context, email string) (string, error)

func (*GoConnect) Util

func (g *GoConnect) Util() *objectify.Handler

Util returns an objectify util tool ref:github.com/autom8ter/objectify

type Plugin

type Plugin interface {
	driver.Plugin
	RegisterWithClient(g *GoConnect)
}

About

Google Cloud Platform, Kubernetes, Twilio, Stripe, Slack, and SendGrid client set and grpc server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages