34 lines
592 B
Go
34 lines
592 B
Go
|
package amo
|
||
|
|
||
|
import "surdeus.su/core/ss/urlenc"
|
||
|
import "surdeus.su/core/amo/companies"
|
||
|
import "fmt"
|
||
|
|
||
|
func (client *Client) GetCompany(
|
||
|
companyId int,
|
||
|
opts ...urlenc.Builder,
|
||
|
) (*companies.Company, error) {
|
||
|
deal := new(companies.Company)
|
||
|
resource := fmt.Sprintf(
|
||
|
"/api/v4/companies/%d?%s",
|
||
|
companyId,
|
||
|
urlenc.Join(opts...),
|
||
|
)
|
||
|
|
||
|
err := client.API.Get(resource, deal)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return deal, nil
|
||
|
}
|
||
|
|
||
|
func (client *Client) UpdateCompany(
|
||
|
company *companies.Company,
|
||
|
) error {
|
||
|
return client.updateEntity(
|
||
|
"/api/v4/companies",
|
||
|
company.Id,
|
||
|
company,
|
||
|
)
|
||
|
}
|