Add labels to tasks (#45)
All checks were successful
the build was successful

This commit is contained in:
konrad 2018-12-31 01:18:41 +00:00 committed by Gitea
parent d39007baa0
commit 6b40df50d3
45 changed files with 9101 additions and 57 deletions

View File

@ -100,7 +100,7 @@ Sorry for some of them being in German, I'll tranlate them at some point.
* [x] Tasks innerhalb eines definierbarem Bereich, sollte aber trotzdem der server machen, so à la "Gib mir alles für diesen Monat"
* [x] Bulk-edit -> Transactions
* [x] Assignees
* [ ] Labels
* [x] Labels
* [ ] Attachments
* [ ] Task-Templates innerhalb namespaces und Listen (-> Mehrere, die auswählbar sind)
* [ ] Ein Task muss von mehreren Assignees abgehakt werden bis er als done markiert wird
@ -109,6 +109,8 @@ Sorry for some of them being in German, I'll tranlate them at some point.
### General features
* [x] Deps nach mod umziehen
* [ ] Performance bei rechtchecks verbessern
* User & Teamright sollte sich für n rechte in einer Funktion testen lassen
* [ ] Globale Limits für anlegbare Listen + Namespaces
* [ ] "Smart Lists", Listen nach bestimmten Kriterien gefiltert -> nur UI?
* [ ] "Performance-Statistik" -> Wie viele Tasks man in bestimmten Zeiträumen so geschafft hat etc

56
REST-Tests/labels.http Normal file
View File

@ -0,0 +1,56 @@
# Get all labels
GET http://localhost:8080/api/v1/labels
Authorization: Bearer {{auth_token}}
###
# Add a new label
PUT http://localhost:8080/api/v1/labels
Authorization: Bearer {{auth_token}}
Content-Type: application/json
{
"title": "test5"
}
###
# Delete a label
DELETE http://localhost:8080/api/v1/labels/6
Authorization: Bearer {{auth_token}}
###
# Update a label
POST http://localhost:8080/api/v1/labels/1
Authorization: Bearer {{auth_token}}
Content-Type: application/json
{
"title": "testschinkenbrot",
"description": "käsebrot"
}
###
# Get one label
GET http://localhost:8080/api/v1/labels/1
Authorization: Bearer {{auth_token}}
###
# Get all labels on a task
GET http://localhost:8080/api/v1/tasks/3565/labels
Authorization: Bearer {{auth_token}}
###
# Add a new label to a task
PUT http://localhost:8080/api/v1/tasks/3565/labels
Authorization: Bearer {{auth_token}}
Content-Type: application/json
{
"label_id": 1
}
###
# Delete a label from a task
DELETE http://localhost:8080/api/v1/tasks/3565/labels/1
Authorization: Bearer {{auth_token}}
###

View File

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2018-12-29 15:14:06.225275112 +0100 CET m=+0.295589005
// 2018-12-30 21:42:08.56057367 +0100 CET m=+0.082542821
package docs
@ -25,6 +25,301 @@ var doc = `{
"host": "{{.Host}}",
"basePath": "/api/v1",
"paths": {
"/labels": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Get all labels a user has access to",
"parameters": [
{
"type": "integer",
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
"name": "p",
"in": "query"
},
{
"type": "string",
"description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Creates a new label.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Create a label",
"parameters": [
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/labels/{id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns one label by its ID.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Gets one label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "The user does not have access to the label",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"404": {
"description": "Label not found",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Update an existing label. The user needs to be the creator of the label to be able to do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Update a label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"403": {
"description": "Not allowed to update the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Delete an existing label. The user needs to be the creator of the label to be able to do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Delete a label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label was successfully deleted.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "Not allowed to delete the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/lists": {
"get": {
"security": [
@ -2349,6 +2644,205 @@ var doc = `{
}
}
},
"/tasks/{task}/labels": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns all labels which are assicociated with a given task.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Get all labels on a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
"name": "p",
"in": "query"
},
{
"type": "string",
"description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Add a label to a task. The user needs to have write-access to the list to be able do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Add a label to a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label relation object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"403": {
"description": "Not allowed to add the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"404": {
"description": "The label does not exist.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/tasks/{task}/labels/{label}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Remove a label from a task. The user needs to have write-access to the list to be able do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Remove a label from a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Label ID",
"name": "label",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label was successfully removed.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "Not allowed to remove the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io.web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/teams": {
"get": {
"security": [
@ -3040,6 +3534,12 @@ var doc = `{
"id": {
"type": "integer"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"type": "integer"
},
@ -3089,6 +3589,33 @@ var doc = `{
}
}
},
"models.Label": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"created_by": {
"type": "object",
"$ref": "#/definitions/models.User"
},
"description": {
"type": "string"
},
"hex_color": {
"type": "string"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"updated": {
"type": "integer"
}
}
},
"models.List": {
"type": "object",
"properties": {
@ -3150,6 +3677,12 @@ var doc = `{
"id": {
"type": "integer"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"type": "integer"
},

View File

@ -23,6 +23,7 @@ This document describes the different errors Vikunja can return.
| 4002 | 404 | The list task does not exist. |
| 4003 | 403 | All bulk editing tasks must belong to the same list. |
| 4004 | 403 | Need at least one task when bulk editing tasks. |
| 4005 | 403 | The user does not have the right to see the task. |
| 5001 | 404 | The namspace does not exist. |
| 5003 | 403 | The user does not have access to the specified namespace. |
| 5006 | 400 | The namespace name cannot be empty. |
@ -39,3 +40,5 @@ This document describes the different errors Vikunja can return.
| 7001 | 400 | The user right is invalid. |
| 7002 | 409 | The user already has access to that list. |
| 7003 | 403 | The user does not have access to that list. |
| 8001 | 403 | This label already exists on that task. |
| 8002 | 404 | The label does not exist. |

View File

@ -12,6 +12,301 @@
"host": "{{.Host}}",
"basePath": "/api/v1",
"paths": {
"/labels": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Get all labels a user has access to",
"parameters": [
{
"type": "integer",
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
"name": "p",
"in": "query"
},
{
"type": "string",
"description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Creates a new label.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Create a label",
"parameters": [
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/labels/{id}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns one label by its ID.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Gets one label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "The user does not have access to the label",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"404": {
"description": "Label not found",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Update an existing label. The user needs to be the creator of the label to be able to do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Update a label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"403": {
"description": "Not allowed to update the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Delete an existing label. The user needs to be the creator of the label to be able to do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Delete a label",
"parameters": [
{
"type": "integer",
"description": "Label ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label was successfully deleted.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "Not allowed to delete the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/lists": {
"get": {
"security": [
@ -2336,6 +2631,205 @@
}
}
},
"/tasks/{task}/labels": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns all labels which are assicociated with a given task.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Get all labels on a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
"name": "p",
"in": "query"
},
{
"type": "string",
"description": "Search labels by label text.",
"name": "s",
"in": "query"
}
],
"responses": {
"200": {
"description": "The labels",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Add a label to a task. The user needs to have write-access to the list to be able do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Add a label to a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"description": "The label object",
"name": "label",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
}
],
"responses": {
"200": {
"description": "The created label relation object.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"400": {
"description": "Invalid label object provided.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"403": {
"description": "Not allowed to add the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"404": {
"description": "The label does not exist.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/tasks/{task}/labels/{label}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Remove a label from a task. The user needs to have write-access to the list to be able do this.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"labels"
],
"summary": "Remove a label from a task",
"parameters": [
{
"type": "integer",
"description": "Task ID",
"name": "task",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Label ID",
"name": "label",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The label was successfully removed.",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Label"
}
},
"403": {
"description": "Not allowed to remove the label.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"404": {
"description": "Label not found.",
"schema": {
"type": "object",
"$ref": "#/definitions/code.vikunja.io/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"type": "object",
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/teams": {
"get": {
"security": [
@ -3026,6 +3520,12 @@
"id": {
"type": "integer"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"type": "integer"
},
@ -3075,6 +3575,33 @@
}
}
},
"models.Label": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"created_by": {
"type": "object",
"$ref": "#/definitions/models.User"
},
"description": {
"type": "string"
},
"hex_color": {
"type": "string"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"updated": {
"type": "integer"
}
}
},
"models.List": {
"type": "object",
"properties": {
@ -3136,6 +3663,12 @@
"id": {
"type": "integer"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Label"
}
},
"listID": {
"type": "integer"
},

View File

@ -32,6 +32,10 @@ definitions:
type: integer
id:
type: integer
labels:
items:
$ref: '#/definitions/models.Label'
type: array
listID:
type: integer
parentTaskID:
@ -64,6 +68,24 @@ definitions:
token:
type: string
type: object
models.Label:
properties:
created:
type: integer
created_by:
$ref: '#/definitions/models.User'
type: object
description:
type: string
hex_color:
type: string
id:
type: integer
title:
type: string
updated:
type: integer
type: object
models.List:
properties:
created:
@ -105,6 +127,10 @@ definitions:
type: integer
id:
type: integer
labels:
items:
$ref: '#/definitions/models.Label'
type: array
listID:
type: integer
parentTaskID:
@ -369,6 +395,205 @@ info:
title: Vikunja API
version: '{{.Version}}'
paths:
/labels:
get:
consumes:
- application/json
description: Returns all labels which are either created by the user or associated
with a task the user has at least read-access to.
parameters:
- description: The page number. Used for pagination. If not provided, the first
page of results is returned.
in: query
name: p
type: integer
- description: Search labels by label text.
in: query
name: s
type: string
produces:
- application/json
responses:
"200":
description: The labels
schema:
items:
$ref: '#/definitions/models.Label'
type: array
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Get all labels a user has access to
tags:
- labels
put:
consumes:
- application/json
description: Creates a new label.
parameters:
- description: The label object
in: body
name: label
required: true
schema:
$ref: '#/definitions/models.Label'
type: object
produces:
- application/json
responses:
"200":
description: The created label object.
schema:
$ref: '#/definitions/models.Label'
type: object
"400":
description: Invalid label object provided.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Create a label
tags:
- labels
/labels/{id}:
delete:
consumes:
- application/json
description: Delete an existing label. The user needs to be the creator of the
label to be able to do this.
parameters:
- description: Label ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: The label was successfully deleted.
schema:
$ref: '#/definitions/models.Label'
type: object
"403":
description: Not allowed to delete the label.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"404":
description: Label not found.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Delete a label
tags:
- labels
get:
consumes:
- application/json
description: Returns one label by its ID.
parameters:
- description: Label ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: The label
schema:
$ref: '#/definitions/models.Label'
type: object
"403":
description: The user does not have access to the label
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"404":
description: Label not found
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Gets one label
tags:
- labels
put:
consumes:
- application/json
description: Update an existing label. The user needs to be the creator of the
label to be able to do this.
parameters:
- description: Label ID
in: path
name: id
required: true
type: integer
- description: The label object
in: body
name: label
required: true
schema:
$ref: '#/definitions/models.Label'
type: object
produces:
- application/json
responses:
"200":
description: The created label object.
schema:
$ref: '#/definitions/models.Label'
type: object
"400":
description: Invalid label object provided.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"403":
description: Not allowed to update the label.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"404":
description: Label not found.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'
type: object
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Update a label
tags:
- labels
/lists:
get:
consumes:
@ -1750,6 +1975,141 @@ paths:
summary: Update a task
tags:
- task
/tasks/{task}/labels:
get:
consumes:
- application/json
description: Returns all labels which are assicociated with a given task.
parameters:
- description: Task ID
in: path
name: task
required: true
type: integer
- description: The page number. Used for pagination. If not provided, the first
page of results is returned.
in: query
name: p
type: integer
- description: Search labels by label text.
in: query
name: s
type: string
produces:
- application/json
responses:
"200":
description: The labels
schema:
items:
$ref: '#/definitions/models.Label'
type: array
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
type: object
security:
- ApiKeyAuth: []
summary: Get all labels on a task
tags:
- labels
put:
consumes:
- application/json
description: Add a label to a task. The user needs to have write-access to the
list to be able do this.
parameters:
- description: Task ID
in: path
name: task
required: true
type: integer
- description: The label object
in: body
name: label
required: true
schema:
$ref: '#/definitions/models.Label'
type: object
produces:
- application/json
responses:
"200":
description: The created label relation object.
schema:
$ref: '#/definitions/models.Label'
type: object
"400":
description: Invalid label object provided.
schema:
$ref: '#/definitions/code.vikunja.io/web.HTTPError'