| @@ -2,6 +2,7 @@ package main | |||
| import ( | |||
| "encoding/json" | |||
| "errors" | |||
| "fmt" | |||
| "io/ioutil" | |||
| "log" | |||
| @@ -189,6 +190,12 @@ func crmSearchEntity(entityType string, filters []crmdSearchFilter) (result crmd | |||
| } | |||
| func crmFindEntityByID(entityType string, id string) (entity interface{}, err error) { | |||
| id = strings.TrimSpace(id) | |||
| if id == "" { | |||
| err = errors.New("empty ID not accepted") | |||
| return | |||
| } | |||
| filters := []crmdSearchFilter{ | |||
| {"id", "equals", id}, | |||
| } | |||
| @@ -211,7 +218,13 @@ func crmFindEntityByID(entityType string, id string) (entity interface{}, err er | |||
| entity = e[0] | |||
| case "Account": | |||
| return | |||
| case "Livecast": | |||
| e := []crmdLiveCast{} | |||
| err = json.Unmarshal(*cs.List, &e) | |||
| if (err != nil) || (len(e) != cs.Total) { | |||
| return | |||
| } | |||
| entity = e[0] | |||
| } | |||
| return | |||
| } | |||