feat(codersdk): add Organization field to WorkspaceFilter (#26727)

Add `Organization` as a first-class field to `WorkspaceFilter` so Go SDK
callers can filter workspaces by organization name or UUID without
constructing a raw `FilterQuery` string.

The backend already supports `organization:` as a search parameter via
`searchquery.Workspaces()`. This change surfaces it consistently
alongside the existing `Owner`, `Template`, and `Status` fields.

Closes https://github.com/coder/coder/issues/21545
This commit is contained in:
Bobby Ho
2026-06-26 09:48:05 -07:00
committed by GitHub
parent c15d483863
commit db6e5a2a55
2 changed files with 93 additions and 0 deletions
+5
View File
@@ -520,6 +520,8 @@ type WorkspaceFilter struct {
Name string `json:"name,omitempty" typescript:"-"`
// Status is a workspace status, which is really the status of the latest build
Status string `json:"status,omitempty" typescript:"-"`
// Organization is an organization name or ID
Organization string `json:"organization,omitempty" typescript:"-"`
// Offset is the number of workspaces to skip before returning results.
Offset int `json:"offset,omitempty" typescript:"-"`
// Limit is a limit on the number of workspaces returned.
@@ -553,6 +555,9 @@ func (f WorkspaceFilter) asRequestOption() RequestOption {
if f.Status != "" {
params = append(params, fmt.Sprintf("status:%q", f.Status))
}
if f.Organization != "" {
params = append(params, fmt.Sprintf("organization:%q", f.Organization))
}
if f.Shared != nil {
params = append(params, fmt.Sprintf("shared:%v", *f.Shared))
}