add possibility to list, serve and delete attachments

see #52
This commit is contained in:
Bernhard B
2021-01-14 15:27:38 +01:00
parent 787bb2b50b
commit 510499b4ac
5 changed files with 383 additions and 4 deletions

View File

@@ -45,6 +45,103 @@ var doc = `{
}
}
},
"/v1/attachments": {
"get": {
"description": "List all downloaded attachments",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "List all attachments.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/attachments/{attachment}": {
"get": {
"description": "Serve the attachment with the given id",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "Serve Attachment.",
"parameters": [
{
"type": "string",
"description": "Attachment ID",
"name": "attachment",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Remove the attachment with the given id from filesystem.",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "Remove attachment.",
"parameters": [
{
"type": "string",
"description": "Attachment ID",
"name": "attachment",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/groups/{number}": {
"get": {
"description": "List all Signal Groups.",
@@ -169,7 +266,7 @@ var doc = `{
},
"/v1/qrcodelink": {
"get": {
"description": "test",
"description": "Link device and generate QR code",
"produces": [
"application/json"
],
@@ -537,6 +634,10 @@ var doc = `{
{
"description": "Send and Receive Signal Messages.",
"name": "Messages"
},
{
"description": "List and Delete Attachments.",
"name": "Attachments"
}
]
}`

View File

@@ -30,6 +30,103 @@
}
}
},
"/v1/attachments": {
"get": {
"description": "List all downloaded attachments",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "List all attachments.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/attachments/{attachment}": {
"get": {
"description": "Serve the attachment with the given id",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "Serve Attachment.",
"parameters": [
{
"type": "string",
"description": "Attachment ID",
"name": "attachment",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
},
"delete": {
"description": "Remove the attachment with the given id from filesystem.",
"produces": [
"application/json"
],
"tags": [
"Attachments"
],
"summary": "Remove attachment.",
"parameters": [
{
"type": "string",
"description": "Attachment ID",
"name": "attachment",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/groups/{number}": {
"get": {
"description": "List all Signal Groups.",
@@ -154,7 +251,7 @@
},
"/v1/qrcodelink": {
"get": {
"description": "test",
"description": "Link device and generate QR code",
"produces": [
"application/json"
],
@@ -522,6 +619,10 @@
{
"description": "Send and Receive Signal Messages.",
"name": "Messages"
},
{
"description": "List and Delete Attachments.",
"name": "Attachments"
}
]
}

View File

@@ -92,6 +92,70 @@ paths:
summary: Lists general information about the API
tags:
- General
/v1/attachments:
get:
description: List all downloaded attachments
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: string
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: List all attachments.
tags:
- Attachments
/v1/attachments/{attachment}:
delete:
description: Remove the attachment with the given id from filesystem.
parameters:
- description: Attachment ID
in: path
name: attachment
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Remove attachment.
tags:
- Attachments
get:
description: Serve the attachment with the given id
parameters:
- description: Attachment ID
in: path
name: attachment
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Serve Attachment.
tags:
- Attachments
/v1/groups/{number}:
get:
consumes:
@@ -175,7 +239,7 @@ paths:
- Groups
/v1/qrcodelink:
get:
description: test
description: Link device and generate QR code
produces:
- application/json
responses:
@@ -342,3 +406,5 @@ tags:
name: Groups
- description: Send and Receive Signal Messages.
name: Messages
- description: List and Delete Attachments.
name: Attachments