mirror of
https://github.com/Forceu/Gokapi.git
synced 2025-12-30 21:39:36 -06:00
360 lines
9.5 KiB
JSON
360 lines
9.5 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/duplicate": {
|
|
"post": {
|
|
"tags": [
|
|
"files"
|
|
],
|
|
"summary": "Duplicates an existing file",
|
|
"description": "This API call duplicates an existing file with new parameters",
|
|
"operationId": "duplicate",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/x-www-form-urlencoded": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/duplicate"
|
|
}
|
|
}
|
|
},
|
|
"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": {
|
|
"Id": {
|
|
"type": "string"
|
|
},
|
|
"Name": {
|
|
"type": "string"
|
|
},
|
|
"Size": {
|
|
"type": "string"
|
|
},
|
|
"SHA256": {
|
|
"type": "string"
|
|
},
|
|
"HotlinkId": {
|
|
"type": "string"
|
|
},
|
|
"ContentType": {
|
|
"type": "string"
|
|
},
|
|
"ExpireAt": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"ExpireAtString": {
|
|
"type": "string"
|
|
},
|
|
"DownloadsRemaining": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"DownloadCount": {
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
"UnlimitedDownloads": {
|
|
"type": "boolean"
|
|
},
|
|
"UnlimitedTime": {
|
|
"type": "boolean"
|
|
},
|
|
"RequiresClientSideDecryption": {
|
|
"type": "boolean"
|
|
},
|
|
"IsEncrypted": {
|
|
"type": "boolean"
|
|
},
|
|
"IsPasswordProtected": {
|
|
"type": "boolean"
|
|
},
|
|
"IsSavedOnLocalStorage": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"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. Unlimited if 0 is passed."
|
|
},
|
|
"expiryDays": {
|
|
"type": "integer",
|
|
"description": "How many days the file will be stored. Last used value from web interface will be used if empty. Unlimited if 0 is passed."
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"description": "Password for this file to be set. No password will be used if empty"
|
|
}
|
|
}
|
|
},"duplicate": {
|
|
"required": [
|
|
"id"
|
|
],
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "ID of file to be duplicated",
|
|
},
|
|
"allowedDownloads": {
|
|
"type": "integer",
|
|
"description": "How many downloads are allowed. Original value from web interface will be used if empty. Unlimited if 0 is passed."
|
|
},
|
|
"expiryDays": {
|
|
"type": "integer",
|
|
"description": "How many days the file will be stored. Original value from web interface will be used if empty. Unlimited if 0 is passed."
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"description": "Password for this file to be set. No password will be used if empty."
|
|
},
|
|
"originalPassword": {
|
|
"type": "boolean",
|
|
"description": "Set to true to use original password. Field \"password\" will be ignored if set."
|
|
},
|
|
"filename": {
|
|
"type": "string",
|
|
"description": "Sets a new filename. Filename will be unchanged if empty."
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"apikey": {
|
|
"type": "apiKey",
|
|
"name": "apikey",
|
|
"in": "header"
|
|
}
|
|
}
|
|
}
|
|
}
|