Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 489718f

Browse files
committed
docs: updatecheck
1 parent 52f0234 commit 489718f

File tree

6 files changed

+141
-14
lines changed

6 files changed

+141
-14
lines changed

coderd/apidoc/docs.go

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ const docTemplate = `{
143143
},
144144
"/buildinfo": {
145145
"get": {
146-
"security": [
147-
{
148-
"CoderSessionToken": []
149-
}
150-
],
151146
"produces": [
152147
"application/json"
153148
],
@@ -438,6 +433,31 @@ const docTemplate = `{
438433
}
439434
}
440435
},
436+
"/updatecheck": {
437+
"get": {
438+
"security": [
439+
{
440+
"CoderSessionToken": []
441+
}
442+
],
443+
"produces": [
444+
"application/json"
445+
],
446+
"tags": [
447+
"General"
448+
],
449+
"summary": "Update check",
450+
"operationId": "update-check",
451+
"responses": {
452+
"200": {
453+
"description": "OK",
454+
"schema": {
455+
"$ref": "#/definitions/codersdk.UpdateCheckResponse"
456+
}
457+
}
458+
}
459+
}
460+
},
441461
"/users/{user}/workspace/{workspacename}": {
442462
"get": {
443463
"security": [
@@ -1174,6 +1194,23 @@ const docTemplate = `{
11741194
}
11751195
}
11761196
},
1197+
"codersdk.UpdateCheckResponse": {
1198+
"type": "object",
1199+
"properties": {
1200+
"current": {
1201+
"description": "Current is a boolean indicating whether the\nserver version is the same as the latest.",
1202+
"type": "boolean"
1203+
},
1204+
"url": {
1205+
"description": "URL to download the latest release of Coder.",
1206+
"type": "string"
1207+
},
1208+
"version": {
1209+
"description": "Version is the semantic version for the latest\nrelease of Coder.",
1210+
"type": "string"
1211+
}
1212+
}
1213+
},
11771214
"codersdk.UpdateWorkspaceAutostartRequest": {
11781215
"type": "object",
11791216
"properties": {

coderd/apidoc/swagger.json

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@
119119
},
120120
"/buildinfo": {
121121
"get": {
122-
"security": [
123-
{
124-
"CoderSessionToken": []
125-
}
126-
],
127122
"produces": ["application/json"],
128123
"tags": ["General"],
129124
"summary": "Build info",
@@ -378,6 +373,27 @@
378373
}
379374
}
380375
},
376+
"/updatecheck": {
377+
"get": {
378+
"security": [
379+
{
380+
"CoderSessionToken": []
381+
}
382+
],
383+
"produces": ["application/json"],
384+
"tags": ["General"],
385+
"summary": "Update check",
386+
"operationId": "update-check",
387+
"responses": {
388+
"200": {
389+
"description": "OK",
390+
"schema": {
391+
"$ref": "#/definitions/codersdk.UpdateCheckResponse"
392+
}
393+
}
394+
}
395+
}
396+
},
381397
"/users/{user}/workspace/{workspacename}": {
382398
"get": {
383399
"security": [
@@ -1054,6 +1070,23 @@
10541070
}
10551071
}
10561072
},
1073+
"codersdk.UpdateCheckResponse": {
1074+
"type": "object",
1075+
"properties": {
1076+
"current": {
1077+
"description": "Current is a boolean indicating whether the\nserver version is the same as the latest.",
1078+
"type": "boolean"
1079+
},
1080+
"url": {
1081+
"description": "URL to download the latest release of Coder.",
1082+
"type": "string"
1083+
},
1084+
"version": {
1085+
"description": "Version is the semantic version for the latest\nrelease of Coder.",
1086+
"type": "string"
1087+
}
1088+
}
1089+
},
10571090
"codersdk.UpdateWorkspaceAutostartRequest": {
10581091
"type": "object",
10591092
"properties": {

coderd/buildinfo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
// @Summary Build info
1212
// @ID build-info
13-
// @Security CoderSessionToken
1413
// @Produce json
1514
// @Tags General
1615
// @Success 200 {object} codersdk.BuildInfoResponse

coderd/updatecheck.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import (
1313
"github.com/coder/coder/codersdk"
1414
)
1515

16+
// @Summary Update check
17+
// @ID update-check
18+
// @Security CoderSessionToken
19+
// @Produce json
20+
// @Tags General
21+
// @Success 200 {object} codersdk.UpdateCheckResponse
22+
// @Router /updatecheck [get]
1623
func (api *API) updateCheck(rw http.ResponseWriter, r *http.Request) {
1724
ctx := r.Context()
1825

docs/api/general.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ To perform this operation, you must be authenticated by means of one of the foll
4848
```shell
4949
# Example request using curl
5050
curl -X GET http://coder-server:8080/api/v2/buildinfo \
51-
-H 'Accept: application/json' \
52-
-H 'Coder-Session-Token: API_KEY'
51+
-H 'Accept: application/json'
5352

5453
```
5554

@@ -72,7 +71,7 @@ curl -X GET http://coder-server:8080/api/v2/buildinfo \
7271
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------ |
7372
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.BuildInfoResponse](schemas.md#codersdkbuildinforesponse) |
7473

75-
To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.
74+
undefined
7675

7776
## Report CSP violations
7877

@@ -109,3 +108,37 @@ curl -X POST http://coder-server:8080/api/v2/csp/reports \
109108
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | no schema |
110109

111110
To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.
111+
112+
## Update check
113+
114+
### Code samples
115+
116+
```shell
117+
# Example request using curl
118+
curl -X GET http://coder-server:8080/api/v2/updatecheck \
119+
-H 'Accept: application/json' \
120+
-H 'Coder-Session-Token: API_KEY'
121+
122+
```
123+
124+
`GET /updatecheck`
125+
126+
### Example responses
127+
128+
> 200 Response
129+
130+
```json
131+
{
132+
"current": true,
133+
"url": "string",
134+
"version": "string"
135+
}
136+
```
137+
138+
### Responses
139+
140+
| Status | Meaning | Description | Schema |
141+
| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------------- |
142+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UpdateCheckResponse](schemas.md#codersdkupdatecheckresponse) |
143+
144+
To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.

docs/api/schemas.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,24 @@ CreateParameterRequest is a structure used to create a new parameter value for a
416416
| `p50` | integer | false | none | none |
417417
| `p95` | integer | false | none | none |
418418

419+
## codersdk.UpdateCheckResponse
420+
421+
```json
422+
{
423+
"current": true,
424+
"url": "string",
425+
"version": "string"
426+
}
427+
```
428+
429+
### Properties
430+
431+
| Name | Type | Required | Restrictions | Description |
432+
| --------- | ------- | -------- | ------------ | ---------------------------------------------------------------------------------------- |
433+
| `current` | boolean | false | none | Current is a boolean indicating whether the<br>server version is the same as the latest. |
434+
| `url` | string | false | none | Url to download the latest release of Coder. |
435+
| `version` | string | false | none | Version is the semantic version for the latest<br>release of Coder. |
436+
419437
## codersdk.UpdateWorkspaceAutostartRequest
420438

421439
```json

0 commit comments

Comments
 (0)