mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: filter users by github user id in the users list CLI command (#17029)
Add the `--github-user-id` option to `coder users list`, which makes the command only return users with a matching GitHub user id. This will enable https://github.com/coder/start-workspace-action to find a Coder user that corresponds to a GitHub user requesting to start a workspace.
This commit is contained in:
@ -82,6 +82,20 @@ func (p *QueryParamParser) Int(vals url.Values, def int, queryParam string) int
|
||||
return v
|
||||
}
|
||||
|
||||
func (p *QueryParamParser) Int64(vals url.Values, def int64, queryParam string) int64 {
|
||||
v, err := parseQueryParam(p, vals, func(v string) (int64, error) {
|
||||
return strconv.ParseInt(v, 10, 64)
|
||||
}, def, queryParam)
|
||||
if err != nil {
|
||||
p.Errors = append(p.Errors, codersdk.ValidationError{
|
||||
Field: queryParam,
|
||||
Detail: fmt.Sprintf("Query param %q must be a valid 64-bit integer: %s", queryParam, err.Error()),
|
||||
})
|
||||
return 0
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// PositiveInt32 function checks if the given value is 32-bit and positive.
|
||||
//
|
||||
// We can't use `uint32` as the value must be within the range <0,2147483647>
|
||||
|
Reference in New Issue
Block a user