Skip to content

fix: document workspace filter query param correctly #8408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 8 additions & 43 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 8 additions & 38 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions coderd/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
// @Security CoderSessionToken
// @Produce json
// @Tags Workspaces
// @Param owner query string false "Filter by owner username"
// @Param template query string false "Filter by template name"
// @Param name query string false "Filter with partial-match by workspace name"
// @Param status query string false "Filter by workspace status" Enums(pending,running,stopping,stopped,failed,canceling,canceled,deleted,deleting)
// @Param has_agent query string false "Filter by agent status" Enums(connected,connecting,disconnected,timeout)
// @Param deleting_by query string false "Filter workspaces scheduled to be deleted by this time"
// @Param q query string false "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, deleting_by."
// @Param limit query int false "Page limit"
// @Param offset query int false "Page offset"
// @Success 200 {object} codersdk.WorkspacesResponse
// @Router /workspaces [get]
func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) {
Expand Down
31 changes: 5 additions & 26 deletions docs/api/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,32 +409,11 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \

### Parameters

| Name | In | Type | Required | Description |
| ------------- | ----- | ------ | -------- | ------------------------------------------------------ |
| `owner` | query | string | false | Filter by owner username |
| `template` | query | string | false | Filter by template name |
| `name` | query | string | false | Filter with partial-match by workspace name |
| `status` | query | string | false | Filter by workspace status |
| `has_agent` | query | string | false | Filter by agent status |
| `deleting_by` | query | string | false | Filter workspaces scheduled to be deleted by this time |

#### Enumerated Values

| Parameter | Value |
| ----------- | -------------- |
| `status` | `pending` |
| `status` | `running` |
| `status` | `stopping` |
| `status` | `stopped` |
| `status` | `failed` |
| `status` | `canceling` |
| `status` | `canceled` |
| `status` | `deleted` |
| `status` | `deleting` |
| `has_agent` | `connected` |
| `has_agent` | `connecting` |
| `has_agent` | `disconnected` |
| `has_agent` | `timeout` |
| Name | In | Type | Required | Description |
| -------- | ----- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `q` | query | string | false | Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, deleting_by. |
| `limit` | query | integer | false | Page limit |
| `offset` | query | integer | false | Page offset |

### Example responses

Expand Down