| @@ -58,3 +58,11 @@ func (c EspoCRMAPIConfig) apiEntityURL(entityType, id string) string { | |||
| func (c EspoCRMAPIConfig) apiLeadURL() string { | |||
| return c.apiURL("Lead") | |||
| } | |||
| func (c EspoCRMAPIConfig) apiAuthURL() string { | |||
| return c.apiURL("App/user") | |||
| } | |||
| func (c EspoCRMAPIConfig) apiUploadAttachmentURL() string { | |||
| return c.apiURL("Attachment/action/upload") | |||
| } | |||
| @@ -53,8 +53,7 @@ func crmPrepareAttachmentHTTPHeader(fileInfo crmFileInfo) (headers map[string]st | |||
| } | |||
| func crmUploadAttachmentURL() string { | |||
| return CRMConfig.BaseURL + "api/v1/Attachment/action/upload" | |||
| return CRMConfig.apiUploadAttachmentURL() | |||
| } | |||
| func crmAuthHeader() string { | |||
| @@ -97,8 +96,7 @@ func crmUploadAttachmentMeta(fileID string, fileInfo crmFileInfo) (resp string, | |||
| } | |||
| func crmAttachmentMetaURL(fileID string) string { | |||
| //return "https://c.hitxy.org.au/api/v1/Attachment/" + fileID | |||
| return CRMConfig.BaseURL + "api/v1/Attachment/" + fileID | |||
| return CRMConfig.apiEntityURL("Attachment", fileID) | |||
| } | |||
| type attachmentInfo struct { | |||
| @@ -122,7 +122,7 @@ type crmdSearchResult struct { | |||
| func crmSearchEntity(entityType string, filters []crmdSearchFilter) (result crmdSearchResult, err error) { | |||
| url := CRMConfig.BaseURL + "api/v1/" + entityType | |||
| url := CRMConfig.apiURL(entityType) | |||
| req, err := http.NewRequest("GET", url, nil) | |||
| if err != nil { | |||
| log.Println("crmGetRecord: cannot form good http Request") | |||