forked from jarias/stormpath-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
directory_criteria.go
61 lines (47 loc) · 1.42 KB
/
directory_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
package stormpath
import (
"net/url"
)
type DirectoryCriteria struct {
baseCriteria
}
func MakeDirectoryCriteria() DirectoryCriteria {
return DirectoryCriteria{baseCriteria{filter: url.Values{}}}
}
func MakeDirectoriesCriteria() DirectoryCriteria {
return DirectoryCriteria{baseCriteria{limit: 25, filter: url.Values{}}}
}
//Filter related functions
//Possible filters:
//* name
//* description
//* status
func (c DirectoryCriteria) NameEq(name string) DirectoryCriteria {
c.filter.Add("name", name)
return c
}
func (c DirectoryCriteria) DescriptionEq(description string) DirectoryCriteria {
c.filter.Add("description", description)
return c
}
func (c DirectoryCriteria) StatusEq(status string) DirectoryCriteria {
c.filter.Add("statu", status)
return c
}
//Expansion related functions
func (c DirectoryCriteria) WithCustomData() DirectoryCriteria {
c.expandedAttributes = append(c.expandedAttributes, "customData")
return c
}
func (c DirectoryCriteria) WithAccounts(pageRequest PageRequest) DirectoryCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("accounts"))
return c
}
func (c DirectoryCriteria) WithGroups(pageRequest PageRequest) DirectoryCriteria {
c.expandedAttributes = append(c.expandedAttributes, pageRequest.toExpansion("groups"))
return c
}
func (c DirectoryCriteria) WithTenant() DirectoryCriteria {
c.expandedAttributes = append(c.expandedAttributes, "tenant")
return c
}