diff --git a/.gitignore b/.gitignore index 41e5e54..d12b833 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.exe~ .env secret.json +test diff --git a/amocrm.go b/amocrm.go index 085fca9..3ee3abc 100644 --- a/amocrm.go +++ b/amocrm.go @@ -53,10 +53,10 @@ func (client *Client) GetUser(userId int) (*users.User, error) { return user, err } -func (client *Client) GetLead(leadId string, query string) (*leads.Lead, error) { +func (client *Client) GetLead(leadId int, query string) (*leads.Lead, error) { deal := new(leads.Lead) - resource := fmt.Sprintf("/api/v4/leads/%s", leadId) - if len(query) != 0 { + resource := fmt.Sprintf("/api/v4/leads/%d", leadId) + if query != "" { resource = resource + "?" + query } @@ -68,9 +68,9 @@ func (client *Client) UpdateLead(lead *leads.Lead) error { return client.updateEntity("/api/v4/leads", lead.Id, lead) } -func (client *Client) GetCompany(companyId string, query string) (*companies.Company, error) { +func (client *Client) GetCompany(companyId int, query string) (*companies.Company, error) { deal := new(companies.Company) - resource := fmt.Sprintf("/api/v4/companies/%s", companyId) + resource := fmt.Sprintf("/api/v4/companies/%d", companyId) if query != "" { resource = resource + "?" + query } @@ -116,9 +116,9 @@ func (client *Client) UpdateCompany(company *companies.Company) error { return client.updateEntity("/api/v4/companies", company.Id, company) } -func (client *Client) GetContact(contactId string, query string) (*contacts.Contact, error) { +func (client *Client) GetContact(contactId int, query string) (*contacts.Contact, error) { deal := new(contacts.Contact) - resource := fmt.Sprintf("/api/v4/contacts/%s", contactId) + resource := fmt.Sprintf("/api/v4/contacts/%d", contactId) if query != "" { resource = resource + "?" + query } diff --git a/filters/main.go b/filters/main.go new file mode 100644 index 0000000..679da88 --- /dev/null +++ b/filters/main.go @@ -0,0 +1,3 @@ +package filters + + diff --git a/leads/leads.go b/leads/leads.go index dbe798b..907fbb4 100644 --- a/leads/leads.go +++ b/leads/leads.go @@ -19,7 +19,7 @@ type Lead struct { ClosedAt int `json:"closed_at,omitempty"` ClosestTaskAt interface{} `json:"closest_task_at,omitempty"` IsDeleted bool `json:"is_deleted,omitempty"` - CustomFieldsValues []*common.CustomFieldsValue `json:"custom_fields_values,omitempty"` + CustomFieldsValues []common.CustomFieldsValue `json:"custom_fields_values,omitempty"` Score interface{} `json:"score,omitempty"` AccountId int `json:"account_id,omitempty"` IsPriceModifiedByRobot bool `json:"is_price_modified_by_robot,omitempty"` diff --git a/options/main.go b/options/main.go new file mode 100644 index 0000000..5f721e6 --- /dev/null +++ b/options/main.go @@ -0,0 +1,18 @@ +package options + +type Option interface { + GetOption() string +} + +type Array[V any] struct { + Name string + Values []V +} + +func (arr Array) GetOption() string { + +} + +type Filter struct { +} +