1
0

Subscriptions and notifications for namespaces, tasks and lists (#786)

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/786
Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad
2021-02-14 19:18:14 +00:00
parent 618b464ca3
commit e7875ecb3b
25 changed files with 1714 additions and 23 deletions

View File

@ -3991,6 +3991,128 @@ var doc = `{
}
}
},
"/subscriptions/{entity}/{entityID}": {
"put": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Subscribes the current user to an entity.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Subscribes the current user to an entity.",
"parameters": [
{
"type": "string",
"description": "The entity the user subscribes to. Can be either ` + "`" + `namespace` + "`" + `, ` + "`" + `list` + "`" + ` or ` + "`" + `task` + "`" + `.",
"name": "entity",
"in": "path",
"required": true
},
{
"type": "string",
"description": "The numeric id of the entity to subscribe to.",
"name": "entityID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The subscription",
"schema": {
"$ref": "#/definitions/models.Subscription"
}
},
"403": {
"description": "The user does not have access to subscribe to this entity.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"412": {
"description": "The subscription entity is invalid.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
},
"delete": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Unsubscribes the current user to an entity.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Unsubscribe the current user from an entity.",
"parameters": [
{
"type": "string",
"description": "The entity the user subscribed to. Can be either ` + "`" + `namespace` + "`" + `, ` + "`" + `list` + "`" + ` or ` + "`" + `task` + "`" + `.",
"name": "entity",
"in": "path",
"required": true
},
{
"type": "string",
"description": "The numeric id of the subscribed entity to.",
"name": "entityID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The subscription",
"schema": {
"$ref": "#/definitions/models.Subscription"
}
},
"403": {
"description": "The user does not have access to subscribe to this entity.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"404": {
"description": "The subscription does not exist.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/tasks/all": {
"get": {
"security": [
@ -7039,6 +7161,10 @@ var doc = `{
"description": "When this task starts.",
"type": "string"
},
"subscription": {
"description": "The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one task.",
"$ref": "#/definitions/models.Subscription"
},
"task_ids": {
"description": "A list of task ids to update",
"type": "array",
@ -7201,6 +7327,10 @@ var doc = `{
"description": "The user who created this list.",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this list. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one list.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The title of the list. You'll see this in the namespace overview.",
"type": "string",
@ -7290,6 +7420,10 @@ var doc = `{
"description": "The user who owns this namespace",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one namespace.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The name of this namespace.",
"type": "string",
@ -7363,6 +7497,10 @@ var doc = `{
"description": "The user who owns this namespace",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one namespace.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The name of this namespace.",
"type": "string",
@ -7419,6 +7557,30 @@ var doc = `{
}
}
},
"models.Subscription": {
"type": "object",
"properties": {
"created": {
"description": "A timestamp when this subscription was created. You cannot change this value.",
"type": "string"
},
"entity": {
"type": "string"
},
"entity_id": {
"description": "The id of the entity to subscribe to.",
"type": "integer"
},
"id": {
"description": "The numeric ID of the subscription",
"type": "integer"
},
"user": {
"description": "The user who made this subscription",
"$ref": "#/definitions/user.User"
}
}
},
"models.Task": {
"type": "object",
"properties": {
@ -7535,6 +7697,10 @@ var doc = `{
"description": "When this task starts.",
"type": "string"
},
"subscription": {
"description": "The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one task.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The task text. This is what you'll see in the list.",
"type": "string",

View File

@ -3974,6 +3974,128 @@
}
}
},
"/subscriptions/{entity}/{entityID}": {
"put": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Subscribes the current user to an entity.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Subscribes the current user to an entity.",
"parameters": [
{
"type": "string",
"description": "The entity the user subscribes to. Can be either `namespace`, `list` or `task`.",
"name": "entity",
"in": "path",
"required": true
},
{
"type": "string",
"description": "The numeric id of the entity to subscribe to.",
"name": "entityID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The subscription",
"schema": {
"$ref": "#/definitions/models.Subscription"
}
},
"403": {
"description": "The user does not have access to subscribe to this entity.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"412": {
"description": "The subscription entity is invalid.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
},
"delete": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Unsubscribes the current user to an entity.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Unsubscribe the current user from an entity.",
"parameters": [
{
"type": "string",
"description": "The entity the user subscribed to. Can be either `namespace`, `list` or `task`.",
"name": "entity",
"in": "path",
"required": true
},
{
"type": "string",
"description": "The numeric id of the subscribed entity to.",
"name": "entityID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The subscription",
"schema": {
"$ref": "#/definitions/models.Subscription"
}
},
"403": {
"description": "The user does not have access to subscribe to this entity.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"404": {
"description": "The subscription does not exist.",
"schema": {
"$ref": "#/definitions/web.HTTPError"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/tasks/all": {
"get": {
"security": [
@ -7022,6 +7144,10 @@
"description": "When this task starts.",
"type": "string"
},
"subscription": {
"description": "The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one task.",
"$ref": "#/definitions/models.Subscription"
},
"task_ids": {
"description": "A list of task ids to update",
"type": "array",
@ -7184,6 +7310,10 @@
"description": "The user who created this list.",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this list. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one list.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The title of the list. You'll see this in the namespace overview.",
"type": "string",
@ -7273,6 +7403,10 @@
"description": "The user who owns this namespace",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one namespace.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The name of this namespace.",
"type": "string",
@ -7346,6 +7480,10 @@
"description": "The user who owns this namespace",
"$ref": "#/definitions/user.User"
},
"subscription": {
"description": "The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one namespace.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The name of this namespace.",
"type": "string",
@ -7402,6 +7540,30 @@
}
}
},
"models.Subscription": {
"type": "object",
"properties": {
"created": {
"description": "A timestamp when this subscription was created. You cannot change this value.",
"type": "string"
},
"entity": {
"type": "string"
},
"entity_id": {
"description": "The id of the entity to subscribe to.",
"type": "integer"
},
"id": {
"description": "The numeric ID of the subscription",
"type": "integer"
},
"user": {
"description": "The user who made this subscription",
"$ref": "#/definitions/user.User"
}
}
},
"models.Task": {
"type": "object",
"properties": {
@ -7518,6 +7680,10 @@
"description": "When this task starts.",
"type": "string"
},
"subscription": {
"description": "The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.\nWill only returned when retreiving one task.",
"$ref": "#/definitions/models.Subscription"
},
"title": {
"description": "The task text. This is what you'll see in the list.",
"type": "string",

View File

@ -210,6 +210,11 @@ definitions:
start_date:
description: When this task starts.
type: string
subscription:
$ref: '#/definitions/models.Subscription'
description: |-
The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.
Will only returned when retreiving one task.
task_ids:
description: A list of task ids to update
items:
@ -330,6 +335,11 @@ definitions:
owner:
$ref: '#/definitions/user.User'
description: The user who created this list.
subscription:
$ref: '#/definitions/models.Subscription'
description: |-
The subscription status for the user reading this list. You can only read this property, use the subscription endpoints to modify it.
Will only returned when retreiving one list.
title:
description: The title of the list. You'll see this in the namespace overview.
maxLength: 250
@ -395,6 +405,11 @@ definitions:
owner:
$ref: '#/definitions/user.User'
description: The user who owns this namespace
subscription:
$ref: '#/definitions/models.Subscription'
description: |-
The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.
Will only returned when retreiving one namespace.
title:
description: The name of this namespace.
maxLength: 250
@ -449,6 +464,11 @@ definitions:
owner:
$ref: '#/definitions/user.User'
description: The user who owns this namespace
subscription:
$ref: '#/definitions/models.Subscription'
description: |-
The subscription status for the user reading this namespace. You can only read this property, use the subscription endpoints to modify it.
Will only returned when retreiving one namespace.
title:
description: The name of this namespace.
maxLength: 250
@ -490,6 +510,23 @@ definitions:
description: A timestamp when this filter was last updated. You cannot change this value.
type: string
type: object
models.Subscription:
properties:
created:
description: A timestamp when this subscription was created. You cannot change this value.
type: string
entity:
type: string
entity_id:
description: The id of the entity to subscribe to.
type: integer
id:
description: The numeric ID of the subscription
type: integer
user:
$ref: '#/definitions/user.User'
description: The user who made this subscription
type: object
models.Task:
properties:
assignees:
@ -582,6 +619,11 @@ definitions:
start_date:
description: When this task starts.
type: string
subscription:
$ref: '#/definitions/models.Subscription'
description: |-
The subscription status for the user reading this task. You can only read this property, use the subscription endpoints to modify it.
Will only returned when retreiving one task.
title:
description: The task text. This is what you'll see in the list.
maxLength: 250
@ -3660,6 +3702,85 @@ paths:
summary: Get an auth token for a share
tags:
- sharing
/subscriptions/{entity}/{entityID}:
delete:
consumes:
- application/json
description: Unsubscribes the current user to an entity.
parameters:
- description: The entity the user subscribed to. Can be either `namespace`, `list` or `task`.
in: path
name: entity
required: true
type: string
- description: The numeric id of the subscribed entity to.
in: path
name: entityID
required: true
type: string
produces:
- application/json
responses:
"200":
description: The subscription
schema:
$ref: '#/definitions/models.Subscription'
"403":
description: The user does not have access to subscribe to this entity.
schema:
$ref: '#/definitions/web.HTTPError'
"404":
description: The subscription does not exist.
schema:
$ref: '#/definitions/web.HTTPError'
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
security:
- JWTKeyAuth: []
summary: Unsubscribe the current user from an entity.
tags:
- subscriptions
put:
consumes:
- application/json
description: Subscribes the current user to an entity.
parameters:
- description: The entity the user subscribes to. Can be either `namespace`, `list` or `task`.
in: path
name: entity
required: true
type: string
- description: The numeric id of the entity to subscribe to.
in: path
name: entityID
required: true
type: string
produces:
- application/json
responses:
"200":
description: The subscription
schema:
$ref: '#/definitions/models.Subscription'
"403":
description: The user does not have access to subscribe to this entity.
schema:
$ref: '#/definitions/web.HTTPError'
"412":
description: The subscription entity is invalid.
schema:
$ref: '#/definitions/web.HTTPError'
"500":
description: Internal error
schema:
$ref: '#/definitions/models.Message'
security:
- JWTKeyAuth: []
summary: Subscribes the current user to an entity.
tags:
- subscriptions
/tasks/{ID}:
get:
consumes: