mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add shared filter to workspaces query (#19807)
Adds a `shared:<boolean>` search query to the `/workspaces [get]` endpoint https://github.com/user-attachments/assets/ccf84bd9-c1fd-4085-825b-2e3176a2d488 Closes [coder/internal#972](https://github.com/coder/internal/issues/972)
This commit is contained in:
@@ -516,6 +516,8 @@ type WorkspaceFilter struct {
|
||||
Offset int `json:"offset,omitempty" typescript:"-"`
|
||||
// Limit is a limit on the number of workspaces returned.
|
||||
Limit int `json:"limit,omitempty" typescript:"-"`
|
||||
// Shared is a whether the workspace is shared with any users or groups
|
||||
Shared *bool `json:"shared,omitempty" typescript:"-"`
|
||||
// FilterQuery supports a raw filter query string
|
||||
FilterQuery string `json:"q,omitempty"`
|
||||
}
|
||||
@@ -539,6 +541,9 @@ func (f WorkspaceFilter) asRequestOption() RequestOption {
|
||||
if f.Status != "" {
|
||||
params = append(params, fmt.Sprintf("status:%q", f.Status))
|
||||
}
|
||||
if f.Shared != nil {
|
||||
params = append(params, fmt.Sprintf("shared:%v", *f.Shared))
|
||||
}
|
||||
if f.FilterQuery != "" {
|
||||
// If custom stuff is added, just add it on here.
|
||||
params = append(params, f.FilterQuery)
|
||||
|
||||
Reference in New Issue
Block a user