/
models.go
55 lines (47 loc) · 1.27 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package minedash
import (
"encoding/json"
"strconv"
)
type EntityAllResponse struct {
Entities []Entity `json:"entity"`
}
type NewEntityRequest struct {
EntityType string `json:"entityType"`
CorpId Str `json:"corpId"`
ExternalId string `json:"externalId"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
AlternativeName string `json:"alternativeName"`
JobTitle string `json:"jobTitle"`
PersonalPhone string `json:"personalPhone"`
OfficePhone string `json:"officePhone"`
}
type DeletedEntityResponse struct {
ErrorCode string `json:"errorCode"`
ErrorDesc string `json:"errorDescription"`
}
type Entity struct {
CorpId Str `json:"corpId"`
EntityLabel string `json:"entityLabel"`
EntityType string `json:"entityType"`
ExternalId string `json:"externalId"`
OnSite bool `json:"onSite"`
SysId json.Number `json:"sysId"`
}
type Str string
func (w *Str) UnmarshalJSON(data []byte) (err error) {
var s string
var i int
result := ""
if err := json.Unmarshal(data, &s); err == nil {
result = s
} else if err := json.Unmarshal(data, &i); err == nil {
result = strconv.Itoa(i)
}
*w = Str(result)
return nil
}
func (w Str) String() string {
return string(w)
}