forked from jarias/stormpath-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
group_membership.go
53 lines (43 loc) · 1.09 KB
/
group_membership.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
package stormpath
import (
"time"
)
type GroupMembership struct {
resource
Account Account `json:"account"`
Group Group `json:"group"`
CreatedAt time.Time `json:"createdAt,omitempty"`
ModifiedAt time.Time `json:"modifiedAt,omitempty"`
}
type GroupMemberships struct {
collectionResource
Items []GroupMembership `json:"items"`
}
func NewGroupMembership(accountHref string, groupHref string) *GroupMembership {
account := Account{}
account.Href = accountHref
group := Group{}
group.Href = groupHref
return &GroupMembership{
Account: account,
Group: group,
}
}
func (groupmembership *GroupMembership) GetAccount(criteria Criteria) (*Account, error) {
account := &Account{}
err := client.get(
buildAbsoluteURL(groupmembership.Account.Href, criteria.ToQueryString()),
emptyPayload(),
account,
)
return account, err
}
func (groupmembership *GroupMembership) GetGroup(criteria Criteria) (*Group, error) {
group := &Group{}
err := client.get(
buildAbsoluteURL(groupmembership.Group.Href, criteria.ToQueryString()),
emptyPayload(),
group,
)
return group, err
}