1649 lines
58 KiB
Go
1649 lines
58 KiB
Go
// Package swagger Code generated by swaggo/swag. DO NOT EDIT
|
|
package swagger
|
|
|
|
import "github.com/swaggo/swag"
|
|
|
|
const docTemplate = `{
|
|
"schemes": {{ marshal .Schemes }},
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "{{escape .Description}}",
|
|
"title": "{{.Title}}",
|
|
"contact": {
|
|
"name": "ACC Server Manager Support",
|
|
"url": "https://github.com/yourusername/acc-server-manager"
|
|
},
|
|
"license": {
|
|
"name": "MIT",
|
|
"url": "https://opensource.org/licenses/MIT"
|
|
},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/auth/login": {
|
|
"post": {
|
|
"description": "Authenticate a user and receive a JWT token",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Authentication"
|
|
],
|
|
"summary": "User login",
|
|
"parameters": [
|
|
{
|
|
"description": "Login credentials",
|
|
"name": "credentials",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "JWT token",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request body",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Invalid credentials",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/membership": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all registered users",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"User Management"
|
|
],
|
|
"summary": "List all users",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of users",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Create a new user account with specified role",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"User Management"
|
|
],
|
|
"summary": "Create a new user",
|
|
"parameters": [
|
|
{
|
|
"description": "User details",
|
|
"name": "user",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Created user details",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.User"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request body",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "User already exists",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/server": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all ACC servers with filtering options",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server"
|
|
],
|
|
"summary": "List all servers (API format)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"name": "pageSize",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "serverID",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "serviceName",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "sortBy",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"name": "sortDesc",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "status",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of servers",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.ServerAPI"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid filter parameters",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/lookup/car-models": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all available ACC car models with their identifiers",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Lookups"
|
|
],
|
|
"summary": "Get available car models",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of car models",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"class": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/lookup/cup-categories": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all available racing cup categories",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Lookups"
|
|
],
|
|
"summary": "Get cup categories",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of cup categories",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/lookup/driver-categories": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all driver categories (Bronze, Silver, Gold, Platinum)",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Lookups"
|
|
],
|
|
"summary": "Get driver categories",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of driver categories",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/lookup/session-types": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all available session types (Practice, Qualifying, Race)",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Lookups"
|
|
],
|
|
"summary": "Get session types",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of session types",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/lookup/tracks": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all available ACC tracks with their identifiers",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Lookups"
|
|
],
|
|
"summary": "Get available tracks",
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of tracks",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/server": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all ACC servers with detailed information",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server"
|
|
],
|
|
"summary": "List all servers",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"name": "pageSize",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "serverID",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "serviceName",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "sortBy",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"name": "sortDesc",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"name": "status",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of servers with full details",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Server"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid filter parameters",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Create a new ACC server instance with the provided configuration",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server"
|
|
],
|
|
"summary": "Create a new ACC server",
|
|
"parameters": [
|
|
{
|
|
"description": "Server configuration",
|
|
"name": "server",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Server"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Created server details",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid server data",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/server/{id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get detailed information about a specific ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server"
|
|
],
|
|
"summary": "Get server by ID",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Server ID (UUID format)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Server details",
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Server"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid server ID format",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Server not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Update configuration for an existing ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server"
|
|
],
|
|
"summary": "Update an ACC server",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Server ID (UUID format)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Updated server configuration",
|
|
"name": "server",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/model.Server"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Updated server details",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid server data or ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Server not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/server/{id}/config": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get a list of all available configuration files for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server Configuration"
|
|
],
|
|
"summary": "List available configuration files",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Server ID (UUID format)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of available configuration files",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid server ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Server not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/server/{id}/config/{file}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Retrieve a specific configuration file for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server Configuration"
|
|
],
|
|
"summary": "Get server configuration file",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Server ID (UUID format)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Config file name (e.g., configuration.json, settings.json, event.json)",
|
|
"name": "file",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Configuration file content as JSON",
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid server ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Server or config file not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Update a specific configuration file for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Server Configuration"
|
|
],
|
|
"summary": "Update server configuration file",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Server ID (UUID format)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Config file name (e.g., configuration.json, settings.json, event.json)",
|
|
"name": "file",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Configuration file content as JSON",
|
|
"name": "content",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Update successful",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request or JSON format",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Server or config file not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/service-control": {
|
|
"get": {
|
|
"description": "Return service control status",
|
|
"tags": [
|
|
"service-control"
|
|
],
|
|
"summary": "Return service control status",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/service-control/restart": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Stop and start a Windows service for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Service Control"
|
|
],
|
|
"summary": "Restart a Windows service",
|
|
"parameters": [
|
|
{
|
|
"description": "Service name to restart",
|
|
"name": "service",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Service restarted successfully",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request body",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Service not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/service-control/start": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Start a stopped Windows service for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Service Control"
|
|
],
|
|
"summary": "Start a Windows service",
|
|
"parameters": [
|
|
{
|
|
"description": "Service name to start",
|
|
"name": "service",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Service started successfully",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request body",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Service not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Service already running",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/service-control/stop": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Stop a running Windows service for an ACC server",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Service Control"
|
|
],
|
|
"summary": "Stop a Windows service",
|
|
"parameters": [
|
|
{
|
|
"description": "Service name to stop",
|
|
"name": "service",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Service stopped successfully",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"message": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request body",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "Insufficient permissions",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Service not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "Service already stopped",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/service-control/{service}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Get the current status of a Windows service",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"Service Control"
|
|
],
|
|
"summary": "Get service status",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Service name",
|
|
"name": "service",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Service status information",
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"state": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid service name",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Service not found",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "#/definitions/error_handler.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/state-history": {
|
|
"get": {
|
|
"description": "Return StateHistorys",
|
|
"tags": [
|
|
"StateHistory"
|
|
],
|
|
"summary": "Return StateHistorys",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/state-history/statistics": {
|
|
"get": {
|
|
"description": "Return StateHistorys",
|
|
"tags": [
|
|
"StateHistory"
|
|
],
|
|
"summary": "Return StateHistorys",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"error_handler.ErrorResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer"
|
|
},
|
|
"details": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.Permission": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.Role": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"permissions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/model.Permission"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"model.Server": {
|
|
"type": "object",
|
|
"properties": {
|
|
"dateCreated": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"description": "e.g. \"/acc/servers/server1/\"",
|
|
"type": "string"
|
|
},
|
|
"serviceName": {
|
|
"description": "Windows service name",
|
|
"type": "string"
|
|
},
|
|
"state": {
|
|
"$ref": "#/definitions/model.ServerState"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/model.ServiceStatus"
|
|
}
|
|
}
|
|
},
|
|
"model.ServerAPI": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"playerCount": {
|
|
"type": "integer"
|
|
},
|
|
"state": {
|
|
"$ref": "#/definitions/model.ServerState"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/model.ServiceStatus"
|
|
},
|
|
"track": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.ServerState": {
|
|
"type": "object",
|
|
"properties": {
|
|
"maxConnections": {
|
|
"type": "integer"
|
|
},
|
|
"playerCount": {
|
|
"type": "integer"
|
|
},
|
|
"session": {
|
|
"type": "string"
|
|
},
|
|
"sessionDurationMinutes": {
|
|
"type": "integer"
|
|
},
|
|
"sessionStart": {
|
|
"type": "string"
|
|
},
|
|
"track": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"model.ServiceStatus": {
|
|
"type": "integer",
|
|
"enum": [
|
|
0,
|
|
1,
|
|
2,
|
|
3,
|
|
4,
|
|
5
|
|
],
|
|
"x-enum-varnames": [
|
|
"StatusUnknown",
|
|
"StatusStopped",
|
|
"StatusStopping",
|
|
"StatusRestarting",
|
|
"StatusStarting",
|
|
"StatusRunning"
|
|
]
|
|
},
|
|
"model.User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"$ref": "#/definitions/model.Role"
|
|
},
|
|
"role_id": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"BearerAuth": {
|
|
"description": "Type \"Bearer\" followed by a space and JWT token.",
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "1.0",
|
|
Host: "localhost:3000",
|
|
BasePath: "/api/v1",
|
|
Schemes: []string{"http", "https"},
|
|
Title: "ACC Server Manager API",
|
|
Description: "API for managing Assetto Corsa Competizione dedicated servers",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|