From 2c84cec044eb8974a40ef7fbfa9f2c92ecf311af Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 17 Oct 2023 20:29:42 +0200 Subject: [PATCH] docs(webhooks): add swagger docs for all webhook endpoints --- pkg/models/api_tokens.go | 6 +- pkg/models/webhooks.go | 67 ++++++- pkg/routes/api/v1/webhooks.go | 10 ++ pkg/swagger/docs.go | 316 +++++++++++++++++++++++++++++++++- pkg/swagger/swagger.json | 316 +++++++++++++++++++++++++++++++++- pkg/swagger/swagger.yaml | 220 ++++++++++++++++++++++- 6 files changed, 916 insertions(+), 19 deletions(-) diff --git a/pkg/models/api_tokens.go b/pkg/models/api_tokens.go index 637da13cabf..eb4dc2931d1 100644 --- a/pkg/models/api_tokens.go +++ b/pkg/models/api_tokens.go @@ -122,9 +122,9 @@ func HashToken(token, salt string) string { // @Accept json // @Produce json // @Security JWTKeyAuth -// @Param page query int false "The page number for tasks. Used for pagination. If not provided, the first page of results is returned." -// @Param per_page query int false "The maximum number of tasks per bucket per page. This parameter is limited by the configured maximum of items per page." -// @Param s query string false "Search tasks by task text." +// @Param page query int false "The page number, used for pagination. If not provided, the first page of results is returned." +// @Param per_page query int false "The maximum number of tokens per page. This parameter is limited by the configured maximum of items per page." +// @Param s query string false "Search tokens by their title." // @Success 200 {array} models.APIToken "The list of all tokens" // @Failure 500 {object} models.Message "Internal server error" // @Router /tokens [get] diff --git a/pkg/models/webhooks.go b/pkg/models/webhooks.go index a5b9eae3801..9dfcd9e347f 100644 --- a/pkg/models/webhooks.go +++ b/pkg/models/webhooks.go @@ -40,11 +40,16 @@ import ( var webhookClient *http.Client type Webhook struct { - ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"webhook"` - TargetURL string `xorm:"not null" valid:"minstringlength(1)" minLength:"1" json:"target_url"` - Events []string `xorm:"JSON not null" valid:"minstringlength(1)" minLength:"1" json:"events"` - ProjectID int64 `xorm:"bigint not null index" json:"project_id" param:"project"` - Secret string `xorm:"null" json:"secret"` + // The generated ID of this webhook target + ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"webhook"` + // The target URL where the POST request with the webhook payload will be made + TargetURL string `xorm:"not null" valid:"minstringlength(1)" minLength:"1" json:"target_url"` + // The webhook events which should fire this webhook target + Events []string `xorm:"JSON not null" valid:"minstringlength(1)" minLength:"1" json:"events"` + // The project ID of the project this webhook target belongs to + ProjectID int64 `xorm:"bigint not null index" json:"project_id" param:"project"` + // If provided, webhook requests will be signed using HMAC. Check out the docs about how to use this: https://vikunja.io/docs/webhooks/#signing + Secret string `xorm:"null" json:"secret"` // The user who initially created the webhook target. CreatedBy *user.User `xorm:"-" json:"created_by" valid:"-"` @@ -92,6 +97,19 @@ func GetAvailableWebhookEvents() []string { return evts } +// Create creates a webhook target +// @Summary Create a webhook target +// @Description Create a webhook target which recieves POST requests about specified events from a project. +// @tags webhooks +// @Accept json +// @Produce json +// @Security JWTKeyAuth +// @Param id path int true "Project ID" +// @Param webhook body models.Webhook true "The webhook target object with required fields" +// @Success 200 {object} models.Webhook "The created webhook target." +// @Failure 400 {object} web.HTTPError "Invalid webhook object provided." +// @Failure 500 {object} models.Message "Internal error" +// @Router /projects/{id}/webhooks [put] func (w *Webhook) Create(s *xorm.Session, a web.Auth) (err error) { // TODO: check valid webhook events w.CreatedByID = a.GetID() @@ -99,6 +117,19 @@ func (w *Webhook) Create(s *xorm.Session, a web.Auth) (err error) { return } +// ReadAll returns all webhook targets for a project +// @Summary Get all api webhook targets for the specified project +// @Description Get all api webhook targets for the specified project. +// @tags webhooks +// @Accept json +// @Produce json +// @Security JWTKeyAuth +// @Param page query int false "The page number. Used for pagination. If not provided, the first page of results is returned." +// @Param per_page query int false "The maximum number of items per bucket per page. This parameter is limited by the configured maximum of items per page." +// @Param id path int true "Project ID" +// @Success 200 {array} models.Webhook "The list of all webhook targets" +// @Failure 500 {object} models.Message "Internal server error" +// @Router /projects/{id}/webhooks [get] func (w *Webhook) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { p := &Project{ID: w.ProjectID} can, _, err := p.CanRead(s, a) @@ -126,6 +157,19 @@ func (w *Webhook) ReadAll(s *xorm.Session, a web.Auth, search string, page int, return ws, len(ws), total, err } +// Update updates a webhook target +// @Summary Change a webhook target's events. +// @Description Change a webhook target's events. You cannot change other values of a webhook. +// @tags webhooks +// @Accept json +// @Produce json +// @Security JWTKeyAuth +// @Param id path int true "Project ID" +// @Param webhookID path int true "Webhook ID" +// @Success 200 {object} models.Webhook "Updated webhook target" +// @Failure 404 {object} web.HTTPError "The webhok target does not exist" +// @Failure 500 {object} models.Message "Internal error" +// @Router /projects/{id}/webhooks/{webhookID} [post] func (w *Webhook) Update(s *xorm.Session, a web.Auth) (err error) { // TODO validate webhook events _, err = s.Where("id = ?", w.ID). @@ -134,6 +178,19 @@ func (w *Webhook) Update(s *xorm.Session, a web.Auth) (err error) { return } +// Delete deletes a webhook target +// @Summary Deletes an existing webhook target +// @Description Delete any of the project's webhook targets. +// @tags webhooks +// @Accept json +// @Produce json +// @Security JWTKeyAuth +// @Param id path int true "Project ID" +// @Param webhookID path int true "Webhook ID" +// @Success 200 {object} models.Message "Successfully deleted." +// @Failure 404 {object} web.HTTPError "The webhok target does not exist." +// @Failure 500 {object} models.Message "Internal error" +// @Router /projects/{id}/webhooks/{webhookID} [delete] func (w *Webhook) Delete(s *xorm.Session, a web.Auth) (err error) { _, err = s.Where("id = ?", w.ID).Delete(&Webhook{}) return diff --git a/pkg/routes/api/v1/webhooks.go b/pkg/routes/api/v1/webhooks.go index 1f418e3c40d..7c0a435c0b5 100644 --- a/pkg/routes/api/v1/webhooks.go +++ b/pkg/routes/api/v1/webhooks.go @@ -22,6 +22,16 @@ import ( "net/http" ) +// GetAvailableWebhookEvents returns a list of all possible webhook target events +// @Summary Get all possible webhook events +// @Description Get all possible webhook events to use when creating or updating a webhook target. +// @tags webhooks +// @Accept json +// @Produce json +// @Security JWTKeyAuth +// @Success 200 {array} string "The list of all possible webhook events" +// @Failure 500 {object} models.Message "Internal server error" +// @Router /webhooks/events [get] func GetAvailableWebhookEvents(c echo.Context) error { return c.JSON(http.StatusOK, models.GetAvailableWebhookEvents()) } diff --git a/pkg/swagger/docs.go b/pkg/swagger/docs.go index c56d835ad4a..6ca74bb7b8f 100644 --- a/pkg/swagger/docs.go +++ b/pkg/swagger/docs.go @@ -2425,6 +2425,230 @@ const docTemplate = `{ } } }, + "/projects/{id}/webhooks": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Get all api webhook targets for the specified project.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Get all api webhook targets for the specified project", + "parameters": [ + { + "type": "integer", + "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 bucket per page. This parameter is limited by the configured maximum of items per page.", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The list of all webhook targets", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Webhook" + } + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + }, + "put": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Create a webhook target which recieves POST requests about specified events from a project.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Create a webhook target", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "The webhook target object with required fields", + "name": "webhook", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.Webhook" + } + } + ], + "responses": { + "200": { + "description": "The created webhook target.", + "schema": { + "$ref": "#/definitions/models.Webhook" + } + }, + "400": { + "description": "Invalid webhook object provided.", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/projects/{id}/webhooks/{webhookID}": { + "post": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Change a webhook target's events. You cannot change other values of a webhook.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Change a webhook target's events.", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Webhook ID", + "name": "webhookID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Updated webhook target", + "schema": { + "$ref": "#/definitions/models.Webhook" + } + }, + "404": { + "description": "The webhok target does not exist", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + }, + "delete": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Delete any of the project's webhook targets.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Deletes an existing webhook target", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Webhook ID", + "name": "webhookID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Successfully deleted.", + "schema": { + "$ref": "#/definitions/models.Message" + } + }, + "404": { + "description": "The webhok target does not exist.", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/projects/{projectID}/buckets/{bucketID}": { "post": { "security": [ @@ -5427,19 +5651,19 @@ const docTemplate = `{ "parameters": [ { "type": "integer", - "description": "The page number for tasks. Used for pagination. If not provided, the first page of results is returned.", + "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 tasks per bucket per page. This parameter is limited by the configured maximum of items per page.", + "description": "The maximum number of tokens per page. 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.", + "description": "Search tokens by their title.", "name": "s", "in": "query" } @@ -6783,6 +7007,43 @@ const docTemplate = `{ } } }, + "/webhooks/events": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Get all possible webhook events to use when creating or updating a webhook target.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Get all possible webhook events", + "responses": { + "200": { + "description": "The list of all possible webhook events", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/{username}/avatar": { "get": { "description": "Returns the user avatar as image.", @@ -8188,6 +8449,52 @@ const docTemplate = `{ } } }, + "models.Webhook": { + "type": "object", + "properties": { + "created": { + "description": "A timestamp when this webhook target was created. You cannot change this value.", + "type": "string" + }, + "created_by": { + "description": "The user who initially created the webhook target.", + "allOf": [ + { + "$ref": "#/definitions/user.User" + } + ] + }, + "events": { + "description": "The webhook events which should fire this webhook target", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "id": { + "description": "The generated ID of this webhook target", + "type": "integer" + }, + "project_id": { + "description": "The project ID of the project this webhook target belongs to", + "type": "integer" + }, + "secret": { + "description": "If provided, webhook requests will be signed using HMAC. Check out the docs about how to use this: https://vikunja.io/docs/webhooks/#signing", + "type": "string" + }, + "target_url": { + "description": "The target URL where the POST request with the webhook payload will be made", + "type": "string", + "minLength": 1 + }, + "updated": { + "description": "A timestamp when this webhook target was last updated. You cannot change this value.", + "type": "string" + } + } + }, "notifications.DatabaseNotification": { "type": "object", "properties": { @@ -8618,6 +8925,9 @@ const docTemplate = `{ }, "version": { "type": "string" + }, + "webhooks_enabled": { + "type": "boolean" } } }, diff --git a/pkg/swagger/swagger.json b/pkg/swagger/swagger.json index 071f437a0e8..649ca6463e7 100644 --- a/pkg/swagger/swagger.json +++ b/pkg/swagger/swagger.json @@ -2417,6 +2417,230 @@ } } }, + "/projects/{id}/webhooks": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Get all api webhook targets for the specified project.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Get all api webhook targets for the specified project", + "parameters": [ + { + "type": "integer", + "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 bucket per page. This parameter is limited by the configured maximum of items per page.", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The list of all webhook targets", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.Webhook" + } + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + }, + "put": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Create a webhook target which recieves POST requests about specified events from a project.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Create a webhook target", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "The webhook target object with required fields", + "name": "webhook", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.Webhook" + } + } + ], + "responses": { + "200": { + "description": "The created webhook target.", + "schema": { + "$ref": "#/definitions/models.Webhook" + } + }, + "400": { + "description": "Invalid webhook object provided.", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/projects/{id}/webhooks/{webhookID}": { + "post": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Change a webhook target's events. You cannot change other values of a webhook.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Change a webhook target's events.", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Webhook ID", + "name": "webhookID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Updated webhook target", + "schema": { + "$ref": "#/definitions/models.Webhook" + } + }, + "404": { + "description": "The webhok target does not exist", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + }, + "delete": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Delete any of the project's webhook targets.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Deletes an existing webhook target", + "parameters": [ + { + "type": "integer", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Webhook ID", + "name": "webhookID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Successfully deleted.", + "schema": { + "$ref": "#/definitions/models.Message" + } + }, + "404": { + "description": "The webhok target does not exist.", + "schema": { + "$ref": "#/definitions/web.HTTPError" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/projects/{projectID}/buckets/{bucketID}": { "post": { "security": [ @@ -5419,19 +5643,19 @@ "parameters": [ { "type": "integer", - "description": "The page number for tasks. Used for pagination. If not provided, the first page of results is returned.", + "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 tasks per bucket per page. This parameter is limited by the configured maximum of items per page.", + "description": "The maximum number of tokens per page. 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.", + "description": "Search tokens by their title.", "name": "s", "in": "query" } @@ -6775,6 +6999,43 @@ } } }, + "/webhooks/events": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Get all possible webhook events to use when creating or updating a webhook target.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "webhooks" + ], + "summary": "Get all possible webhook events", + "responses": { + "200": { + "description": "The list of all possible webhook events", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/{username}/avatar": { "get": { "description": "Returns the user avatar as image.", @@ -8180,6 +8441,52 @@ } } }, + "models.Webhook": { + "type": "object", + "properties": { + "created": { + "description": "A timestamp when this webhook target was created. You cannot change this value.", + "type": "string" + }, + "created_by": { + "description": "The user who initially created the webhook target.", + "allOf": [ + { + "$ref": "#/definitions/user.User" + } + ] + }, + "events": { + "description": "The webhook events which should fire this webhook target", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "id": { + "description": "The generated ID of this webhook target", + "type": "integer" + }, + "project_id": { + "description": "The project ID of the project this webhook target belongs to", + "type": "integer" + }, + "secret": { + "description": "If provided, webhook requests will be signed using HMAC. Check out the docs about how to use this: https://vikunja.io/docs/webhooks/#signing", + "type": "string" + }, + "target_url": { + "description": "The target URL where the POST request with the webhook payload will be made", + "type": "string", + "minLength": 1 + }, + "updated": { + "description": "A timestamp when this webhook target was last updated. You cannot change this value.", + "type": "string" + } + } + }, "notifications.DatabaseNotification": { "type": "object", "properties": { @@ -8610,6 +8917,9 @@ }, "version": { "type": "string" + }, + "webhooks_enabled": { + "type": "boolean" } } }, diff --git a/pkg/swagger/swagger.yaml b/pkg/swagger/swagger.yaml index f9f78cead7b..26d0d897d80 100644 --- a/pkg/swagger/swagger.yaml +++ b/pkg/swagger/swagger.yaml @@ -1040,6 +1040,42 @@ definitions: minLength: 1 type: string type: object + models.Webhook: + properties: + created: + description: A timestamp when this webhook target was created. You cannot + change this value. + type: string + created_by: + allOf: + - $ref: '#/definitions/user.User' + description: The user who initially created the webhook target. + events: + description: The webhook events which should fire this webhook target + items: + minLength: 1 + type: string + type: array + id: + description: The generated ID of this webhook target + type: integer + project_id: + description: The project ID of the project this webhook target belongs to + type: integer + secret: + description: 'If provided, webhook requests will be signed using HMAC. Check + out the docs about how to use this: https://vikunja.io/docs/webhooks/#signing' + type: string + target_url: + description: The target URL where the POST request with the webhook payload + will be made + minLength: 1 + type: string + updated: + description: A timestamp when this webhook target was last updated. You cannot + change this value. + type: string + type: object notifications.DatabaseNotification: properties: created: @@ -1352,6 +1388,8 @@ definitions: type: boolean version: type: string + webhooks_enabled: + type: boolean type: object web.HTTPError: properties: @@ -3004,6 +3042,154 @@ paths: summary: Add a user to a project tags: - sharing + /projects/{id}/webhooks: + get: + consumes: + - application/json + description: Get all api webhook targets for the specified project. + parameters: + - 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 bucket per page. This parameter + is limited by the configured maximum of items per page. + in: query + name: per_page + type: integer + - description: Project ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: The list of all webhook targets + schema: + items: + $ref: '#/definitions/models.Webhook' + type: array + "500": + description: Internal server error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Get all api webhook targets for the specified project + tags: + - webhooks + put: + consumes: + - application/json + description: Create a webhook target which recieves POST requests about specified + events from a project. + parameters: + - description: Project ID + in: path + name: id + required: true + type: integer + - description: The webhook target object with required fields + in: body + name: webhook + required: true + schema: + $ref: '#/definitions/models.Webhook' + produces: + - application/json + responses: + "200": + description: The created webhook target. + schema: + $ref: '#/definitions/models.Webhook' + "400": + description: Invalid webhook object provided. + schema: + $ref: '#/definitions/web.HTTPError' + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Create a webhook target + tags: + - webhooks + /projects/{id}/webhooks/{webhookID}: + delete: + consumes: + - application/json + description: Delete any of the project's webhook targets. + parameters: + - description: Project ID + in: path + name: id + required: true + type: integer + - description: Webhook ID + in: path + name: webhookID + required: true + type: integer + produces: + - application/json + responses: + "200": + description: Successfully deleted. + schema: + $ref: '#/definitions/models.Message' + "404": + description: The webhok target does not exist. + schema: + $ref: '#/definitions/web.HTTPError' + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Deletes an existing webhook target + tags: + - webhooks + post: + consumes: + - application/json + description: Change a webhook target's events. You cannot change other values + of a webhook. + parameters: + - description: Project ID + in: path + name: id + required: true + type: integer + - description: Webhook ID + in: path + name: webhookID + required: true + type: integer + produces: + - application/json + responses: + "200": + description: Updated webhook target + schema: + $ref: '#/definitions/models.Webhook' + "404": + description: The webhok target does not exist + schema: + $ref: '#/definitions/web.HTTPError' + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Change a webhook target's events. + tags: + - webhooks /projects/{project}/shares: get: consumes: @@ -5018,17 +5204,17 @@ paths: - application/json description: Returns all api tokens the current user has created. parameters: - - description: The page number for tasks. Used for pagination. If not provided, - the first page of results is returned. + - 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 tasks per bucket per page. This parameter - is limited by the configured maximum of items per page. + - description: The maximum number of tokens per page. 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. + - description: Search tokens by their title. in: query name: s type: string @@ -5901,6 +6087,30 @@ paths: summary: Get users tags: - user + /webhooks/events: + get: + consumes: + - application/json + description: Get all possible webhook events to use when creating or updating + a webhook target. + produces: + - application/json + responses: + "200": + description: The list of all possible webhook events + schema: + items: + type: string + type: array + "500": + description: Internal server error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Get all possible webhook events + tags: + - webhooks securityDefinitions: BasicAuth: type: basic