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

Skip to content

Commit c06a636

Browse files
committed
All
1 parent 91c78f4 commit c06a636

File tree

11 files changed

+530
-21
lines changed

11 files changed

+530
-21
lines changed

coderd/apidoc/docs.go

Lines changed: 131 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ const docTemplate = `{
23842384
"Users"
23852385
],
23862386
"summary": "Get API key",
2387-
"operationId": "get-user-tokens",
2387+
"operationId": "get-api-key",
23882388
"parameters": [
23892389
{
23902390
"type": "string",
@@ -2449,6 +2449,84 @@ const docTemplate = `{
24492449
}
24502450
}
24512451
},
2452+
"/users/{user}/organizations": {
2453+
"get": {
2454+
"security": [
2455+
{
2456+
"CoderSessionToken": []
2457+
}
2458+
],
2459+
"produces": [
2460+
"application/json"
2461+
],
2462+
"tags": [
2463+
"Users"
2464+
],
2465+
"summary": "Get organizations by user",
2466+
"operationId": "get-organizations-by-users",
2467+
"parameters": [
2468+
{
2469+
"type": "string",
2470+
"description": "User ID, name, or me",
2471+
"name": "user",
2472+
"in": "path",
2473+
"required": true
2474+
}
2475+
],
2476+
"responses": {
2477+
"200": {
2478+
"description": "OK",
2479+
"schema": {
2480+
"type": "array",
2481+
"items": {
2482+
"$ref": "#/definitions/codersdk.Organization"
2483+
}
2484+
}
2485+
}
2486+
}
2487+
}
2488+
},
2489+
"/users/{user}/organizations/{organizationname}": {
2490+
"get": {
2491+
"security": [
2492+
{
2493+
"CoderSessionToken": []
2494+
}
2495+
],
2496+
"produces": [
2497+
"application/json"
2498+
],
2499+
"tags": [
2500+
"Users"
2501+
],
2502+
"summary": "Get organization by user and organization name",
2503+
"operationId": "get-organization-by-user-and-organization-name",
2504+
"parameters": [
2505+
{
2506+
"type": "string",
2507+
"description": "User ID, name, or me",
2508+
"name": "user",
2509+
"in": "path",
2510+
"required": true
2511+
},
2512+
{
2513+
"type": "string",
2514+
"description": "Organization name",
2515+
"name": "organizationname",
2516+
"in": "path",
2517+
"required": true
2518+
}
2519+
],
2520+
"responses": {
2521+
"200": {
2522+
"description": "OK",
2523+
"schema": {
2524+
"$ref": "#/definitions/codersdk.Organization"
2525+
}
2526+
}
2527+
}
2528+
}
2529+
},
24522530
"/users/{user}/password": {
24532531
"put": {
24542532
"security": [
@@ -2691,12 +2769,12 @@ const docTemplate = `{
26912769
"tags": [
26922770
"Workspaces"
26932771
],
2694-
"summary": "Get workspace metadata by owner and workspace name",
2695-
"operationId": "get-workspace-metadata-by-owner-and-workspace-name",
2772+
"summary": "Get workspace metadata by user and workspace name",
2773+
"operationId": "get-workspace-metadata-by-user-and-workspace-name",
26962774
"parameters": [
26972775
{
26982776
"type": "string",
2699-
"description": "Owner username",
2777+
"description": "User ID, name, or me",
27002778
"name": "user",
27012779
"in": "path",
27022780
"required": true
@@ -2725,6 +2803,55 @@ const docTemplate = `{
27252803
}
27262804
}
27272805
},
2806+
"/users/{user}/workspace/{workspacename}/builds/{buildnumber}": {
2807+
"get": {
2808+
"security": [
2809+
{
2810+
"CoderSessionToken": []
2811+
}
2812+
],
2813+
"produces": [
2814+
"application/json"
2815+
],
2816+
"tags": [
2817+
"Builds"
2818+
],
2819+
"summary": "Get workspace build by user, workspace name, and build number",
2820+
"operationId": "get-workspace-build-by-user-workspace-name-and-build-number",
2821+
"parameters": [
2822+
{
2823+
"type": "string",
2824+
"description": "User ID, name, or me",
2825+
"name": "user",
2826+
"in": "path",
2827+
"required": true
2828+
},
2829+
{
2830+
"type": "string",
2831+
"description": "Workspace name",
2832+
"name": "workspacename",
2833+
"in": "path",
2834+
"required": true
2835+
},
2836+
{
2837+
"type": "string",
2838+
"format": "number",
2839+
"description": "Build number",
2840+
"name": "buildnumber",
2841+
"in": "path",
2842+
"required": true
2843+
}
2844+
],
2845+
"responses": {
2846+
"200": {
2847+
"description": "OK",
2848+
"schema": {
2849+
"$ref": "#/definitions/codersdk.WorkspaceBuild"
2850+
}
2851+
}
2852+
}
2853+
}
2854+
},
27282855
"/workspaceagents/aws-instance-identity": {
27292856
"post": {
27302857
"security": [

coderd/apidoc/swagger.json

Lines changed: 119 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@
20922092
"produces": ["application/json"],
20932093
"tags": ["Users"],
20942094
"summary": "Get API key",
2095-
"operationId": "get-user-tokens",
2095+
"operationId": "get-api-key",
20962096
"parameters": [
20972097
{
20982098
"type": "string",
@@ -2153,6 +2153,76 @@
21532153
}
21542154
}
21552155
},
2156+
"/users/{user}/organizations": {
2157+
"get": {
2158+
"security": [
2159+
{
2160+
"CoderSessionToken": []
2161+
}
2162+
],
2163+
"produces": ["application/json"],
2164+
"tags": ["Users"],
2165+
"summary": "Get organizations by user",
2166+
"operationId": "get-organizations-by-users",
2167+
"parameters": [
2168+
{
2169+
"type": "string",
2170+
"description": "User ID, name, or me",
2171+
"name": "user",
2172+
"in": "path",
2173+
"required": true
2174+
}
2175+
],
2176+
"responses": {
2177+
"200": {
2178+
"description": "OK",
2179+
"schema": {
2180+
"type": "array",
2181+
"items": {
2182+
"$ref": "#/definitions/codersdk.Organization"
2183+
}
2184+
}
2185+
}
2186+
}
2187+
}
2188+
},
2189+
"/users/{user}/organizations/{organizationname}": {
2190+
"get": {
2191+
"security": [
2192+
{
2193+
"CoderSessionToken": []
2194+
}
2195+
],
2196+
"produces": ["application/json"],
2197+
"tags": ["Users"],
2198+
"summary": "Get organization by user and organization name",
2199+
"operationId": "get-organization-by-user-and-organization-name",
2200+
"parameters": [
2201+
{
2202+
"type": "string",
2203+
"description": "User ID, name, or me",
2204+
"name": "user",
2205+
"in": "path",
2206+
"required": true
2207+
},
2208+
{
2209+
"type": "string",
2210+
"description": "Organization name",
2211+
"name": "organizationname",
2212+
"in": "path",
2213+
"required": true
2214+
}
2215+
],
2216+
"responses": {
2217+
"200": {
2218+
"description": "OK",
2219+
"schema": {
2220+
"$ref": "#/definitions/codersdk.Organization"
2221+
}
2222+
}
2223+
}
2224+
}
2225+
},
21562226
"/users/{user}/password": {
21572227
"put": {
21582228
"security": [
@@ -2365,12 +2435,12 @@
23652435
],
23662436
"produces": ["application/json"],
23672437
"tags": ["Workspaces"],
2368-
"summary": "Get workspace metadata by owner and workspace name",
2369-
"operationId": "get-workspace-metadata-by-owner-and-workspace-name",
2438+
"summary": "Get workspace metadata by user and workspace name",
2439+
"operationId": "get-workspace-metadata-by-user-and-workspace-name",
23702440
"parameters": [
23712441
{
23722442
"type": "string",
2373-
"description": "Owner username",
2443+
"description": "User ID, name, or me",
23742444
"name": "user",
23752445
"in": "path",
23762446
"required": true
@@ -2399,6 +2469,51 @@
23992469
}
24002470
}
24012471
},
2472+
"/users/{user}/workspace/{workspacename}/builds/{buildnumber}": {
2473+
"get": {
2474+
"security": [
2475+
{
2476+
"CoderSessionToken": []
2477+
}
2478+
],
2479+
"produces": ["application/json"],
2480+
"tags": ["Builds"],
2481+
"summary": "Get workspace build by user, workspace name, and build number",
2482+
"operationId": "get-workspace-build-by-user-workspace-name-and-build-number",
2483+
"parameters": [
2484+
{
2485+
"type": "string",
2486+
"description": "User ID, name, or me",
2487+
"name": "user",
2488+
"in": "path",
2489+
"required": true
2490+
},
2491+
{
2492+
"type": "string",
2493+
"description": "Workspace name",
2494+
"name": "workspacename",
2495+
"in": "path",
2496+
"required": true
2497+
},
2498+
{
2499+
"type": "string",
2500+
"format": "number",
2501+
"description": "Build number",
2502+
"name": "buildnumber",
2503+
"in": "path",
2504+
"required": true
2505+
}
2506+
],
2507+
"responses": {
2508+
"200": {
2509+
"description": "OK",
2510+
"schema": {
2511+
"$ref": "#/definitions/codersdk.WorkspaceBuild"
2512+
}
2513+
}
2514+
}
2515+
}
2516+
},
24022517
"/workspaceagents/aws-instance-identity": {
24032518
"post": {
24042519
"security": [

coderd/apikey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func (api *API) postAPIKey(rw http.ResponseWriter, r *http.Request) {
132132
}
133133

134134
// @Summary Get API key
135-
// @ID get-user-tokens
135+
// @ID get-api-key
136136
// @Security CoderSessionToken
137137
// @Produce json
138138
// @Tags Users

coderd/users.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,15 @@ func (api *API) updateSiteUserRoles(ctx context.Context, args database.UpdateUse
906906
}
907907

908908
// Returns organizations the parameterized user has access to.
909+
//
910+
// @Summary Get organizations by user
911+
// @ID get-organizations-by-users
912+
// @Security CoderSessionToken
913+
// @Produce json
914+
// @Tags Users
915+
// @Param user path string true "User ID, name, or me"
916+
// @Success 200 {array} codersdk.Organization
917+
// @Router /users/{user}/organizations [get]
909918
func (api *API) organizationsByUser(rw http.ResponseWriter, r *http.Request) {
910919
ctx := r.Context()
911920
user := httpmw.UserParam(r)
@@ -941,6 +950,15 @@ func (api *API) organizationsByUser(rw http.ResponseWriter, r *http.Request) {
941950
httpapi.Write(ctx, rw, http.StatusOK, publicOrganizations)
942951
}
943952

953+
// @Summary Get organization by user and organization name
954+
// @ID get-organization-by-user-and-organization-name
955+
// @Security CoderSessionToken
956+
// @Produce json
957+
// @Tags Users
958+
// @Param user path string true "User ID, name, or me"
959+
// @Param organizationname path string true "Organization name"
960+
// @Success 200 {object} codersdk.Organization
961+
// @Router /users/{user}/organizations/{organizationname} [get]
944962
func (api *API) organizationByUserAndName(rw http.ResponseWriter, r *http.Request) {
945963
ctx := r.Context()
946964
organizationName := chi.URLParam(r, "organizationname")

coderd/workspacebuilds.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ func (api *API) workspaceBuilds(rw http.ResponseWriter, r *http.Request) {
191191
httpapi.Write(ctx, rw, http.StatusOK, apiBuilds)
192192
}
193193

194+
// @Summary Get workspace build by user, workspace name, and build number
195+
// @ID get-workspace-build-by-user-workspace-name-and-build-number
196+
// @Security CoderSessionToken
197+
// @Produce json
198+
// @Tags Builds
199+
// @Param user path string true "User ID, name, or me"
200+
// @Param workspacename path string true "Workspace name"
201+
// @Param buildnumber path string true "Build number" format(number)
202+
// @Success 200 {object} codersdk.WorkspaceBuild
203+
// @Router /users/{user}/workspace/{workspacename}/builds/{buildnumber} [get]
194204
func (api *API) workspaceBuildByBuildNumber(rw http.ResponseWriter, r *http.Request) {
195205
ctx := r.Context()
196206
owner := httpmw.UserParam(r)

coderd/workspaces.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) {
192192
})
193193
}
194194

195-
// @Summary Get workspace metadata by owner and workspace name
196-
// @ID get-workspace-metadata-by-owner-and-workspace-name
195+
// @Summary Get workspace metadata by user and workspace name
196+
// @ID get-workspace-metadata-by-user-and-workspace-name
197197
// @Security CoderSessionToken
198198
// @Produce json
199199
// @Tags Workspaces
200-
// @Param user path string true "Owner username"
200+
// @Param user path string true "User ID, name, or me"
201201
// @Param workspacename path string true "Workspace name"
202202
// @Param include_deleted query bool false "Return data instead of HTTP 404 if the workspace is deleted"
203203
// @Success 200 {object} codersdk.Workspace

0 commit comments

Comments
 (0)