/
models.go
50 lines (44 loc) · 1.81 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
package people
// Thing is the base entity, all nodes in neo4j should have these properties
type Thing struct {
ID string `json:"id"`
APIURL string `json:"apiUrl"` // self ?
PrefLabel string `json:"prefLabel,omitempty"`
}
// Person is the structure used for the people API
type Person struct {
*Thing
Types []string `json:"types"`
Labels *[]string `json:"labels,omitempty"`
Memberships []Membership `json:"memberships,omitempty"`
Salutation string `json:"salutation,omitempty"`
BirthYear int `json:"birthYear,omitempty"`
EmailAddress string `json:"emailAddress,omitempty"`
TwitterHandle string `json:"twitterHandle,omitempty"`
Description string `json:"description,omitempty"`
DescriptionXML string `json:"descriptionXML,omitempty"`
ImageURL string `json:"_imageUrl,omitempty"` // TODO this is a temporary thing - needs to be integrated into images properly
}
// Membership represents the relationship between a person and their roles associated with an organisation
type Membership struct {
Title string `json:"title,omitempty"`
Organisation Organisation `json:"organisation"`
ChangeEvents *[]ChangeEvent `json:"changeEvents,omitempty"`
Roles []Role `json:"roles"`
}
// Organisation simplified representation used in Person API
type Organisation struct {
*Thing
Types []string `json:"types"`
Labels *[]string `json:"labels,omitempty"`
}
// Role represents the capacity or funciton that a person performs for an organisation
type Role struct {
*Thing
ChangeEvents *[]ChangeEvent `json:"changeEvents,omitempty"`
}
// ChangeEvent represent when something started or ended
type ChangeEvent struct {
StartedAt string `json:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty"`
}