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

Skip to content

Commit 14a1654

Browse files
committed
User tokens
1 parent b1f389b commit 14a1654

File tree

6 files changed

+638
-8
lines changed

6 files changed

+638
-8
lines changed

coderd/apidoc/docs.go

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,118 @@ const docTemplate = `{
21922192
}
21932193
}
21942194
},
2195+
"/users/{user}/keys": {
2196+
"post": {
2197+
"security": [
2198+
{
2199+
"CoderSessionToken": []
2200+
}
2201+
],
2202+
"produces": [
2203+
"application/json"
2204+
],
2205+
"tags": [
2206+
"Users"
2207+
],
2208+
"summary": "Create new session key",
2209+
"operationId": "create-new-session-key",
2210+
"parameters": [
2211+
{
2212+
"type": "string",
2213+
"description": "User ID, name, or me",
2214+
"name": "user",
2215+
"in": "path",
2216+
"required": true
2217+
}
2218+
],
2219+
"responses": {
2220+
"201": {
2221+
"description": "Created",
2222+
"schema": {
2223+
"$ref": "#/definitions/codersdk.GenerateAPIKeyResponse"
2224+
}
2225+
}
2226+
}
2227+
}
2228+
},
2229+
"/users/{user}/keys/tokens": {
2230+
"get": {
2231+
"security": [
2232+
{
2233+
"CoderSessionToken": []
2234+
}
2235+
],
2236+
"produces": [
2237+
"application/json"
2238+
],
2239+
"tags": [
2240+
"Users"
2241+
],
2242+
"summary": "Get user tokens",
2243+
"operationId": "get-user-tokens",
2244+
"parameters": [
2245+
{
2246+
"type": "string",
2247+
"description": "User ID, name, or me",
2248+
"name": "user",
2249+
"in": "path",
2250+
"required": true
2251+
}
2252+
],
2253+
"responses": {
2254+
"200": {
2255+
"description": "OK",
2256+
"schema": {
2257+
"type": "array",
2258+
"items": {
2259+
"$ref": "#/definitions/codersdk.APIKey"
2260+
}
2261+
}
2262+
}
2263+
}
2264+
},
2265+
"post": {
2266+
"security": [
2267+
{
2268+
"CoderSessionToken": []
2269+
}
2270+
],
2271+
"produces": [
2272+
"application/json"
2273+
],
2274+
"tags": [
2275+
"Users"
2276+
],
2277+
"summary": "Create token API key",
2278+
"operationId": "create-token-api-key",
2279+
"parameters": [
2280+
{
2281+
"type": "string",
2282+
"description": "User ID, name, or me",
2283+
"name": "user",
2284+
"in": "path",
2285+
"required": true
2286+
},
2287+
{
2288+
"description": "Create token request",
2289+
"name": "request",
2290+
"in": "body",
2291+
"required": true,
2292+
"schema": {
2293+
"$ref": "#/definitions/codersdk.CreateTokenRequest"
2294+
}
2295+
}
2296+
],
2297+
"responses": {
2298+
"201": {
2299+
"description": "Created",
2300+
"schema": {
2301+
"$ref": "#/definitions/codersdk.GenerateAPIKeyResponse"
2302+
}
2303+
}
2304+
}
2305+
}
2306+
},
21952307
"/users/{user}/password": {
21962308
"put": {
21972309
"security": [
@@ -3444,6 +3556,65 @@ const docTemplate = `{
34443556
}
34453557
}
34463558
},
3559+
"codersdk.APIKey": {
3560+
"type": "object",
3561+
"required": [
3562+
"created_at",
3563+
"expires_at",
3564+
"id",
3565+
"last_used",
3566+
"lifetime_seconds",
3567+
"login_type",
3568+
"scope",
3569+
"updated_at",
3570+
"user_id"
3571+
],
3572+
"properties": {
3573+
"created_at": {
3574+
"type": "string",
3575+
"format": "date-time"
3576+
},
3577+
"expires_at": {
3578+
"type": "string",
3579+
"format": "date-time"
3580+
},
3581+
"id": {
3582+
"type": "string"
3583+
},
3584+
"last_used": {
3585+
"type": "string",
3586+
"format": "date-time"
3587+
},
3588+
"lifetime_seconds": {
3589+
"type": "integer"
3590+
},
3591+
"login_type": {
3592+
"type": "string",
3593+
"enum": [
3594+
"password",
3595+
"github",
3596+
"oidc",
3597+
"token"
3598+
]
3599+
},
3600+
"scope": {
3601+
"type": "string",
3602+
"enum": [
3603+
"all",
3604+
"application_connect"
3605+
]
3606+
},
3607+
"updated_at": {
3608+
"type": "string",
3609+
"format": "date-time"
3610+
},
3611+
"user_id": {
3612+
"description": "NOTE: do not ever return the HashedSecret",
3613+
"type": "string",
3614+
"format": "uuid"
3615+
}
3616+
}
3617+
},
34473618
"codersdk.AWSInstanceIdentityToken": {
34483619
"type": "object",
34493620
"required": [
@@ -3895,6 +4066,21 @@ const docTemplate = `{
38954066
}
38964067
}
38974068
},
4069+
"codersdk.CreateTokenRequest": {
4070+
"type": "object",
4071+
"properties": {
4072+
"lifetime": {
4073+
"type": "integer"
4074+
},
4075+
"scope": {
4076+
"type": "string",
4077+
"enum": [
4078+
"all",
4079+
"application_connect"
4080+
]
4081+
}
4082+
}
4083+
},
38984084
"codersdk.CreateUserRequest": {
38994085
"type": "object",
39004086
"required": [
@@ -4330,6 +4516,14 @@ const docTemplate = `{
43304516
}
43314517
}
43324518
},
4519+
"codersdk.GenerateAPIKeyResponse": {
4520+
"type": "object",
4521+
"properties": {
4522+
"key": {
4523+
"type": "string"
4524+
}
4525+
}
4526+
},
43334527
"codersdk.GetAppHostResponse": {
43344528
"type": "object",
43354529
"properties": {

0 commit comments

Comments
 (0)