{ "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": { "/v1/groups": { "get": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "Group" ], "summary": "Get the current user's group", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.Group" } } } }, "put": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "Group" ], "summary": "Updates some fields of the current users group", "parameters": [ { "description": "User Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/repo.GroupUpdate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.Group" } } } } }, "/v1/groups/invitations": { "post": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "Group" ], "summary": "Get the current user", "parameters": [ { "description": "User Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.GroupInvitationCreate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.GroupInvitation" } } } } }, "/v1/items": { "get": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "Items" ], "summary": "Get All Items", "parameters": [ { "type": "string", "description": "search string", "name": "q", "in": "query" }, { "type": "integer", "description": "page number", "name": "page", "in": "query" }, { "type": "integer", "description": "items per page", "name": "pageSize", "in": "query" }, { "type": "array", "items": { "type": "string" }, "collectionFormat": "multi", "description": "label Ids", "name": "labels", "in": "query" }, { "type": "array", "items": { "type": "string" }, "collectionFormat": "multi", "description": "location Ids", "name": "locations", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.PaginationResult-repo_ItemSummary" } } } }, "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/repo.ItemCreate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.ItemSummary" } } } } }, "/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": "No Content" } } } }, "/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/repo.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/repo.ItemUpdate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.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": "No Content" } } } }, "/v1/items/{id}/attachments": { "post": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "Items Attachments" ], "summary": "imports items into the database", "parameters": [ { "type": "string", "description": "Item ID", "name": "id", "in": "path", "required": true }, { "type": "file", "description": "File attachment", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "Type of file", "name": "type", "in": "formData", "required": true }, { "type": "string", "description": "name of the file including extension", "name": "name", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.ItemOut" } }, "422": { "description": "Unprocessable Entity", "schema": { "type": "array", "items": { "$ref": "#/definitions/server.ValidationError" } } } } } }, "/v1/items/{id}/attachments/download": { "get": { "security": [ { "Bearer": [] } ], "produces": [ "application/octet-stream" ], "tags": [ "Items Attachments" ], "summary": "retrieves an attachment for an item", "parameters": [ { "type": "string", "description": "Item ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Attachment token", "name": "token", "in": "query", "required": true } ], "responses": { "200": { "description": "OK" } } } }, "/v1/items/{id}/attachments/{attachment_id}": { "get": { "security": [ { "Bearer": [] } ], "produces": [ "application/octet-stream" ], "tags": [ "Items Attachments" ], "summary": "retrieves an attachment for an item", "parameters": [ { "type": "string", "description": "Item ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Attachment ID", "name": "attachment_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ItemAttachmentToken" } } } }, "put": { "security": [ { "Bearer": [] } ], "tags": [ "Items Attachments" ], "summary": "retrieves an attachment for an item", "parameters": [ { "type": "string", "description": "Item ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Attachment ID", "name": "attachment_id", "in": "path", "required": true }, { "description": "Attachment Update", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/repo.ItemAttachmentUpdate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.ItemOut" } } } }, "delete": { "security": [ { "Bearer": [] } ], "tags": [ "Items Attachments" ], "summary": "retrieves an attachment for an item", "parameters": [ { "type": "string", "description": "Item ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Attachment ID", "name": "attachment_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" } } } }, "/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/repo.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/repo.LabelCreate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.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/repo.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/repo.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": "No Content" } } } }, "/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": { "$ref": "#/definitions/repo.LocationOutCount" } } } } ] } } } }, "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/repo.LocationCreate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.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/repo.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 }, { "description": "Location Data", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/repo.LocationUpdate" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repo.LocationOut" } } } }, "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": "No Content" } } } }, "/v1/status": { "get": { "produces": [ "application/json" ], "tags": [ "Base" ], "summary": "Retrieves the basic information about the API", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/v1.ApiSummary" } } } } }, "/v1/users/change-password": { "put": { "security": [ { "Bearer": [] } ], "tags": [ "User" ], "summary": "Updates the users password", "parameters": [ { "description": "Password Payload", "name": "payload", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1.ChangePassword" } } ], "responses": { "204": { "description": "No Content" } } } }, "/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/v1.TokenResponse" } } } } }, "/v1/users/logout": { "post": { "security": [ { "Bearer": [] } ], "tags": [ "Authentication" ], "summary": "User Logout", "responses": { "204": { "description": "No Content" } } } }, "/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": "OK" } } } }, "/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/services.UserRegistration" } } ], "responses": { "204": { "description": "No Content" } } } }, "/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/repo.UserOut" } } } ] } } } }, "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/repo.UserUpdate" } } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/server.Result" }, { "type": "object", "properties": { "item": { "$ref": "#/definitions/repo.UserUpdate" } } } ] } } } }, "delete": { "security": [ { "Bearer": [] } ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "Deletes the user account", "responses": { "204": { "description": "No Content" } } } } }, "definitions": { "repo.DocumentOut": { "type": "object", "properties": { "id": { "type": "string" }, "path": { "type": "string" }, "title": { "type": "string" } } }, "repo.Group": { "type": "object", "properties": { "createdAt": { "type": "string" }, "currency": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.GroupUpdate": { "type": "object", "properties": { "currency": { "type": "string" }, "name": { "type": "string" } } }, "repo.ItemAttachment": { "type": "object", "properties": { "createdAt": { "type": "string" }, "document": { "$ref": "#/definitions/repo.DocumentOut" }, "id": { "type": "string" }, "type": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.ItemAttachmentUpdate": { "type": "object", "properties": { "title": { "type": "string" }, "type": { "type": "string" } } }, "repo.ItemCreate": { "type": "object", "properties": { "description": { "type": "string" }, "labelIds": { "type": "array", "items": { "type": "string" } }, "locationId": { "description": "Edges", "type": "string" }, "name": { "type": "string" }, "parentId": { "type": "string", "x-nullable": true } } }, "repo.ItemField": { "type": "object", "properties": { "booleanValue": { "type": "boolean" }, "id": { "type": "string" }, "name": { "type": "string" }, "numberValue": { "type": "integer" }, "textValue": { "type": "string" }, "timeValue": { "type": "string" }, "type": { "type": "string" } } }, "repo.ItemOut": { "type": "object", "properties": { "attachments": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemAttachment" } }, "children": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemSummary" } }, "createdAt": { "type": "string" }, "description": { "type": "string" }, "fields": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemField" } }, "id": { "type": "string" }, "insured": { "type": "boolean" }, "labels": { "type": "array", "items": { "$ref": "#/definitions/repo.LabelSummary" } }, "lifetimeWarranty": { "description": "Warranty", "type": "boolean" }, "location": { "description": "Edges", "x-nullable": true, "x-omitempty": true, "$ref": "#/definitions/repo.LocationSummary" }, "manufacturer": { "type": "string" }, "modelNumber": { "type": "string" }, "name": { "type": "string" }, "notes": { "description": "Extras", "type": "string" }, "parent": { "x-nullable": true, "x-omitempty": true, "$ref": "#/definitions/repo.ItemSummary" }, "purchaseFrom": { "type": "string" }, "purchasePrice": { "type": "string", "example": "0" }, "purchaseTime": { "description": "Purchase", "type": "string" }, "quantity": { "type": "integer" }, "serialNumber": { "type": "string" }, "soldNotes": { "type": "string" }, "soldPrice": { "type": "string", "example": "0" }, "soldTime": { "description": "Sold", "type": "string" }, "soldTo": { "type": "string" }, "updatedAt": { "type": "string" }, "warrantyDetails": { "type": "string" }, "warrantyExpires": { "type": "string" } } }, "repo.ItemSummary": { "type": "object", "properties": { "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "insured": { "type": "boolean" }, "labels": { "type": "array", "items": { "$ref": "#/definitions/repo.LabelSummary" } }, "location": { "description": "Edges", "x-nullable": true, "x-omitempty": true, "$ref": "#/definitions/repo.LocationSummary" }, "name": { "type": "string" }, "quantity": { "type": "integer" }, "updatedAt": { "type": "string" } } }, "repo.ItemUpdate": { "type": "object", "properties": { "description": { "type": "string" }, "fields": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemField" } }, "id": { "type": "string" }, "insured": { "type": "boolean" }, "labelIds": { "type": "array", "items": { "type": "string" } }, "lifetimeWarranty": { "description": "Warranty", "type": "boolean" }, "locationId": { "description": "Edges", "type": "string" }, "manufacturer": { "type": "string" }, "modelNumber": { "type": "string" }, "name": { "type": "string" }, "notes": { "description": "Extras", "type": "string" }, "parentId": { "type": "string", "x-nullable": true, "x-omitempty": true }, "purchaseFrom": { "type": "string" }, "purchasePrice": { "type": "string", "example": "0" }, "purchaseTime": { "description": "Purchase", "type": "string" }, "quantity": { "type": "integer" }, "serialNumber": { "description": "Identifications", "type": "string" }, "soldNotes": { "type": "string" }, "soldPrice": { "type": "string", "example": "0" }, "soldTime": { "description": "Sold", "type": "string" }, "soldTo": { "type": "string" }, "warrantyDetails": { "type": "string" }, "warrantyExpires": { "type": "string" } } }, "repo.LabelCreate": { "type": "object", "properties": { "color": { "type": "string" }, "description": { "type": "string" }, "name": { "type": "string" } } }, "repo.LabelOut": { "type": "object", "properties": { "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "items": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemSummary" } }, "name": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.LabelSummary": { "type": "object", "properties": { "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.LocationCreate": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" } } }, "repo.LocationOut": { "type": "object", "properties": { "children": { "type": "array", "items": { "$ref": "#/definitions/repo.LocationSummary" } }, "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "items": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemSummary" } }, "name": { "type": "string" }, "parent": { "$ref": "#/definitions/repo.LocationSummary" }, "updatedAt": { "type": "string" } } }, "repo.LocationOutCount": { "type": "object", "properties": { "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "itemCount": { "type": "integer" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.LocationSummary": { "type": "object", "properties": { "createdAt": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "updatedAt": { "type": "string" } } }, "repo.LocationUpdate": { "type": "object", "properties": { "description": { "type": "string" }, "id": { "type": "string" }, "name": { "type": "string" }, "parentId": { "type": "string", "x-nullable": true } } }, "repo.PaginationResult-repo_ItemSummary": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/repo.ItemSummary" } }, "page": { "type": "integer" }, "pageSize": { "type": "integer" }, "total": { "type": "integer" } } }, "repo.UserOut": { "type": "object", "properties": { "email": { "type": "string" }, "groupId": { "type": "string" }, "groupName": { "type": "string" }, "id": { "type": "string" }, "isOwner": { "type": "boolean" }, "isSuperuser": { "type": "boolean" }, "name": { "type": "string" } } }, "repo.UserUpdate": { "type": "object", "properties": { "email": { "type": "string" }, "name": { "type": "string" } } }, "server.Result": { "type": "object", "properties": { "details": {}, "error": { "type": "boolean" }, "item": {}, "message": { "type": "string" } } }, "server.Results": { "type": "object", "properties": { "items": {} } }, "server.ValidationError": { "type": "object", "properties": { "field": { "type": "string" }, "reason": { "type": "string" } } }, "services.UserRegistration": { "type": "object", "properties": { "email": { "type": "string" }, "name": { "type": "string" }, "password": { "type": "string" }, "token": { "type": "string" } } }, "v1.ApiSummary": { "type": "object", "properties": { "build": { "$ref": "#/definitions/v1.Build" }, "demo": { "type": "boolean" }, "health": { "type": "boolean" }, "message": { "type": "string" }, "title": { "type": "string" }, "versions": { "type": "array", "items": { "type": "string" } } } }, "v1.Build": { "type": "object", "properties": { "buildTime": { "type": "string" }, "commit": { "type": "string" }, "version": { "type": "string" } } }, "v1.ChangePassword": { "type": "object", "properties": { "current": { "type": "string" }, "new": { "type": "string" } } }, "v1.GroupInvitation": { "type": "object", "properties": { "expiresAt": { "type": "string" }, "token": { "type": "string" }, "uses": { "type": "integer" } } }, "v1.GroupInvitationCreate": { "type": "object", "properties": { "expiresAt": { "type": "string" }, "uses": { "type": "integer" } } }, "v1.ItemAttachmentToken": { "type": "object", "properties": { "token": { "type": "string" } } }, "v1.TokenResponse": { "type": "object", "properties": { "expiresAt": { "type": "string" }, "token": { "type": "string" } } } }, "securityDefinitions": { "Bearer": { "description": "\"Type 'Bearer TOKEN' to correctly set the API Key\"", "type": "apiKey", "name": "Authorization", "in": "header" } } }