Преглед на файлове

attachment URL centralized by CRM config.

master
Patrick Peng Sun преди 8 години
родител
ревизия
7f54440a1f
променени са 3 файла, в които са добавени 11 реда и са изтрити 5 реда
  1. +8
    -0
      configCRM.go
  2. +2
    -4
      crmAttachment.go
  3. +1
    -1
      crmEntity.go

+ 8
- 0
configCRM.go Целия файл

@@ -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")
}

+ 2
- 4
crmAttachment.go Целия файл

@@ -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 {

+ 1
- 1
crmEntity.go Целия файл

@@ -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")

Loading…
Отказ
Запис