From 36eb580c8a4be2a5699402307726bff0df6c4760 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 25 Dec 2018 21:45:26 +0100 Subject: [PATCH] Updated swagger docs --- docs/docs.go | 209 +++++++++++++++++++++----------- docs/swagger/swagger.json | 207 +++++++++++++++++++++---------- docs/swagger/swagger.yaml | 134 +++++++++++++------- pkg/models/list_task_readall.go | 23 +++- 4 files changed, 394 insertions(+), 179 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index f0d96f5b..7bdde0a7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2018-12-22 16:18:46.44967995 +0100 CET m=+0.133725013 +// 2018-12-25 21:44:18.815676554 +0100 CET m=+0.161606284 package docs @@ -91,7 +91,7 @@ var doc = `{ "ApiKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -99,13 +99,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 @@ -113,14 +113,14 @@ var doc = `{ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$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": { "type": "object", "$ref": "#/definitions/code.vikunja.io.web.HTTPError" @@ -1949,7 +1949,7 @@ var doc = `{ } } }, - "/tasks": { + "/tasks/all": { "get": { "security": [ { @@ -2001,6 +2001,138 @@ var doc = `{ } } }, + "/tasks/all/{sortby}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted", + "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 tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/tasks/all/{sortby}/{startdate}/{enddate}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted and within a date range", + "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 tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The start date parameter. Expects a unix timestamp.", + "name": "startdate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The end date parameter. Expects a unix timestamp.", + "name": "enddate", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/caldav": { "get": { "security": [ @@ -2155,65 +2287,6 @@ var doc = `{ } } }, - "/tasks/{sortby}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Returns all tasks on any list the user has access to.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "task" - ], - "summary": "Get tasks sorted", - "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 tasks by task text.", - "name": "s", - "in": "query" - }, - { - "type": "string", - "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", - "name": "sortby", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "The tasks", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/models.List" - } - } - }, - "500": { - "description": "Internal error", - "schema": { - "type": "object", - "$ref": "#/definitions/models.Message" - } - } - } - } - }, "/teams": { "get": { "security": [ diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index dfd88594..f840769a 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -78,7 +78,7 @@ "ApiKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -86,13 +86,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 @@ -100,14 +100,14 @@ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$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": { "type": "object", "$ref": "#/definitions/code.vikunja.io/web.HTTPError" @@ -1936,7 +1936,7 @@ } } }, - "/tasks": { + "/tasks/all": { "get": { "security": [ { @@ -1988,6 +1988,138 @@ } } }, + "/tasks/all/{sortby}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted", + "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 tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/tasks/all/{sortby}/{startdate}/{enddate}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted and within a date range", + "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 tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The start date parameter. Expects a unix timestamp.", + "name": "startdate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The end date parameter. Expects a unix timestamp.", + "name": "enddate", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/caldav": { "get": { "security": [ @@ -2142,65 +2274,6 @@ } } }, - "/tasks/{sortby}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Returns all tasks on any list the user has access to.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "task" - ], - "summary": "Get tasks sorted", - "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 tasks by task text.", - "name": "s", - "in": "query" - }, - { - "type": "string", - "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", - "name": "sortby", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "The tasks", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/models.List" - } - } - }, - "500": { - "description": "Internal error", - "schema": { - "type": "object", - "$ref": "#/definitions/models.Message" - } - } - } - } - }, "/teams": { "get": { "security": [ diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 97a6210c..a4fe31ba 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -396,9 +396,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 @@ -407,12 +407,12 @@ paths: - application/json responses: "200": - description: The team + description: The list schema: - $ref: '#/definitions/models.Team' + $ref: '#/definitions/models.List' type: object "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' type: object @@ -423,9 +423,9 @@ paths: type: object security: - ApiKeyAuth: [] - summary: Gets one team + summary: Gets one list tags: - - team + - list post: consumes: - application/json @@ -1616,40 +1616,6 @@ paths: summary: Register tags: - user - /tasks: - get: - consumes: - - application/json - description: Returns all tasks on any list the user has 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 tasks by task text. - in: query - name: s - type: string - produces: - - application/json - responses: - "200": - description: The tasks - schema: - items: - $ref: '#/definitions/models.List' - type: array - "500": - description: Internal error - schema: - $ref: '#/definitions/models.Message' - type: object - security: - - ApiKeyAuth: [] - summary: Get tasks - tags: - - task /tasks/{id}: delete: description: Deletes a task from a list. This does not mean "mark it done". @@ -1732,7 +1698,41 @@ paths: summary: Update a task tags: - task - /tasks/{sortby}: + /tasks/all: + get: + consumes: + - application/json + description: Returns all tasks on any list the user has 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 tasks by task text. + in: query + name: s + type: string + produces: + - application/json + responses: + "200": + description: The tasks + schema: + items: + $ref: '#/definitions/models.List' + type: array + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + type: object + security: + - ApiKeyAuth: [] + summary: Get tasks + tags: + - task + /tasks/all/{sortby}: get: consumes: - application/json @@ -1772,6 +1772,56 @@ paths: summary: Get tasks sorted tags: - task + /tasks/all/{sortby}/{startdate}/{enddate}: + get: + consumes: + - application/json + description: Returns all tasks on any list the user has 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 tasks by task text. + in: query + name: s + type: string + - description: The sorting parameter. Possible values to sort by are priority, + prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc. + in: path + name: sortby + required: true + type: string + - description: The start date parameter. Expects a unix timestamp. + in: path + name: startdate + required: true + type: string + - description: The end date parameter. Expects a unix timestamp. + in: path + name: enddate + required: true + type: string + produces: + - application/json + responses: + "200": + description: The tasks + schema: + items: + $ref: '#/definitions/models.List' + type: array + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + type: object + security: + - ApiKeyAuth: [] + summary: Get tasks sorted and within a date range + tags: + - task /tasks/caldav: get: description: Returns a calDAV-parsable format with all tasks as calendar events. diff --git a/pkg/models/list_task_readall.go b/pkg/models/list_task_readall.go index e452a3f4..19fe6884 100644 --- a/pkg/models/list_task_readall.go +++ b/pkg/models/list_task_readall.go @@ -35,11 +35,30 @@ const ( // @Security ApiKeyAuth // @Success 200 {array} models.List "The tasks" // @Failure 500 {object} models.Message "Internal error" -// @Router /tasks/{sortby} [get] +// @Router /tasks/all/{sortby} [get] func dummy() { // Dummy function for swaggo to pick up the docs comment } +// ReadAllWithPriorityAndDateRange gets all tasks for a user, sorted +// @Summary Get tasks sorted and within a date range +// @Description Returns all tasks on any list the user has access to. +// @tags task +// @Accept json +// @Produce json +// @Param p query int false "The page number. Used for pagination. If not provided, the first page of results is returned." +// @Param s query string false "Search tasks by task text." +// @Param sortby path string true "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc." +// @Param startdate path string true "The start date parameter. Expects a unix timestamp." +// @Param enddate path string true "The end date parameter. Expects a unix timestamp." +// @Security ApiKeyAuth +// @Success 200 {array} models.List "The tasks" +// @Failure 500 {object} models.Message "Internal error" +// @Router /tasks/all/{sortby}/{startdate}/{enddate} [get] +func dummy2() { + // Dummy function for swaggo to pick up the docs comment +} + // ReadAll gets all tasks for a user // @Summary Get tasks // @Description Returns all tasks on any list the user has access to. @@ -51,7 +70,7 @@ func dummy() { // @Security ApiKeyAuth // @Success 200 {array} models.List "The tasks" // @Failure 500 {object} models.Message "Internal error" -// @Router /tasks [get] +// @Router /tasks/all [get] func (lt *ListTask) ReadAll(search string, a web.Auth, page int) (interface{}, error) { u, err := getUserWithError(a) if err != nil {