From 7595b16e296a20bc8fd9aed4a6b45a50ada50de8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 7 Dec 2019 22:52:38 +0100 Subject: [PATCH] Swagger docs --- pkg/swagger/docs.go | 143 +++++++++++++++++++++++++++++++++------ pkg/swagger/swagger.json | 141 ++++++++++++++++++++++++++++++++------ pkg/swagger/swagger.yaml | 114 +++++++++++++++++++++++++------ 3 files changed, 336 insertions(+), 62 deletions(-) diff --git a/pkg/swagger/docs.go b/pkg/swagger/docs.go index 2b852088e..6db5c7fda 100644 --- a/pkg/swagger/docs.go +++ b/pkg/swagger/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2019-12-07 21:20:14.32998445 +0100 CET m=+0.187124480 +// 2019-12-07 22:51:46.967330871 +0100 CET m=+0.166223609 package swagger @@ -407,7 +407,7 @@ var doc = `{ "JWTKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -415,13 +415,13 @@ var doc = `{ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -429,13 +429,13 @@ var doc = `{ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "$ref": "#/definitions/code.vikunja.io.web.HTTPError" } @@ -2649,7 +2649,7 @@ var doc = `{ "JWTKeyAuth": [] } ], - "description": "Returns one task by its ID", + "description": "Returns all tasks on any list the user has access to.", "consumes": [ "application/json" ], @@ -2659,27 +2659,53 @@ var doc = `{ "tags": [ "task" ], - "summary": "Get one task", + "summary": "Get tasks", "parameters": [ { "type": "integer", - "description": "The task ID", - "name": "ID", - "in": "path", - "required": true + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.", + "name": "per_page", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, duedate, duedatedesc, duedateasc.", + "name": "sort", + "in": "query" + }, + { + "type": "integer", + "description": "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time.", + "name": "startdate", + "in": "query" + }, + { + "type": "integer", + "description": "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time.", + "name": "enddate", + "in": "query" } ], "responses": { "200": { - "description": "The task", + "description": "The tasks", "schema": { - "$ref": "#/definitions/models.Task" - } - }, - "404": { - "description": "Task not found", - "schema": { - "$ref": "#/definitions/models.Message" + "type": "array", + "items": { + "$ref": "#/definitions/models.Task" + } } }, "500": { @@ -2749,6 +2775,55 @@ var doc = `{ } } }, + "/tasks/{ID}": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Returns one task by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get one task", + "parameters": [ + { + "type": "integer", + "description": "The task ID", + "name": "ID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The task", + "schema": { + "$ref": "#/definitions/models.Task" + } + }, + "404": { + "description": "Task not found", + "schema": { + "$ref": "#/definitions/models.Message" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/{id}": { "post": { "security": [ @@ -4452,6 +4527,14 @@ var doc = `{ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", @@ -4871,6 +4954,14 @@ var doc = `{ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", @@ -4979,6 +5070,14 @@ var doc = `{ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", diff --git a/pkg/swagger/swagger.json b/pkg/swagger/swagger.json index 48f9cbe98..2164dff7c 100644 --- a/pkg/swagger/swagger.json +++ b/pkg/swagger/swagger.json @@ -389,7 +389,7 @@ "JWTKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -397,13 +397,13 @@ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -411,13 +411,13 @@ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "$ref": "#/definitions/code.vikunja.io/web.HTTPError" } @@ -2631,7 +2631,7 @@ "JWTKeyAuth": [] } ], - "description": "Returns one task by its ID", + "description": "Returns all tasks on any list the user has access to.", "consumes": [ "application/json" ], @@ -2641,27 +2641,53 @@ "tags": [ "task" ], - "summary": "Get one task", + "summary": "Get tasks", "parameters": [ { "type": "integer", - "description": "The task ID", - "name": "ID", - "in": "path", - "required": true + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.", + "name": "per_page", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, duedate, duedatedesc, duedateasc.", + "name": "sort", + "in": "query" + }, + { + "type": "integer", + "description": "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time.", + "name": "startdate", + "in": "query" + }, + { + "type": "integer", + "description": "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time.", + "name": "enddate", + "in": "query" } ], "responses": { "200": { - "description": "The task", + "description": "The tasks", "schema": { - "$ref": "#/definitions/models.Task" - } - }, - "404": { - "description": "Task not found", - "schema": { - "$ref": "#/definitions/models.Message" + "type": "array", + "items": { + "$ref": "#/definitions/models.Task" + } } }, "500": { @@ -2731,6 +2757,55 @@ } } }, + "/tasks/{ID}": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Returns one task by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get one task", + "parameters": [ + { + "type": "integer", + "description": "The task ID", + "name": "ID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The task", + "schema": { + "$ref": "#/definitions/models.Task" + } + }, + "404": { + "description": "Task not found", + "schema": { + "$ref": "#/definitions/models.Message" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/{id}": { "post": { "security": [ @@ -4433,6 +4508,14 @@ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", @@ -4852,6 +4935,14 @@ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", @@ -4960,6 +5051,14 @@ "description": "The unique, numeric id of this task.", "type": "integer" }, + "identifier": { + "description": "The task identifier, based on the list identifier and the task's index", + "type": "string" + }, + "index": { + "description": "The task index, calculated per list", + "type": "integer" + }, "labels": { "description": "An array of labels which are associated with this task.", "type": "array", diff --git a/pkg/swagger/swagger.yaml b/pkg/swagger/swagger.yaml index a0c92ccce..e4a4a940f 100644 --- a/pkg/swagger/swagger.yaml +++ b/pkg/swagger/swagger.yaml @@ -84,6 +84,13 @@ definitions: id: description: The unique, numeric id of this task. type: integer + identifier: + description: The task identifier, based on the list identifier and the task's + index + type: string + index: + description: The task index, calculated per list + type: integer labels: description: An array of labels which are associated with this task. items: @@ -418,6 +425,13 @@ definitions: id: description: The unique, numeric id of this task. type: integer + identifier: + description: The task identifier, based on the list identifier and the + task's index + type: string + index: + description: The task index, calculated per list + type: integer labels: description: An array of labels which are associated with this task. items: @@ -505,6 +519,13 @@ definitions: id: description: The unique, numeric id of this task. type: integer + identifier: + description: The task identifier, based on the list identifier and the task's + index + type: string + index: + description: The task index, calculated per list + type: integer labels: description: An array of labels which are associated with this task. items: @@ -1138,9 +1159,9 @@ paths: get: consumes: - application/json - description: Returns a team by its ID. + description: Returns a list by its ID. parameters: - - description: Team ID + - description: List ID in: path name: id required: true @@ -1149,11 +1170,11 @@ paths: - application/json responses: "200": - description: The team + description: The list schema: - $ref: '#/definitions/models.Team' + $ref: '#/definitions/models.List' "403": - description: The user does not have access to the team + description: The user does not have access to the list schema: $ref: '#/definitions/code.vikunja.io/web.HTTPError' "500": @@ -1162,9 +1183,9 @@ paths: $ref: '#/definitions/models.Message' security: - JWTKeyAuth: [] - summary: Gets one team + summary: Gets one list tags: - - team + - list post: consumes: - application/json @@ -2592,6 +2613,37 @@ paths: summary: Get an auth token for a share tags: - sharing + /tasks/{ID}: + get: + consumes: + - application/json + description: Returns one task by its ID + parameters: + - description: The task ID + in: path + name: ID + required: true + type: integer + produces: + - application/json + responses: + "200": + description: The task + schema: + $ref: '#/definitions/models.Task' + "404": + description: Task not found + schema: + $ref: '#/definitions/models.Message' + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Get one task + tags: + - task /tasks/{id}: delete: description: Deletes a task from a list. This does not mean "mark it done". @@ -3246,31 +3298,55 @@ paths: get: consumes: - application/json - description: Returns one task by its ID + description: Returns all tasks on any list the user has access to. parameters: - - description: The task ID - in: path - name: ID - required: true + - description: The page number. Used for pagination. If not provided, the first + page of results is returned. + in: query + name: page + type: integer + - description: The maximum number of items per page. Note this parameter is + limited by the configured maximum of items per page. + in: query + name: per_page + type: integer + - description: Search tasks by task text. + in: query + name: s + type: string + - description: The sorting parameter. Possible values to sort by are priority, + prioritydesc, priorityasc, duedate, duedatedesc, duedateasc. + in: query + name: sort + type: string + - description: The start date parameter to filter by. Expects a unix timestamp. + If no end date, but a start date is specified, the end date is set to the + current time. + in: query + name: startdate + type: integer + - description: The end date parameter to filter by. Expects a unix timestamp. + If no start date, but an end date is specified, the start date is set to + the current time. + in: query + name: enddate type: integer produces: - application/json responses: "200": - description: The task + description: The tasks schema: - $ref: '#/definitions/models.Task' - "404": - description: Task not found - schema: - $ref: '#/definitions/models.Message' + items: + $ref: '#/definitions/models.Task' + type: array "500": description: Internal error schema: $ref: '#/definitions/models.Message' security: - JWTKeyAuth: [] - summary: Get one task + summary: Get tasks tags: - task /tasks/bulk: