fix: use int for IDs instead stupid strings.
This commit is contained in:
parent
28f6a7e2ec
commit
d17141ac1a
5 changed files with 30 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
*.exe~
|
*.exe~
|
||||||
.env
|
.env
|
||||||
secret.json
|
secret.json
|
||||||
|
test
|
||||||
|
|
14
amocrm.go
14
amocrm.go
|
@ -53,10 +53,10 @@ func (client *Client) GetUser(userId int) (*users.User, error) {
|
||||||
return user, err
|
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)
|
deal := new(leads.Lead)
|
||||||
resource := fmt.Sprintf("/api/v4/leads/%s", leadId)
|
resource := fmt.Sprintf("/api/v4/leads/%d", leadId)
|
||||||
if len(query) != 0 {
|
if query != "" {
|
||||||
resource = resource + "?" + 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)
|
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)
|
deal := new(companies.Company)
|
||||||
resource := fmt.Sprintf("/api/v4/companies/%s", companyId)
|
resource := fmt.Sprintf("/api/v4/companies/%d", companyId)
|
||||||
if query != "" {
|
if query != "" {
|
||||||
resource = resource + "?" + 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)
|
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)
|
deal := new(contacts.Contact)
|
||||||
resource := fmt.Sprintf("/api/v4/contacts/%s", contactId)
|
resource := fmt.Sprintf("/api/v4/contacts/%d", contactId)
|
||||||
if query != "" {
|
if query != "" {
|
||||||
resource = resource + "?" + query
|
resource = resource + "?" + query
|
||||||
}
|
}
|
||||||
|
|
3
filters/main.go
Normal file
3
filters/main.go
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
package filters
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ type Lead struct {
|
||||||
ClosedAt int `json:"closed_at,omitempty"`
|
ClosedAt int `json:"closed_at,omitempty"`
|
||||||
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
||||||
IsDeleted bool `json:"is_deleted,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"`
|
Score interface{} `json:"score,omitempty"`
|
||||||
AccountId int `json:"account_id,omitempty"`
|
AccountId int `json:"account_id,omitempty"`
|
||||||
IsPriceModifiedByRobot bool `json:"is_price_modified_by_robot,omitempty"`
|
IsPriceModifiedByRobot bool `json:"is_price_modified_by_robot,omitempty"`
|
||||||
|
|
18
options/main.go
Normal file
18
options/main.go
Normal file
|
@ -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 {
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue