This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
account_store_mapping_criteria.go
75 lines (61 loc) · 3.29 KB
/
account_store_mapping_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
package stormpath
import "net/url"
//ApplicationAccountStoreMappingCriteria is the criteria type for the ApplicationAccountStoreMapping resource
type ApplicationAccountStoreMappingCriteria struct {
baseCriteria
}
//OrganizationAccountStoreMappingCriteria is the criteria type for OrganizationAccountStoreMapping
type OrganizationAccountStoreMappingCriteria struct {
baseCriteria
}
//MakeApplicationAccountStoreMappingCriteria creates a default ApplicationAccountStoreMappingCriteria for a single ApplicationAccountStoreMapping resource
func MakeApplicationAccountStoreMappingCriteria() ApplicationAccountStoreMappingCriteria {
return ApplicationAccountStoreMappingCriteria{baseCriteria{filter: url.Values{}}}
}
//MakeApplicationAccountStoreMappingsCriteria creates a default ApplicationAccountStoreMappingCriteria for a ApplicationAccountStoreMappings collection resource
func MakeApplicationAccountStoreMappingsCriteria() ApplicationAccountStoreMappingCriteria {
return ApplicationAccountStoreMappingCriteria{baseCriteria{limit: 25, filter: url.Values{}}}
}
//MakeOrganizationAccountStoreMappingCriteria creates a default OrganizationAccountStoreMappingCriteria for a single OrganizationAccountStoreMapping resource
func MakeOrganizationAccountStoreMappingCriteria() OrganizationAccountStoreMappingCriteria {
return OrganizationAccountStoreMappingCriteria{baseCriteria{filter: url.Values{}}}
}
//MakeOrganizationAccountStoreMappingsCriteria creates a default OrganizationAccountStoreMappingCriteria for a OrganizationAccountStoreMappings collection resource
func MakeOrganizationAccountStoreMappingsCriteria() OrganizationAccountStoreMappingCriteria {
return OrganizationAccountStoreMappingCriteria{baseCriteria{limit: 25, filter: url.Values{}}}
}
//Pagination
func (c ApplicationAccountStoreMappingCriteria) Limit(limit int) ApplicationAccountStoreMappingCriteria {
c.limit = limit
return c
}
func (c ApplicationAccountStoreMappingCriteria) Offset(offset int) ApplicationAccountStoreMappingCriteria {
c.offset = offset
return c
}
func (c OrganizationAccountStoreMappingCriteria) Limit(limit int) OrganizationAccountStoreMappingCriteria {
c.limit = limit
return c
}
func (c OrganizationAccountStoreMappingCriteria) Offset(offset int) OrganizationAccountStoreMappingCriteria {
c.offset = offset
return c
}
//Expansion related functions
//WithApplication adds the application expansion to the given ApplicationAccountStoreMappingCriteria
func (c ApplicationAccountStoreMappingCriteria) WithApplication() ApplicationAccountStoreMappingCriteria {
c.expandedAttributes = append(c.expandedAttributes, "application")
return c
}
//WithOrganization adds the organization expansion to the given OrganizationAccountStoreMappingCriteria
func (c OrganizationAccountStoreMappingCriteria) WithOrganization() OrganizationAccountStoreMappingCriteria {
c.expandedAttributes = append(c.expandedAttributes, "organization")
return c
}
//TODO: Right not this function is disable cause the type of accountStore is resource and thus can't be
//expanded, probably need to change it interface and create a custom serializer depending on the href value
//directory, application or group
//func (c AccountStoreMappingCriteria) WithAccountStore() AccountStoreMappingCriteria {
// c.expandedAttributes = append(c.expandedAttributes, "accountStore")
// return c
//}