Skip to content

Commit 5e83862

Browse files
committed
add expand to Gets for User
Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
1 parent c5514fc commit 5e83862

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

jira/internal/user_impl.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ func (u *UserService) Groups(ctx context.Context, accountIDs string) ([]*model.U
9696
// GET /rest/api/{2-3}/users/search
9797
//
9898
// https://docs.go-atlassian.io/jira-software-cloud/users#get-all-users
99-
func (u *UserService) Gets(ctx context.Context, startAt, maxResults int) ([]*model.UserScheme, *model.ResponseScheme, error) {
100-
return u.internalClient.Gets(ctx, startAt, maxResults)
99+
func (u *UserService) Gets(ctx context.Context, startAt, maxResults int, expand []string) ([]*model.UserScheme, *model.ResponseScheme, error) {
100+
return u.internalClient.Gets(ctx, startAt, maxResults, expand)
101101
}
102102

103103
type internalUserImpl struct {
@@ -224,12 +224,16 @@ func (i *internalUserImpl) Groups(ctx context.Context, accountID string) ([]*mod
224224
return groups, response, nil
225225
}
226226

227-
func (i *internalUserImpl) Gets(ctx context.Context, startAt, maxResults int) ([]*model.UserScheme, *model.ResponseScheme, error) {
227+
func (i *internalUserImpl) Gets(ctx context.Context, startAt, maxResults int, expand []string) ([]*model.UserScheme, *model.ResponseScheme, error) {
228228

229229
params := url.Values{}
230230
params.Add("startAt", strconv.Itoa(startAt))
231231
params.Add("maxResults", strconv.Itoa(maxResults))
232232

233+
if len(expand) != 0 {
234+
params.Add("expand", strings.Join(expand, ","))
235+
}
236+
233237
endpoint := fmt.Sprintf("rest/api/%v/users/search?%v", i.version, params.Encode())
234238

235239
request, err := i.c.NewRequest(ctx, http.MethodGet, endpoint, "", nil)

service/jira/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type UserConnector interface {
6161
// GET /rest/api/{2-3}/users/search
6262
//
6363
// https://docs.go-atlassian.io/jira-software-cloud/users#get-all-users
64-
Gets(ctx context.Context, startAt, maxResults int) ([]*model.UserScheme, *model.ResponseScheme, error)
64+
Gets(ctx context.Context, startAt, maxResults int, expand []string) ([]*model.UserScheme, *model.ResponseScheme, error)
6565
}
6666

6767
type UserSearchConnector interface {

0 commit comments

Comments
 (0)