mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Workspaces filtering (#1972)
Co-authored-by: G r e y <grey@coder.com> Co-authored-by: Kira Pilot <kira@coder.com>
This commit is contained in:
co-authored by
G r e y
Kira Pilot
parent
ac6cb269db
commit
8b03e2b0e1
@@ -198,9 +198,10 @@ func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutEx
|
||||
}
|
||||
|
||||
type WorkspaceFilter struct {
|
||||
OrganizationID uuid.UUID
|
||||
OrganizationID uuid.UUID `json:"organization_id,omitempty"`
|
||||
// Owner can be a user_id (uuid), "me", or a username
|
||||
Owner string
|
||||
Owner string `json:"owner,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// asRequestOption returns a function that can be used in (*Client).Request.
|
||||
@@ -214,6 +215,9 @@ func (f WorkspaceFilter) asRequestOption() requestOption {
|
||||
if f.Owner != "" {
|
||||
q.Set("owner", f.Owner)
|
||||
}
|
||||
if f.Name != "" {
|
||||
q.Set("name", f.Name)
|
||||
}
|
||||
r.URL.RawQuery = q.Encode()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user