32 lines
581 B
Go
32 lines
581 B
Go
|
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,
|
||
|
)
|
||
|
}
|