package models type ScopeEntry struct { ID int `json:"id"` Name string `json:"name"` Abbreviation string `json:"abbreviation"` } type ScopeMember struct { ID string `json:"id"` Name string `json:"name"` Owner bool `json:"owner"` } type Scope struct { ScopeEntry DisplayName string `json:"displayName"` Members []ScopeMember `json:"members,omitempty"` Projects []ProjectEntry `json:"projects,omitempty"` Stats []Stat `json:"stats,omitempty"` StatusLabels map[Status]string `json:"statusLabels,omitempty"` // Not stored as part of scope, but may be in the future. } func (s *Scope) Member(id string) *ScopeMember { for _, user := range s.Members { if user.ID == id { return &user } } return nil } func (s *Scope) HasMember(id string) bool { for _, user := range s.Members { if user.ID == id { return true } } return false } func (s *Scope) Stat(id int) *Stat { for _, stat := range s.Stats { if stat.ID == id { return &stat } } return nil }