mittwald/goharbor-client

How to list users?

JorenZ opened this issue · 2 comments

Describe your request
I would like to list the Harbor users using the Harbor client.
I could not find how to do this:

  • the endpoint gets scraped: GetUsers functions calling GET /users exist in the code.
    • apiv1.internal.api.client.products.Client.GetUsers exists but you cannot access this from outside the package, I think?
    • apiv2.internal.legacyapi.client.products.Client.GetUsers exists but you cannot access this from outside the package, I think?
  • apiv2.RESTClient.ListUsers does not exist, I think?
  • apiv2.RESTClient.GetUser does exist but it wraps apiv2.internal.legacyapi.client.products.Client.GetUsers to require a username parameter; it does not allow this parameter to be empty.

Am I missing some package functionality, or is this indeed missing from the current code?

Many thanks and much respect for the very quick response! <3

@jkmw I see that many of the User calls do not support pagination, for instance:

func (c *RESTClient) ListUsers(ctx context.Context) ([]*modelv2.UserResp, error) {
	params := user.ListUsersParams{
		PageSize: &c.Options.PageSize,
		Q:        &c.Options.Query,
		Sort:     &c.Options.Sort,
		Context:  ctx,
}

Can we maybe specify these params ourselves and add it to the function parameters?