Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GetUsersByGroupID #291

Closed

Conversation

paoloromolini
Copy link
Contributor

Adding get users by group id function.

@JinHuangAtZen
Copy link
Contributor

Hi @paoloromolini , please refer to this doc https://github.com/nukosuke/go-zendesk/blob/master/CBPMigration.md, Zendesk is obsoleting OBP (Offset Based Pagination), please follow the new way to create CBP (Cursor Based Pagination) iterators and starting to adopt CBP in your code base.
Thank you

@paoloromolini paoloromolini force-pushed the get_users_by_group_id branch 2 times, most recently from f41acaf to 7246525 Compare October 27, 2023 12:20
@paoloromolini
Copy link
Contributor Author

Hi @JinHuangAtZen I've added a new commit following your instructions. Please let me know if it is correct.

zendesk/user.go Outdated
@@ -128,6 +129,8 @@ type UserAPI interface {
GetOrganizationUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User]
GetOrganizationUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error)
GetOrganizationUsersCBP(ctx context.Context, opts *CBPOptions) ([]User, CursorPaginationMeta, error)
GetGroupUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the generated GetGroupUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User]

zendesk/user.go Outdated
@@ -116,6 +116,7 @@ type UserAPI interface {
SearchUsers(ctx context.Context, opts *SearchUsersOptions) ([]User, Page, error)
GetManyUsers(ctx context.Context, opts *GetManyUsersOptions) ([]User, Page, error)
GetUsers(ctx context.Context, opts *UserListOptions) ([]User, Page, error)
GetUsersByGroupID(ctx context.Context, groupID int64, opts *UserListOptions) ([]User, Page, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still using the old OBP UserListOptions and this function shouldn't be exist, it should be replaced by the newly generated GetGroupUsersIterator function.

zendesk/user.go Outdated
//TODO: GetUsersByGroupID, GetUsersByOrganizationID
// GetUsersByGroupID get users by group ID
// ref: https://developer.zendesk.com/api-reference/ticketing/users/users/#list-users
func (z *Client) GetUsersByGroupID(ctx context.Context, groupID int64, opts *UserListOptions) ([]User, Page, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still using the old OBP UserListOptions and this function shouldn't be exist, it should be replaced by the newly generated GetGroupUsersIterator function.

@JinHuangAtZen
Copy link
Contributor

Hi @JinHuangAtZen I've added a new commit following your instructions. Please let me know if it is correct.

Hi @paoloromolini , Thanks for adding the new methods, I've added some comments, basically, the new GetGroupUsersIterator will replace the GetUsersByGroupID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants