code generation

This commit is contained in:
Hayden 2022-12-03 15:03:32 -09:00
parent 5ce1dff635
commit c1c3e30a39
No known key found for this signature in database
GPG key ID: 17CF79474E257545
4 changed files with 226 additions and 103 deletions

View file

@ -148,9 +148,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Group"
"Statistics"
],
"summary": "Get the current user's group",
"summary": "Get the current user's group statistics",
"responses": {
"200": {
"description": "OK",
@ -161,6 +161,44 @@ const docTemplate = `{
}
}
},
"/v1/groups/statistics/purchase-price": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Queries the changes overtime of the purchase price over time",
"parameters": [
{
"type": "string",
"description": "start date",
"name": "start",
"in": "query"
},
{
"type": "string",
"description": "end date",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.ValueOverTime"
}
}
}
}
},
"/v1/items": {
"get": {
"security": [
@ -449,43 +487,6 @@ const docTemplate = `{
}
}
},
"/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": [
@ -1237,6 +1238,9 @@ const docTemplate = `{
"repo.GroupStatistics": {
"type": "object",
"properties": {
"totalItemPrice": {
"type": "number"
},
"totalItems": {
"type": "integer"
},
@ -1248,6 +1252,9 @@ const docTemplate = `{
},
"totalUsers": {
"type": "integer"
},
"totalWithWarranty": {
"type": "integer"
}
}
},
@ -1821,6 +1828,40 @@ const docTemplate = `{
}
}
},
"repo.ValueOverTime": {
"type": "object",
"properties": {
"end": {
"type": "string"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ValueOverTimeEntry"
}
},
"start": {
"type": "string"
},
"valueAtEnd": {
"type": "number"
},
"valueAtStart": {
"type": "number"
}
}
},
"repo.ValueOverTimeEntry": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"value": {
"type": "number"
}
}
},
"server.ErrorResponse": {
"type": "object",
"properties": {

View file

@ -140,9 +140,9 @@
"application/json"
],
"tags": [
"Group"
"Statistics"
],
"summary": "Get the current user's group",
"summary": "Get the current user's group statistics",
"responses": {
"200": {
"description": "OK",
@ -153,6 +153,44 @@
}
}
},
"/v1/groups/statistics/purchase-price": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Queries the changes overtime of the purchase price over time",
"parameters": [
{
"type": "string",
"description": "start date",
"name": "start",
"in": "query"
},
{
"type": "string",
"description": "end date",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.ValueOverTime"
}
}
}
}
},
"/v1/items": {
"get": {
"security": [
@ -441,43 +479,6 @@
}
}
},
"/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": [
@ -1229,6 +1230,9 @@
"repo.GroupStatistics": {
"type": "object",
"properties": {
"totalItemPrice": {
"type": "number"
},
"totalItems": {
"type": "integer"
},
@ -1240,6 +1244,9 @@
},
"totalUsers": {
"type": "integer"
},
"totalWithWarranty": {
"type": "integer"
}
}
},
@ -1813,6 +1820,40 @@
}
}
},
"repo.ValueOverTime": {
"type": "object",
"properties": {
"end": {
"type": "string"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ValueOverTimeEntry"
}
},
"start": {
"type": "string"
},
"valueAtEnd": {
"type": "number"
},
"valueAtStart": {
"type": "number"
}
}
},
"repo.ValueOverTimeEntry": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"value": {
"type": "number"
}
}
},
"server.ErrorResponse": {
"type": "object",
"properties": {

View file

@ -24,6 +24,8 @@ definitions:
type: object
repo.GroupStatistics:
properties:
totalItemPrice:
type: number
totalItems:
type: integer
totalLabels:
@ -32,6 +34,8 @@ definitions:
type: integer
totalUsers:
type: integer
totalWithWarranty:
type: integer
type: object
repo.GroupUpdate:
properties:
@ -416,6 +420,28 @@ definitions:
name:
type: string
type: object
repo.ValueOverTime:
properties:
end:
type: string
entries:
items:
$ref: '#/definitions/repo.ValueOverTimeEntry'
type: array
start:
type: string
valueAtEnd:
type: number
valueAtStart:
type: number
type: object
repo.ValueOverTimeEntry:
properties:
date:
type: string
value:
type: number
type: object
server.ErrorResponse:
properties:
error:
@ -608,9 +634,32 @@ paths:
$ref: '#/definitions/repo.GroupStatistics'
security:
- Bearer: []
summary: Get the current user's group
summary: Get the current user's group statistics
tags:
- Group
- Statistics
/v1/groups/statistics/purchase-price:
get:
parameters:
- description: start date
in: query
name: start
type: string
- description: end date
in: query
name: end
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.ValueOverTime'
security:
- Bearer: []
summary: Queries the changes overtime of the purchase price over time
tags:
- Statistics
/v1/items:
get:
parameters:
@ -846,29 +895,6 @@ paths:
summary: retrieves an attachment for an item
tags:
- Items Attachments
/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: OK
security:
- Bearer: []
summary: retrieves an attachment for an item
tags:
- Items Attachments
/v1/items/import:
post:
parameters:

View file

@ -25,10 +25,12 @@ export interface Group {
}
export interface GroupStatistics {
totalItemPrice: number;
totalItems: number;
totalLabels: number;
totalLocations: number;
totalUsers: number;
totalWithWarranty: number;
}
export interface GroupUpdate {
@ -261,6 +263,19 @@ export interface UserUpdate {
name: string;
}
export interface ValueOverTime {
end: string;
entries: ValueOverTimeEntry[];
start: string;
valueAtEnd: number;
valueAtStart: number;
}
export interface ValueOverTimeEntry {
date: string;
value: number;
}
export interface ServerErrorResponse {
error: string;
fields: Record<string, string>;