-
Notifications
You must be signed in to change notification settings - Fork 1
/
contacts.go
35 lines (28 loc) · 1.05 KB
/
contacts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package core
import "github.com/imperviousai/imp-daemon/contacts"
func (c *core) GetContacts() ([]*contacts.ContactInfo, error) {
return c.contactsManager.GetContacts()
}
func (c *core) GetContact(id int64) (*contacts.ContactInfo, error) {
return c.contactsManager.GetContact(id)
}
func (c *core) CreateContact(contact *contacts.ContactInfo) (*contacts.ContactInfo, error) {
return c.contactsManager.CreateContact(contact)
}
func (c *core) CreateContacts(contactsToCreate []*contacts.ContactInfo) ([]*contacts.ContactInfo, error) {
contactsCreated := make([]*contacts.ContactInfo, 0)
for _, contact := range contactsToCreate {
contactCreated, err := c.contactsManager.CreateContact(contact)
if err != nil {
return nil, err
}
contactsCreated = append(contactsCreated, contactCreated)
}
return contactsCreated, nil
}
func (c *core) UpdateContact(contact *contacts.ContactUpdate) (*contacts.ContactInfo, error) {
return c.contactsManager.UpdateContact(contact)
}
func (c *core) DeleteContact(id int64) error {
return c.contactsManager.DeleteContact(id)
}