homebox/backend/app/api/docs/swagger.json

1382 lines
41 KiB
JSON
Raw Normal View History

2022-08-30 02:30:36 +00:00
{
"swagger": "2.0",
"info": {
"description": "This is a simple Rest API Server Template that implements some basic User and Authentication patterns to help you get started and bootstrap your next project!.",
"title": "Go API Templates",
"contact": {
"name": "Don't"
},
"license": {
"name": "MIT"
},
"version": "1.0"
},
"basePath": "/api",
"paths": {
2022-09-03 09:17:48 +00:00
"/v1/items": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "Get All Items",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/types.ItemSummary"
2022-09-03 09:17:48 +00:00
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "Create a new item",
"parameters": [
{
"description": "Item Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.ItemCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.ItemSummary"
}
}
}
}
},
2022-09-06 19:15:07 +00:00
"/v1/items/import": {
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "imports items into the database",
"parameters": [
{
"type": "file",
"description": "Image to upload",
"name": "csv",
"in": "formData",
"required": true
}
],
"responses": {
"204": {
"description": ""
}
}
}
},
2022-09-03 09:17:48 +00:00
"/v1/items/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "Gets a item and fields",
"parameters": [
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.ItemOut"
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "updates a item",
"parameters": [
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Item Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.ItemUpdate"
}
2022-09-03 09:17:48 +00:00
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.ItemOut"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Items"
],
"summary": "deletes a item",
"parameters": [
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": ""
}
}
}
},
2022-09-01 23:11:14 +00:00
"/v1/labels": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "Get All Labels",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/types.LabelOut"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "Create a new label",
"parameters": [
{
"description": "Label Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.LabelCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LabelSummary"
}
}
}
}
},
"/v1/labels/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "Gets a label and fields",
"parameters": [
{
"type": "string",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LabelOut"
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "updates a label",
"parameters": [
{
"type": "string",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LabelOut"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Labels"
],
"summary": "deletes a label",
"parameters": [
{
"type": "string",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": ""
}
}
}
},
2022-08-31 05:22:01 +00:00
"/v1/locations": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Locations"
],
"summary": "Get All Locations",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
2022-09-03 09:17:48 +00:00
"$ref": "#/definitions/types.LocationCount"
2022-08-31 05:22:01 +00:00
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Locations"
],
"summary": "Create a new location",
"parameters": [
{
"description": "Location Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.LocationCreate"
}
}
],
2022-09-01 22:32:03 +00:00
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LocationSummary"
}
}
}
}
},
"/v1/locations/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Locations"
],
"summary": "Gets a location and fields",
"parameters": [
{
"type": "string",
"description": "Location ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LocationOut"
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Locations"
],
"summary": "updates a location",
"parameters": [
{
"type": "string",
"description": "Location ID",
"name": "id",
"in": "path",
"required": true
}
],
2022-08-31 05:22:01 +00:00
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.LocationOut"
}
}
}
2022-09-01 22:32:03 +00:00
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Locations"
],
"summary": "deletes a location",
"parameters": [
{
"type": "string",
"description": "Location ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": ""
}
}
2022-08-31 05:22:01 +00:00
}
},
2022-09-04 02:42:03 +00:00
"/v1/status": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Base"
],
"summary": "Retrieves the basic information about the API",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.ApiSummary"
}
}
}
}
},
2022-08-30 02:30:36 +00:00
"/v1/users/login": {
"post": {
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "User Login",
"parameters": [
{
"type": "string",
"example": "admin@admin.com",
"description": "string",
"name": "username",
"in": "formData"
},
{
"type": "string",
"example": "admin",
"description": "string",
"name": "password",
"in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/types.TokenResponse"
}
}
}
}
},
"/v1/users/logout": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Authentication"
],
"summary": "User Logout",
"responses": {
"204": {
"description": ""
}
}
}
},
"/v1/users/refresh": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "handleAuthRefresh returns a handler that will issue a new token from an existing token.\nThis does not validate that the user still exists within the database.",
"tags": [
"Authentication"
],
"summary": "User Token Refresh",
"responses": {
"200": {
"description": ""
}
}
}
},
2022-08-30 18:05:11 +00:00
"/v1/users/register": {
"post": {
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Get the current user",
"parameters": [
{
"description": "User Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.UserRegistration"
}
}
],
"responses": {
2022-08-31 05:22:01 +00:00
"204": {
"description": ""
2022-08-30 18:05:11 +00:00
}
}
}
},
2022-08-30 02:30:36 +00:00
"/v1/users/self": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Get the current user",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Result"
},
{
"type": "object",
"properties": {
"item": {
"$ref": "#/definitions/types.UserOut"
2022-08-30 02:30:36 +00:00
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Update the current user",
"parameters": [
{
"description": "User Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/types.UserUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Result"
},
{
"type": "object",
"properties": {
"item": {
"$ref": "#/definitions/types.UserUpdate"
}
}
}
]
}
}
}
2022-09-04 02:42:03 +00:00
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Deletes the user account",
"responses": {
"204": {
"description": ""
}
}
2022-08-30 02:30:36 +00:00
}
},
"/v1/users/self/password": {
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Update the current user's password // TODO:",
"responses": {
"204": {
"description": ""
}
}
}
}
},
"definitions": {
"server.Result": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"details": {},
"error": {
"type": "boolean"
2022-08-30 18:05:11 +00:00
},
"item": {},
"message": {
2022-08-30 18:05:11 +00:00
"type": "string"
}
}
},
"server.Results": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"items": {
"type": "any"
2022-08-30 18:05:11 +00:00
}
}
},
"types.ApiSummary": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
2022-09-14 04:06:07 +00:00
"build": {
"$ref": "#/definitions/types.Build"
},
"health": {
"type": "boolean"
2022-08-30 18:05:11 +00:00
},
"message": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"title": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"versions": {
2022-08-30 18:05:11 +00:00
"type": "array",
"items": {
"type": "string"
2022-08-30 18:05:11 +00:00
}
}
}
},
2022-09-14 04:06:07 +00:00
"types.Build": {
"type": "object",
"properties": {
"build_time": {
"type": "string"
},
"commit": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"types.DocumentOut": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"id": {
"type": "string"
},
"path": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"title": {
2022-09-09 18:20:38 +00:00
"type": "string"
2022-08-30 18:05:11 +00:00
}
}
},
"types.ItemAttachment": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"createdAt": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"document": {
"$ref": "#/definitions/types.DocumentOut"
2022-08-30 18:05:11 +00:00
},
"id": {
"type": "string"
},
"updatedAt": {
2022-08-30 18:05:11 +00:00
"type": "string"
}
}
},
"types.ItemCreate": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"description": {
"type": "string"
},
"labelIds": {
"type": "array",
"items": {
"type": "string"
}
2022-08-30 18:05:11 +00:00
},
"locationId": {
"description": "Edges",
2022-08-30 18:05:11 +00:00
"type": "string"
},
"name": {
"type": "string"
}
}
},
"types.ItemOut": {
2022-08-30 18:05:11 +00:00
"type": "object",
"properties": {
"attachments": {
2022-08-30 18:05:11 +00:00
"type": "array",
"items": {
"$ref": "#/definitions/types.ItemAttachment"
2022-08-30 18:05:11 +00:00
}
},
"createdAt": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"insured": {
"type": "boolean"
2022-08-30 18:05:11 +00:00
},
"labels": {
2022-08-30 18:05:11 +00:00
"type": "array",
"items": {
"$ref": "#/definitions/types.LabelSummary"
2022-08-30 18:05:11 +00:00
}
},
"lifetimeWarranty": {
"description": "Warranty",
"type": "boolean"
2022-08-30 18:05:11 +00:00
},
"location": {
"description": "Edges",
"$ref": "#/definitions/types.LocationSummary"
2022-08-30 18:05:11 +00:00
},
"manufacturer": {
2022-08-30 18:05:11 +00:00
"type": "string"
},
"modelNumber": {
"type": "string"
2022-08-30 18:05:11 +00:00
},
"name": {
"type": "string"
},
"notes": {
"description": "Extras",
2022-08-30 18:05:11 +00:00
"type": "string"
},
"purchaseFrom": {
"type": "string"
2022-08-30 02:30:36 +00:00
},
"purchasePrice": {
"type": "string",
"example": "0"
},
"purchaseTime": {
"description": "Purchase",
2022-08-30 02:30:36 +00:00
"type": "string"
},
"quantity": {
"type": "integer"
},
"serialNumber": {
"description": "Identifications",
2022-08-30 02:30:36 +00:00
"type": "string"
},
"soldNotes": {
2022-08-30 02:30:36 +00:00
"type": "string"
},
"soldPrice": {
"type": "string",
"example": "0"
},
"soldTime": {
"description": "Sold",
2022-09-03 09:17:48 +00:00
"type": "string"
},
"soldTo": {
"type": "string"
2022-09-03 09:17:48 +00:00
},
"updatedAt": {
2022-09-03 09:17:48 +00:00
"type": "string"
},
"warrantyDetails": {
"type": "string"
},
"warrantyExpires": {
2022-09-03 09:17:48 +00:00
"type": "string"
}
}
},
"types.ItemSummary": {
2022-09-03 09:17:48 +00:00
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"insured": {
"type": "boolean"
},
2022-09-03 09:17:48 +00:00
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/types.LabelSummary"
}
},
2022-09-09 18:20:38 +00:00
"lifetimeWarranty": {
"description": "Warranty",
"type": "boolean"
},
2022-09-03 09:17:48 +00:00
"location": {
"description": "Edges",
"$ref": "#/definitions/types.LocationSummary"
},
"manufacturer": {
"type": "string"
},
"modelNumber": {
"type": "string"
},
"name": {
"type": "string"
},
"notes": {
"description": "Extras",
"type": "string"
},
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "string",
"example": "0"
2022-09-03 09:17:48 +00:00
},
"purchaseTime": {
"description": "Purchase",
"type": "string"
},
"quantity": {
"type": "integer"
},
2022-09-03 09:17:48 +00:00
"serialNumber": {
"description": "Identifications",
"type": "string"
},
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "string",
"example": "0"
2022-09-03 09:17:48 +00:00
},
"soldTime": {
"description": "Sold",
"type": "string"
},
"soldTo": {
"type": "string"
},
"updatedAt": {
"type": "string"
2022-09-09 18:20:38 +00:00
},
"warrantyDetails": {
"type": "string"
},
"warrantyExpires": {
"type": "string"
2022-09-03 09:17:48 +00:00
}
}
},
"types.ItemUpdate": {
2022-09-01 22:32:03 +00:00
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"insured": {
"type": "boolean"
},
"labelIds": {
2022-09-03 09:17:48 +00:00
"type": "array",
"items": {
"type": "string"
2022-09-03 09:17:48 +00:00
}
},
2022-09-09 18:20:38 +00:00
"lifetimeWarranty": {
"description": "Warranty",
"type": "boolean"
},
"locationId": {
2022-09-03 09:17:48 +00:00
"description": "Edges",
"type": "string"
2022-09-03 09:17:48 +00:00
},
"manufacturer": {
"type": "string"
},
"modelNumber": {
2022-09-01 22:32:03 +00:00
"type": "string"
},
"name": {
"type": "string"
},
2022-09-03 09:17:48 +00:00
"notes": {
"description": "Extras",
"type": "string"
},
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "string",
"example": "0"
2022-09-03 09:17:48 +00:00
},
"purchaseTime": {
"description": "Purchase",
"type": "string"
},
"quantity": {
"type": "integer"
},
2022-09-03 09:17:48 +00:00
"serialNumber": {
"description": "Identifications",
"type": "string"
},
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "string",
"example": "0"
2022-09-03 09:17:48 +00:00
},
"soldTime": {
"description": "Sold",
"type": "string"
},
"soldTo": {
"type": "string"
},
2022-09-09 18:20:38 +00:00
"warrantyDetails": {
"type": "string"
},
"warrantyExpires": {
"type": "string"
2022-09-01 22:32:03 +00:00
}
}
},
2022-09-01 23:11:14 +00:00
"types.LabelCreate": {
2022-09-02 01:52:40 +00:00
"type": "object",
"properties": {
"color": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
2022-09-01 23:11:14 +00:00
},
"types.LabelOut": {
2022-09-02 01:52:40 +00:00
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"groupId": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/types.ItemSummary"
}
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
2022-09-01 23:11:14 +00:00
},
"types.LabelSummary": {
2022-09-02 01:52:40 +00:00
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"groupId": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
2022-09-01 23:11:14 +00:00
},
2022-09-03 09:17:48 +00:00
"types.LocationCount": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"itemCount": {
"type": "integer"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
2022-08-31 05:22:01 +00:00
"types.LocationCreate": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"types.LocationOut": {
2022-09-01 22:32:03 +00:00
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/types.ItemSummary"
}
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"types.LocationSummary": {
2022-08-31 05:22:01 +00:00
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
2022-08-30 02:30:36 +00:00
}
},
"types.TokenResponse": {
"type": "object",
"properties": {
"expiresAt": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
2022-08-30 18:05:11 +00:00
"types.UserIn": {
2022-08-30 02:30:36 +00:00
"type": "object",
"properties": {
"email": {
"type": "string"
},
2022-08-30 18:05:11 +00:00
"name": {
2022-08-30 02:30:36 +00:00
"type": "string"
},
2022-08-30 18:05:11 +00:00
"password": {
"type": "string"
}
}
},
"types.UserOut": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"groupId": {
"type": "string"
},
"groupName": {
"type": "string"
},
"id": {
"type": "string"
},
"isSuperuser": {
"type": "boolean"
},
"name": {
"type": "string"
}
}
},
2022-08-30 18:05:11 +00:00
"types.UserRegistration": {
"type": "object",
"properties": {
"groupName": {
2022-08-30 02:30:36 +00:00
"type": "string"
2022-08-30 18:05:11 +00:00
},
"user": {
"$ref": "#/definitions/types.UserIn"
2022-08-30 02:30:36 +00:00
}
}
},
"types.UserUpdate": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"Bearer": {
"description": "\"Type 'Bearer TOKEN' to correctly set the API Key\"",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}