forked from mirrors/homebox
343290a55a
* cleanup unnecessary mocks * refactor document storage location * remove unused function * move ownership to document types to repo package * move types and mappers to repo package * refactor sets to own package
982 lines
20 KiB
YAML
982 lines
20 KiB
YAML
basePath: /api
|
|
definitions:
|
|
repo.DocumentOut:
|
|
properties:
|
|
id:
|
|
type: string
|
|
path:
|
|
type: string
|
|
title:
|
|
type: string
|
|
type: object
|
|
repo.ItemAttachment:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
document:
|
|
$ref: '#/definitions/repo.DocumentOut'
|
|
id:
|
|
type: string
|
|
type:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.ItemAttachmentUpdate:
|
|
properties:
|
|
title:
|
|
type: string
|
|
type:
|
|
type: string
|
|
type: object
|
|
repo.ItemCreate:
|
|
properties:
|
|
description:
|
|
type: string
|
|
labelIds:
|
|
items:
|
|
type: string
|
|
type: array
|
|
locationId:
|
|
description: Edges
|
|
type: string
|
|
name:
|
|
type: string
|
|
type: object
|
|
repo.ItemOut:
|
|
properties:
|
|
attachments:
|
|
items:
|
|
$ref: '#/definitions/repo.ItemAttachment'
|
|
type: array
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
insured:
|
|
type: boolean
|
|
labels:
|
|
items:
|
|
$ref: '#/definitions/repo.LabelSummary'
|
|
type: array
|
|
lifetimeWarranty:
|
|
description: Warranty
|
|
type: boolean
|
|
location:
|
|
$ref: '#/definitions/repo.LocationSummary'
|
|
description: Edges
|
|
manufacturer:
|
|
type: string
|
|
modelNumber:
|
|
type: string
|
|
name:
|
|
type: string
|
|
notes:
|
|
description: Extras
|
|
type: string
|
|
purchaseFrom:
|
|
type: string
|
|
purchasePrice:
|
|
example: "0"
|
|
type: string
|
|
purchaseTime:
|
|
description: Purchase
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
serialNumber:
|
|
type: string
|
|
soldNotes:
|
|
type: string
|
|
soldPrice:
|
|
example: "0"
|
|
type: string
|
|
soldTime:
|
|
description: Sold
|
|
type: string
|
|
soldTo:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
warrantyDetails:
|
|
type: string
|
|
warrantyExpires:
|
|
type: string
|
|
type: object
|
|
repo.ItemSummary:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
insured:
|
|
type: boolean
|
|
labels:
|
|
items:
|
|
$ref: '#/definitions/repo.LabelSummary'
|
|
type: array
|
|
location:
|
|
$ref: '#/definitions/repo.LocationSummary'
|
|
description: Edges
|
|
name:
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.ItemUpdate:
|
|
properties:
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
insured:
|
|
type: boolean
|
|
labelIds:
|
|
items:
|
|
type: string
|
|
type: array
|
|
lifetimeWarranty:
|
|
description: Warranty
|
|
type: boolean
|
|
locationId:
|
|
description: Edges
|
|
type: string
|
|
manufacturer:
|
|
type: string
|
|
modelNumber:
|
|
type: string
|
|
name:
|
|
type: string
|
|
notes:
|
|
description: Extras
|
|
type: string
|
|
purchaseFrom:
|
|
type: string
|
|
purchasePrice:
|
|
example: "0"
|
|
type: string
|
|
purchaseTime:
|
|
description: Purchase
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
serialNumber:
|
|
description: Identifications
|
|
type: string
|
|
soldNotes:
|
|
type: string
|
|
soldPrice:
|
|
example: "0"
|
|
type: string
|
|
soldTime:
|
|
description: Sold
|
|
type: string
|
|
soldTo:
|
|
type: string
|
|
warrantyDetails:
|
|
type: string
|
|
warrantyExpires:
|
|
type: string
|
|
type: object
|
|
repo.LabelCreate:
|
|
properties:
|
|
color:
|
|
type: string
|
|
description:
|
|
type: string
|
|
name:
|
|
type: string
|
|
type: object
|
|
repo.LabelOut:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/repo.ItemSummary'
|
|
type: array
|
|
name:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.LabelSummary:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.LocationCreate:
|
|
properties:
|
|
description:
|
|
type: string
|
|
name:
|
|
type: string
|
|
type: object
|
|
repo.LocationOut:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/repo.ItemSummary'
|
|
type: array
|
|
name:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.LocationOutCount:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
itemCount:
|
|
type: integer
|
|
name:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.LocationSummary:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
description:
|
|
type: string
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
updatedAt:
|
|
type: string
|
|
type: object
|
|
repo.UserOut:
|
|
properties:
|
|
email:
|
|
type: string
|
|
groupId:
|
|
type: string
|
|
groupName:
|
|
type: string
|
|
id:
|
|
type: string
|
|
isSuperuser:
|
|
type: boolean
|
|
name:
|
|
type: string
|
|
type: object
|
|
repo.UserUpdate:
|
|
properties:
|
|
email:
|
|
type: string
|
|
name:
|
|
type: string
|
|
type: object
|
|
server.Result:
|
|
properties:
|
|
details: {}
|
|
error:
|
|
type: boolean
|
|
item: {}
|
|
message:
|
|
type: string
|
|
type: object
|
|
server.Results:
|
|
properties:
|
|
items:
|
|
type: any
|
|
type: object
|
|
server.ValidationError:
|
|
properties:
|
|
field:
|
|
type: string
|
|
reason:
|
|
type: string
|
|
type: object
|
|
services.UserRegistration:
|
|
properties:
|
|
email:
|
|
type: string
|
|
groupName:
|
|
type: string
|
|
name:
|
|
type: string
|
|
password:
|
|
type: string
|
|
type: object
|
|
v1.ApiSummary:
|
|
properties:
|
|
build:
|
|
$ref: '#/definitions/v1.Build'
|
|
health:
|
|
type: boolean
|
|
message:
|
|
type: string
|
|
title:
|
|
type: string
|
|
versions:
|
|
items:
|
|
type: string
|
|
type: array
|
|
type: object
|
|
v1.Build:
|
|
properties:
|
|
buildTime:
|
|
type: string
|
|
commit:
|
|
type: string
|
|
version:
|
|
type: string
|
|
type: object
|
|
v1.ItemAttachmentToken:
|
|
properties:
|
|
token:
|
|
type: string
|
|
type: object
|
|
v1.TokenResponse:
|
|
properties:
|
|
expiresAt:
|
|
type: string
|
|
token:
|
|
type: string
|
|
type: object
|
|
info:
|
|
contact:
|
|
name: Don't
|
|
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!.
|
|
license:
|
|
name: MIT
|
|
title: Go API Templates
|
|
version: "1.0"
|
|
paths:
|
|
/v1/items:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
allOf:
|
|
- $ref: '#/definitions/server.Results'
|
|
- properties:
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/repo.ItemSummary'
|
|
type: array
|
|
type: object
|
|
security:
|
|
- Bearer: []
|
|
summary: Get All Items
|
|
tags:
|
|
- Items
|
|
post:
|
|
parameters:
|
|
- description: Item Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemCreate'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemSummary'
|
|
security:
|
|
- Bearer: []
|
|
summary: Create a new item
|
|
tags:
|
|
- Items
|
|
/v1/items/{id}:
|
|
delete:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: deletes a item
|
|
tags:
|
|
- Items
|
|
get:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: Gets a item and fields
|
|
tags:
|
|
- Items
|
|
put:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Item Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemUpdate'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: updates a item
|
|
tags:
|
|
- Items
|
|
/v1/items/{id}/attachments:
|
|
post:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: File attachment
|
|
in: formData
|
|
name: file
|
|
required: true
|
|
type: file
|
|
- description: Type of file
|
|
in: formData
|
|
name: type
|
|
required: true
|
|
type: string
|
|
- description: name of the file including extension
|
|
in: formData
|
|
name: name
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemOut'
|
|
"422":
|
|
description: Unprocessable Entity
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/server.ValidationError'
|
|
type: array
|
|
security:
|
|
- Bearer: []
|
|
summary: imports items into the database
|
|
tags:
|
|
- Items
|
|
/v1/items/{id}/attachments/{attachment_id}:
|
|
delete:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Attachment ID
|
|
in: path
|
|
name: attachment_id
|
|
required: true
|
|
type: string
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: retrieves an attachment for an item
|
|
tags:
|
|
- Items
|
|
get:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Attachment ID
|
|
in: path
|
|
name: attachment_id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/octet-stream
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/v1.ItemAttachmentToken'
|
|
security:
|
|
- Bearer: []
|
|
summary: retrieves an attachment for an item
|
|
tags:
|
|
- Items
|
|
put:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Attachment ID
|
|
in: path
|
|
name: attachment_id
|
|
required: true
|
|
type: string
|
|
- description: Attachment Update
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemAttachmentUpdate'
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.ItemOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: retrieves an attachment for an item
|
|
tags:
|
|
- Items
|
|
/v1/items/{id}/attachments/download:
|
|
get:
|
|
parameters:
|
|
- description: Item ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Attachment token
|
|
in: query
|
|
name: token
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/octet-stream
|
|
responses:
|
|
"200":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: retrieves an attachment for an item
|
|
tags:
|
|
- Items
|
|
/v1/items/import:
|
|
post:
|
|
parameters:
|
|
- description: Image to upload
|
|
in: formData
|
|
name: csv
|
|
required: true
|
|
type: file
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: imports items into the database
|
|
tags:
|
|
- Items
|
|
/v1/labels:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
allOf:
|
|
- $ref: '#/definitions/server.Results'
|
|
- properties:
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/repo.LabelOut'
|
|
type: array
|
|
type: object
|
|
security:
|
|
- Bearer: []
|
|
summary: Get All Labels
|
|
tags:
|
|
- Labels
|
|
post:
|
|
parameters:
|
|
- description: Label Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.LabelCreate'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LabelSummary'
|
|
security:
|
|
- Bearer: []
|
|
summary: Create a new label
|
|
tags:
|
|
- Labels
|
|
/v1/labels/{id}:
|
|
delete:
|
|
parameters:
|
|
- description: Label ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: deletes a label
|
|
tags:
|
|
- Labels
|
|
get:
|
|
parameters:
|
|
- description: Label ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LabelOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: Gets a label and fields
|
|
tags:
|
|
- Labels
|
|
put:
|
|
parameters:
|
|
- description: Label ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LabelOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: updates a label
|
|
tags:
|
|
- Labels
|
|
/v1/locations:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
allOf:
|
|
- $ref: '#/definitions/server.Results'
|
|
- properties:
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/repo.LocationOutCount'
|
|
type: array
|
|
type: object
|
|
security:
|
|
- Bearer: []
|
|
summary: Get All Locations
|
|
tags:
|
|
- Locations
|
|
post:
|
|
parameters:
|
|
- description: Location Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.LocationCreate'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LocationSummary'
|
|
security:
|
|
- Bearer: []
|
|
summary: Create a new location
|
|
tags:
|
|
- Locations
|
|
/v1/locations/{id}:
|
|
delete:
|
|
parameters:
|
|
- description: Location ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: deletes a location
|
|
tags:
|
|
- Locations
|
|
get:
|
|
parameters:
|
|
- description: Location ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LocationOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: Gets a location and fields
|
|
tags:
|
|
- Locations
|
|
put:
|
|
parameters:
|
|
- description: Location ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/repo.LocationOut'
|
|
security:
|
|
- Bearer: []
|
|
summary: updates a location
|
|
tags:
|
|
- Locations
|
|
/v1/status:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/v1.ApiSummary'
|
|
summary: Retrieves the basic information about the API
|
|
tags:
|
|
- Base
|
|
/v1/users/login:
|
|
post:
|
|
consumes:
|
|
- application/x-www-form-urlencoded
|
|
- application/json
|
|
parameters:
|
|
- description: string
|
|
example: admin@admin.com
|
|
in: formData
|
|
name: username
|
|
type: string
|
|
- description: string
|
|
example: admin
|
|
in: formData
|
|
name: password
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/v1.TokenResponse'
|
|
summary: User Login
|
|
tags:
|
|
- Authentication
|
|
/v1/users/logout:
|
|
post:
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: User Logout
|
|
tags:
|
|
- Authentication
|
|
/v1/users/refresh:
|
|
get:
|
|
description: |-
|
|
handleAuthRefresh returns a handler that will issue a new token from an existing token.
|
|
This does not validate that the user still exists within the database.
|
|
responses:
|
|
"200":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: User Token Refresh
|
|
tags:
|
|
- Authentication
|
|
/v1/users/register:
|
|
post:
|
|
parameters:
|
|
- description: User Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/services.UserRegistration'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
summary: Get the current user
|
|
tags:
|
|
- User
|
|
/v1/users/self:
|
|
delete:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: Deletes the user account
|
|
tags:
|
|
- User
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
allOf:
|
|
- $ref: '#/definitions/server.Result'
|
|
- properties:
|
|
item:
|
|
$ref: '#/definitions/repo.UserOut'
|
|
type: object
|
|
security:
|
|
- Bearer: []
|
|
summary: Get the current user
|
|
tags:
|
|
- User
|
|
put:
|
|
parameters:
|
|
- description: User Data
|
|
in: body
|
|
name: payload
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/repo.UserUpdate'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
allOf:
|
|
- $ref: '#/definitions/server.Result'
|
|
- properties:
|
|
item:
|
|
$ref: '#/definitions/repo.UserUpdate'
|
|
type: object
|
|
security:
|
|
- Bearer: []
|
|
summary: Update the current user
|
|
tags:
|
|
- User
|
|
/v1/users/self/password:
|
|
put:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
security:
|
|
- Bearer: []
|
|
summary: 'Update the current user''s password // TODO:'
|
|
tags:
|
|
- User
|
|
securityDefinitions:
|
|
Bearer:
|
|
description: '"Type ''Bearer TOKEN'' to correctly set the API Key"'
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|