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:
Garrett Delfosse
2022-06-03 17:20:28 +00:00
committed by GitHub
co-authored by G r e y Kira Pilot
parent ac6cb269db
commit 8b03e2b0e1
14 changed files with 377 additions and 121 deletions
+6 -2
View File
@@ -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()
}
}