Files
Gokapi/openapi.json
Marc Ole Bulling e6c3cfdc68 Final release v1.2.0
2021-05-07 16:53:41 +02:00

272 lines
6.8 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"title": "Gokapi",
"description": "[https://github.com/Forceu/Gokapi](https://github.com/Forceu/Gokapi)\n",
"version": "1.0"
},
"servers": [
{
"url": "/api/",
"description": "Target Server"
}
],
"security": [
{
"apikey": []
}
],
"tags": [
{
"name": "files"
},
{
"name": "auth"
}
],
"paths": {
"/files/list": {
"get": {
"tags": [
"files"
],
"summary": "Lists all files",
"description": "This API call lists all files that are not expired.",
"operationId": "list",
"responses": {
"200": {
"description": "Operation successful",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/File"
}
}
}
}
},
"400": {
"description": "Invalid input"
},
"401": {
"description": "Invalid API key provided or not logged in as admin"
}
}
}
},
"/files/add": {
"post": {
"tags": [
"files"
],
"summary": "Adds a new file",
"description": "This API call uploads the submitted file to Gokapi",
"operationId": "add",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/body"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Operation successful",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadResult"
}
}
}
},
"400": {
"description": "Invalid input"
},
"401": {
"description": "Invalid API key provided or not logged in as admin"
}
}
}
},
"/files/delete": {
"delete": {
"tags": [
"files"
],
"summary": "Deletes the selected file",
"description": "This API call deletes the selected file and runs the clean-up procedure which purges all expired files from the data directory immediately",
"operationId": "delete",
"parameters": [
{
"name": "id",
"in": "header",
"description": "The ID of the file to be deleted",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Operation successful"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Invalid API key provided or not logged in as admin"
}
}
}
},
"/auth/friendlyname": {
"put": {
"tags": [
"auth"
],
"summary": "Changes the name of the API key",
"description": "This API call changes the name of the API key that is shown in the API overview",
"operationId": "friendlyname",
"parameters": [
{
"name": "apiKeyToModify",
"in": "header",
"description": "The API key to change the name of",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "string"
}
},
{
"name": "friendlyName",
"in": "header",
"description": "The new name of the API key",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Operation successful"
},
"400": {
"description": "Invalid ID supplied"
},
"401": {
"description": "Invalid API key provided or not logged in as admin"
}
}
}
}
},
"components": {
"schemas": {
"File": {
"type": "object",
"properties": {
"ContentType": {
"type": "string"
},
"DownloadsRemaining": {
"type": "integer",
"format": "int64"
},
"ExpireAt": {
"type": "integer",
"format": "int64"
},
"ExpireAtString": {
"type": "string"
},
"HotlinkId": {
"type": "string"
},
"Id": {
"type": "string"
},
"Name": {
"type": "string"
},
"PasswordHash": {
"type": "string"
},
"SHA256": {
"type": "string"
},
"Size": {
"type": "string"
}
},
"description": "File is a struct used for saving information about an uploaded file",
"x-go-package": "Gokapi/internal/models"
},
"UploadResult": {
"type": "object",
"properties": {
"FileInfo": {
"$ref": "#/components/schemas/File"
},
"HotlinkUrl": {
"type": "string"
},
"Result": {
"type": "string"
},
"Url": {
"type": "string"
}
},
"description": "UploadResult is the struct used for the result after an upload",
"x-go-package": "Gokapi/internal/models"
},
"body": {
"required": [
"file"
],
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "The file to be uploaded",
"format": "binary"
},
"allowedDownloads": {
"type": "integer",
"description": "How many downloads are allowed. Last used value from web interface will be used if empty."
},
"expiryDays": {
"type": "integer",
"description": "How many days the file will be stored. Last used value from web interface will be used if empty."
},
"password": {
"type": "string",
"description": "Password for this file to be set. No password will be used if empty"
}
}
}
},
"securitySchemes": {
"apikey": {
"type": "apiKey",
"name": "apikey",
"in": "header"
}
}
}
}