forked from jarias/stormpath-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_criteria.go
97 lines (76 loc) · 2.33 KB
/
account_criteria.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package stormpath
import "net/url"
type AccountCriteria struct {
baseCriteria
}
func MakeAccountCriteria() AccountCriteria {
return AccountCriteria{baseCriteria{filter: url.Values{}}}
}
func MakeAccountsCriteria() AccountCriteria {
return AccountCriteria{baseCriteria{limit: 25, filter: url.Values{}}}
}
//Filter related functions
//Possible filters:
//* givenName
//* surname
//* email
//* username
//* middleName
//* status
func (c AccountCriteria) GivenNameEq(givenName string) AccountCriteria {
c.filter.Add("givenName", givenName)
return c
}
func (c AccountCriteria) SurnameEq(surname string) AccountCriteria {
c.filter.Add("surname", surname)
return c
}
func (c AccountCriteria) EmailEq(email string) AccountCriteria {
c.filter.Add("email", email)
return c
}
func (c AccountCriteria) UsernameEq(username string) AccountCriteria {
c.filter.Add("username", username)
return c
}
func (c AccountCriteria) MiddleNameEq(middleName string) AccountCriteria {
c.filter.Add("middleName", middleName)
return c
}
func (c AccountCriteria) StatusEq(status string) AccountCriteria {
c.filter.Add("status", status)
return c
}
//Expansion related functions
func (c AccountCriteria) WithDirectory() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "directory")
return c
}
func (c AccountCriteria) WithCustomData() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "customData")
return c
}
func (c AccountCriteria) WithTenant() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "tenant")
return c
}
func (c AccountCriteria) WithGroups(pageRequest PageRequest) AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("groups"))
return c
}
func (c AccountCriteria) WithGroupMemberships(pageRequest PageRequest) AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("groupMemberships"))
return c
}
func (c AccountCriteria) WithProviderData() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "providerData")
return c
}
func (c AccountCriteria) WithAPIKeys() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "apiKeys")
return c
}
func (c AccountCriteria) WithApplications() AccountCriteria {
c.expandedAttributes = append(c.expandedAttributes, "applications")
return c
}