Regenerate api docs

This commit is contained in:
2024-12-08 17:46:59 +01:00
parent 8ebbe1e076
commit a7a97caa6a
4 changed files with 155 additions and 259 deletions

View File

@@ -23,7 +23,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Get system-wide statistics as an admin", "description": "Get system-wide statistics as an admin",
@@ -55,7 +55,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the list of all users", "description": "Returns the list of all users",
@@ -88,7 +88,7 @@ const docTemplate = `{
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Create a new user as an admin", "description": "Create a new user as an admin",
@@ -146,7 +146,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Get a specific user as an admin", "description": "Get a specific user as an admin",
@@ -191,7 +191,7 @@ const docTemplate = `{
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Update a specific user as an admin", "description": "Update a specific user as an admin",
@@ -254,7 +254,7 @@ const docTemplate = `{
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Delete a specific user as an admin", "description": "Delete a specific user as an admin",
@@ -307,7 +307,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "List all workspaces and their stats as an admin", "description": "List all workspaces and their stats as an admin",
@@ -340,7 +340,7 @@ const docTemplate = `{
}, },
"/auth/login": { "/auth/login": {
"post": { "post": {
"description": "Logs in a user", "description": "Logs in a user and returns a session with access and refresh tokens",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -351,7 +351,6 @@ const docTemplate = `{
"auth" "auth"
], ],
"summary": "Login", "summary": "Login",
"operationId": "login",
"parameters": [ "parameters": [
{ {
"description": "Login request", "description": "Login request",
@@ -368,6 +367,12 @@ const docTemplate = `{
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/handlers.LoginResponse" "$ref": "#/definitions/handlers.LoginResponse"
},
"headers": {
"X-CSRF-Token": {
"type": "string",
"description": "CSRF token for future requests"
}
} }
}, },
"400": { "400": {
@@ -383,7 +388,7 @@ const docTemplate = `{
} }
}, },
"500": { "500": {
"description": "Failed to create session", "description": "Failed to generate CSRF token",
"schema": { "schema": {
"$ref": "#/definitions/handlers.ErrorResponse" "$ref": "#/definitions/handlers.ErrorResponse"
} }
@@ -393,11 +398,6 @@ const docTemplate = `{
}, },
"/auth/logout": { "/auth/logout": {
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Log out invalidates the user's session", "description": "Log out invalidates the user's session",
"tags": [ "tags": [
"auth" "auth"
@@ -427,7 +427,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the current authenticated user", "description": "Returns the current authenticated user",
@@ -469,22 +469,14 @@ const docTemplate = `{
], ],
"summary": "Refresh token", "summary": "Refresh token",
"operationId": "refreshToken", "operationId": "refreshToken",
"parameters": [
{
"description": "Refresh request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.RefreshRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "headers": {
"$ref": "#/definitions/handlers.RefreshResponse" "X-CSRF-Token": {
"type": "string",
"description": "New CSRF token"
}
} }
}, },
"400": { "400": {
@@ -498,6 +490,12 @@ const docTemplate = `{
"schema": { "schema": {
"$ref": "#/definitions/handlers.ErrorResponse" "$ref": "#/definitions/handlers.ErrorResponse"
} }
},
"500": {
"description": "Failed to generate CSRF token",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
} }
} }
} }
@@ -506,7 +504,7 @@ const docTemplate = `{
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the user's profile", "description": "Updates the user's profile",
@@ -574,7 +572,7 @@ const docTemplate = `{
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes the user's account and all associated data", "description": "Deletes the user's account and all associated data",
@@ -641,7 +639,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Lists all workspaces for the current user", "description": "Lists all workspaces for the current user",
@@ -674,7 +672,7 @@ const docTemplate = `{
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Creates a new workspace", "description": "Creates a new workspace",
@@ -726,7 +724,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the name of the last opened workspace", "description": "Returns the name of the last opened workspace",
@@ -756,7 +754,7 @@ const docTemplate = `{
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the name of the last opened workspace", "description": "Updates the name of the last opened workspace",
@@ -794,7 +792,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the current workspace", "description": "Returns the current workspace",
@@ -833,7 +831,7 @@ const docTemplate = `{
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the current workspace", "description": "Updates the current workspace",
@@ -890,7 +888,7 @@ const docTemplate = `{
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes the current workspace", "description": "Deletes the current workspace",
@@ -937,7 +935,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Lists all files in the user's workspace", "description": "Lists all files in the user's workspace",
@@ -981,7 +979,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the path of the last opened file in the user's workspace", "description": "Returns the path of the last opened file in the user's workspace",
@@ -1026,7 +1024,7 @@ const docTemplate = `{
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the last opened file in the user's workspace", "description": "Updates the last opened file in the user's workspace",
@@ -1088,7 +1086,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the paths of files with the given name in the user's workspace", "description": "Returns the paths of files with the given name in the user's workspace",
@@ -1142,7 +1140,7 @@ const docTemplate = `{
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the content of a file in the user's workspace", "description": "Returns the content of a file in the user's workspace",
@@ -1200,7 +1198,7 @@ const docTemplate = `{
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Saves the content of a file in the user's workspace", "description": "Saves the content of a file in the user's workspace",
@@ -1255,7 +1253,7 @@ const docTemplate = `{
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes a file in the user's workspace", "description": "Deletes a file in the user's workspace",
@@ -1309,7 +1307,7 @@ const docTemplate = `{
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Stages, commits, and pushes changes to the remote repository", "description": "Stages, commits, and pushes changes to the remote repository",
@@ -1365,7 +1363,7 @@ const docTemplate = `{
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Pulls changes from the remote repository", "description": "Pulls changes from the remote repository",
@@ -1493,15 +1491,12 @@ const docTemplate = `{
"handlers.LoginResponse": { "handlers.LoginResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"accessToken": { "expiresAt": {
"type": "string" "type": "string"
}, },
"refreshToken": { "sessionId": {
"type": "string" "type": "string"
}, },
"session": {
"$ref": "#/definitions/models.Session"
},
"user": { "user": {
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
} }
@@ -1527,22 +1522,6 @@ const docTemplate = `{
} }
} }
}, },
"handlers.RefreshRequest": {
"type": "object",
"properties": {
"refreshToken": {
"type": "string"
}
}
},
"handlers.RefreshResponse": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
}
}
},
"handlers.SaveFileResponse": { "handlers.SaveFileResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -1646,31 +1625,6 @@ const docTemplate = `{
} }
} }
}, },
"models.Session": {
"type": "object",
"properties": {
"createdAt": {
"description": "When this session was created",
"type": "string"
},
"expiresAt": {
"description": "When this session expires",
"type": "string"
},
"id": {
"description": "Unique session identifier",
"type": "string"
},
"refreshToken": {
"description": "The refresh token associated with this session",
"type": "string"
},
"userID": {
"description": "ID of the user this session belongs to",
"type": "integer"
}
}
},
"models.User": { "models.User": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -1807,6 +1761,13 @@ const docTemplate = `{
} }
} }
} }
},
"securityDefinitions": {
"CookieAuth": {
"type": "apiKey",
"name": "access_token",
"in": "cookie"
}
} }
}` }`

View File

@@ -16,7 +16,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Get system-wide statistics as an admin", "description": "Get system-wide statistics as an admin",
@@ -48,7 +48,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the list of all users", "description": "Returns the list of all users",
@@ -81,7 +81,7 @@
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Create a new user as an admin", "description": "Create a new user as an admin",
@@ -139,7 +139,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Get a specific user as an admin", "description": "Get a specific user as an admin",
@@ -184,7 +184,7 @@
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Update a specific user as an admin", "description": "Update a specific user as an admin",
@@ -247,7 +247,7 @@
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Delete a specific user as an admin", "description": "Delete a specific user as an admin",
@@ -300,7 +300,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "List all workspaces and their stats as an admin", "description": "List all workspaces and their stats as an admin",
@@ -333,7 +333,7 @@
}, },
"/auth/login": { "/auth/login": {
"post": { "post": {
"description": "Logs in a user", "description": "Logs in a user and returns a session with access and refresh tokens",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -344,7 +344,6 @@
"auth" "auth"
], ],
"summary": "Login", "summary": "Login",
"operationId": "login",
"parameters": [ "parameters": [
{ {
"description": "Login request", "description": "Login request",
@@ -361,6 +360,12 @@
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/handlers.LoginResponse" "$ref": "#/definitions/handlers.LoginResponse"
},
"headers": {
"X-CSRF-Token": {
"type": "string",
"description": "CSRF token for future requests"
}
} }
}, },
"400": { "400": {
@@ -376,7 +381,7 @@
} }
}, },
"500": { "500": {
"description": "Failed to create session", "description": "Failed to generate CSRF token",
"schema": { "schema": {
"$ref": "#/definitions/handlers.ErrorResponse" "$ref": "#/definitions/handlers.ErrorResponse"
} }
@@ -386,11 +391,6 @@
}, },
"/auth/logout": { "/auth/logout": {
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Log out invalidates the user's session", "description": "Log out invalidates the user's session",
"tags": [ "tags": [
"auth" "auth"
@@ -420,7 +420,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the current authenticated user", "description": "Returns the current authenticated user",
@@ -462,22 +462,14 @@
], ],
"summary": "Refresh token", "summary": "Refresh token",
"operationId": "refreshToken", "operationId": "refreshToken",
"parameters": [
{
"description": "Refresh request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.RefreshRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "headers": {
"$ref": "#/definitions/handlers.RefreshResponse" "X-CSRF-Token": {
"type": "string",
"description": "New CSRF token"
}
} }
}, },
"400": { "400": {
@@ -491,6 +483,12 @@
"schema": { "schema": {
"$ref": "#/definitions/handlers.ErrorResponse" "$ref": "#/definitions/handlers.ErrorResponse"
} }
},
"500": {
"description": "Failed to generate CSRF token",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
} }
} }
} }
@@ -499,7 +497,7 @@
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the user's profile", "description": "Updates the user's profile",
@@ -567,7 +565,7 @@
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes the user's account and all associated data", "description": "Deletes the user's account and all associated data",
@@ -634,7 +632,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Lists all workspaces for the current user", "description": "Lists all workspaces for the current user",
@@ -667,7 +665,7 @@
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Creates a new workspace", "description": "Creates a new workspace",
@@ -719,7 +717,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the name of the last opened workspace", "description": "Returns the name of the last opened workspace",
@@ -749,7 +747,7 @@
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the name of the last opened workspace", "description": "Updates the name of the last opened workspace",
@@ -787,7 +785,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the current workspace", "description": "Returns the current workspace",
@@ -826,7 +824,7 @@
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the current workspace", "description": "Updates the current workspace",
@@ -883,7 +881,7 @@
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes the current workspace", "description": "Deletes the current workspace",
@@ -930,7 +928,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Lists all files in the user's workspace", "description": "Lists all files in the user's workspace",
@@ -974,7 +972,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the path of the last opened file in the user's workspace", "description": "Returns the path of the last opened file in the user's workspace",
@@ -1019,7 +1017,7 @@
"put": { "put": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Updates the last opened file in the user's workspace", "description": "Updates the last opened file in the user's workspace",
@@ -1081,7 +1079,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the paths of files with the given name in the user's workspace", "description": "Returns the paths of files with the given name in the user's workspace",
@@ -1135,7 +1133,7 @@
"get": { "get": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Returns the content of a file in the user's workspace", "description": "Returns the content of a file in the user's workspace",
@@ -1193,7 +1191,7 @@
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Saves the content of a file in the user's workspace", "description": "Saves the content of a file in the user's workspace",
@@ -1248,7 +1246,7 @@
"delete": { "delete": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Deletes a file in the user's workspace", "description": "Deletes a file in the user's workspace",
@@ -1302,7 +1300,7 @@
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Stages, commits, and pushes changes to the remote repository", "description": "Stages, commits, and pushes changes to the remote repository",
@@ -1358,7 +1356,7 @@
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "CookieAuth": []
} }
], ],
"description": "Pulls changes from the remote repository", "description": "Pulls changes from the remote repository",
@@ -1486,15 +1484,12 @@
"handlers.LoginResponse": { "handlers.LoginResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"accessToken": { "expiresAt": {
"type": "string" "type": "string"
}, },
"refreshToken": { "sessionId": {
"type": "string" "type": "string"
}, },
"session": {
"$ref": "#/definitions/models.Session"
},
"user": { "user": {
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
} }
@@ -1520,22 +1515,6 @@
} }
} }
}, },
"handlers.RefreshRequest": {
"type": "object",
"properties": {
"refreshToken": {
"type": "string"
}
}
},
"handlers.RefreshResponse": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
}
}
},
"handlers.SaveFileResponse": { "handlers.SaveFileResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -1639,31 +1618,6 @@
} }
} }
}, },
"models.Session": {
"type": "object",
"properties": {
"createdAt": {
"description": "When this session was created",
"type": "string"
},
"expiresAt": {
"description": "When this session expires",
"type": "string"
},
"id": {
"description": "Unique session identifier",
"type": "string"
},
"refreshToken": {
"description": "The refresh token associated with this session",
"type": "string"
},
"userID": {
"description": "ID of the user this session belongs to",
"type": "integer"
}
}
},
"models.User": { "models.User": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -1800,5 +1754,12 @@
} }
} }
} }
},
"securityDefinitions": {
"CookieAuth": {
"type": "apiKey",
"name": "access_token",
"in": "cookie"
}
} }
} }

View File

@@ -57,12 +57,10 @@ definitions:
type: object type: object
handlers.LoginResponse: handlers.LoginResponse:
properties: properties:
accessToken: expiresAt:
type: string type: string
refreshToken: sessionId:
type: string type: string
session:
$ref: '#/definitions/models.Session'
user: user:
$ref: '#/definitions/models.User' $ref: '#/definitions/models.User'
type: object type: object
@@ -79,16 +77,6 @@ definitions:
example: Pulled changes from remote example: Pulled changes from remote
type: string type: string
type: object type: object
handlers.RefreshRequest:
properties:
refreshToken:
type: string
type: object
handlers.RefreshResponse:
properties:
accessToken:
type: string
type: object
handlers.SaveFileResponse: handlers.SaveFileResponse:
properties: properties:
filePath: filePath:
@@ -156,24 +144,6 @@ definitions:
workspaceName: workspaceName:
type: string type: string
type: object type: object
models.Session:
properties:
createdAt:
description: When this session was created
type: string
expiresAt:
description: When this session expires
type: string
id:
description: Unique session identifier
type: string
refreshToken:
description: The refresh token associated with this session
type: string
userID:
description: ID of the user this session belongs to
type: integer
type: object
models.User: models.User:
properties: properties:
createdAt: createdAt:
@@ -292,7 +262,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get system statistics summary: Get system statistics
tags: tags:
- Admin - Admin
@@ -314,7 +284,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: List all users summary: List all users
tags: tags:
- Admin - Admin
@@ -350,7 +320,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Create a new user summary: Create a new user
tags: tags:
- Admin - Admin
@@ -384,7 +354,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Delete a specific user summary: Delete a specific user
tags: tags:
- Admin - Admin
@@ -413,7 +383,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get a specific user summary: Get a specific user
tags: tags:
- Admin - Admin
@@ -454,7 +424,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Update a specific user summary: Update a specific user
tags: tags:
- Admin - Admin
@@ -476,7 +446,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: List all workspaces summary: List all workspaces
tags: tags:
- Admin - Admin
@@ -484,8 +454,7 @@ paths:
post: post:
consumes: consumes:
- application/json - application/json
description: Logs in a user description: Logs in a user and returns a session with access and refresh tokens
operationId: login
parameters: parameters:
- description: Login request - description: Login request
in: body in: body
@@ -498,6 +467,10 @@ paths:
responses: responses:
"200": "200":
description: OK description: OK
headers:
X-CSRF-Token:
description: CSRF token for future requests
type: string
schema: schema:
$ref: '#/definitions/handlers.LoginResponse' $ref: '#/definitions/handlers.LoginResponse'
"400": "400":
@@ -509,7 +482,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
"500": "500":
description: Failed to create session description: Failed to generate CSRF token
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
summary: Login summary: Login
@@ -530,8 +503,6 @@ paths:
description: Failed to logout description: Failed to logout
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security:
- BearerAuth: []
summary: Logout summary: Logout
tags: tags:
- auth - auth
@@ -551,7 +522,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get current user summary: Get current user
tags: tags:
- auth - auth
@@ -561,20 +532,15 @@ paths:
- application/json - application/json
description: Refreshes the access token using the refresh token description: Refreshes the access token using the refresh token
operationId: refreshToken operationId: refreshToken
parameters:
- description: Refresh request
in: body
name: body
required: true
schema:
$ref: '#/definitions/handlers.RefreshRequest'
produces: produces:
- application/json - application/json
responses: responses:
"200": "200":
description: OK description: OK
schema: headers:
$ref: '#/definitions/handlers.RefreshResponse' X-CSRF-Token:
description: New CSRF token
type: string
"400": "400":
description: Refresh token required description: Refresh token required
schema: schema:
@@ -583,6 +549,10 @@ paths:
description: Invalid refresh token description: Invalid refresh token
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Failed to generate CSRF token
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Refresh token summary: Refresh token
tags: tags:
- auth - auth
@@ -625,7 +595,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Delete account summary: Delete account
tags: tags:
- users - users
@@ -669,7 +639,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Update profile summary: Update profile
tags: tags:
- users - users
@@ -691,7 +661,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: List workspaces summary: List workspaces
tags: tags:
- workspaces - workspaces
@@ -723,7 +693,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Create workspace summary: Create workspace
tags: tags:
- workspaces - workspaces
@@ -753,7 +723,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Delete workspace summary: Delete workspace
tags: tags:
- workspaces - workspaces
@@ -778,7 +748,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get workspace summary: Get workspace
tags: tags:
- workspaces - workspaces
@@ -815,7 +785,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Update workspace summary: Update workspace
tags: tags:
- workspaces - workspaces
@@ -843,7 +813,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: List files summary: List files
tags: tags:
- files - files
@@ -878,7 +848,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Delete file summary: Delete file
tags: tags:
- files - files
@@ -916,7 +886,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get file content summary: Get file content
tags: tags:
- files - files
@@ -952,7 +922,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Save file summary: Save file
tags: tags:
- files - files
@@ -982,7 +952,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get last opened file summary: Get last opened file
tags: tags:
- files - files
@@ -1021,7 +991,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Update last opened file summary: Update last opened file
tags: tags:
- files - files
@@ -1056,7 +1026,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Lookup file by name summary: Lookup file by name
tags: tags:
- files - files
@@ -1092,7 +1062,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Stage, commit, and push changes summary: Stage, commit, and push changes
tags: tags:
- git - git
@@ -1118,7 +1088,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Pull changes from remote summary: Pull changes from remote
tags: tags:
- git - git
@@ -1138,7 +1108,7 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Get last workspace name summary: Get last workspace name
tags: tags:
- workspaces - workspaces
@@ -1161,8 +1131,13 @@ paths:
schema: schema:
$ref: '#/definitions/handlers.ErrorResponse' $ref: '#/definitions/handlers.ErrorResponse'
security: security:
- BearerAuth: [] - CookieAuth: []
summary: Update last workspace name summary: Update last workspace name
tags: tags:
- workspaces - workspaces
securityDefinitions:
CookieAuth:
in: cookie
name: access_token
type: apiKey
swagger: "2.0" swagger: "2.0"

View File

@@ -143,7 +143,6 @@ func (h *Handler) Logout(authManager auth.SessionManager, cookieService auth.Coo
// @ID refreshToken // @ID refreshToken
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body RefreshRequest true "Refresh request"
// @Success 200 // @Success 200
// @Header 200 {string} X-CSRF-Token "New CSRF token" // @Header 200 {string} X-CSRF-Token "New CSRF token"
// @Failure 400 {object} ErrorResponse "Refresh token required" // @Failure 400 {object} ErrorResponse "Refresh token required"