mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user