amo/contacts.go

32 lines
581 B
Go
Raw Normal View History

2024-05-30 11:43:10 +03:00
package amo
import "surdeus.su/core/amo/contacts"
import "surdeus.su/core/ss/urlenc"
import "fmt"
func (client *Client) GetContact(
contactId int,
opts ...urlenc.Builder,
) (*contacts.Contact, error) {
deal := new(contacts.Contact)
res := fmt.Sprintf(
"/api/v4/contacts/%d?%s",
contactId,
urlenc.Join(opts...).Encode(),
)
err := client.API.Get(res, deal)
if err != nil {
return nil, err
}
return deal, nil
}
func (client *Client) UpdateContact(contact *contacts.Contact) error {
return client.updateEntity(
"/api/v4/contacts",
contact.Id,
contact,
)
}