togo install togo-framework/contactsThe contacts base plugin for togo. It defines a normalized
Contact model and a ContactsProvider driver interface so you can import/sync
contacts from anywhere — Google, a CRM, … — behind one API.
togo install togo-framework/contacts
togo install togo-framework/contacts-google # a providerSelect the provider with CONTACTS_DRIVER (default null — no contacts):
CONTACTS_DRIVER=googleimport "github.com/togo-framework/contacts"
svc, _ := contacts.FromKernel(k)
all, err := svc.Sync(ctx) // pull every contact from the provider
c, err := svc.Get(ctx, id) // one contact by provider idA provider is a tiny module that registers a driver in init():
func init() {
contacts.RegisterDriver("mycrm", func(k *togo.Kernel) (contacts.ContactsProvider, error) {
return &provider{/* read env */}, nil
})
}It implements List(ctx, pageToken) ([]Contact, next, err) and Get(ctx, id).
contacts-google is the reference provider (Google People API); the same shape
works for any CRM.
MIT