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:
Brett Kolodny
2025-09-16 12:37:39 -04:00
committed by GitHub
parent 8487216548
commit e6b04d1918
8 changed files with 282 additions and 5 deletions
+5
View File
@@ -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)