Updated swaggerdocs

This commit is contained in:
kolaente 2018-09-17 08:22:31 +02:00
parent 42bd69321a
commit 8ca8803404
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 659 additions and 161 deletions

View File

@ -191,7 +191,7 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "gets all teams which have access to the list",
"operationId": "getTeamsByList",
@ -224,14 +224,14 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "adds a team to a list",
"operationId": "addTeamToList",
"parameters": [
{
"type": "string",
"description": "ID of the list to show",
"description": "ID of the list to use",
"name": "listID",
"in": "path",
"required": true
@ -266,14 +266,14 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "removes a team from a list",
"operationId": "deleteTeamFromList",
"parameters": [
{
"type": "string",
"description": "ID of the list",
"description": "ID of the list to use",
"name": "listID",
"in": "path",
"required": true
@ -299,6 +299,123 @@
}
}
},
"/lists/{listID}/users": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "gets all users which have access to the list",
"operationId": "getUsersByList",
"parameters": [
{
"type": "string",
"description": "ID of the list to show",
"name": "listID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/User"
},
"400": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "adds a user to a list",
"operationId": "addUserToList",
"parameters": [
{
"type": "string",
"description": "ID of the list to use",
"name": "listID",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/UserList"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/UserList"
},
"400": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
}
},
"/lists/{listID}/users/{userID}": {
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "removes a user from a list",
"operationId": "deleteUserFromList",
"parameters": [
{
"type": "string",
"description": "ID of the list to use",
"name": "listID",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ID of the user to remove",
"name": "userID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Message"
},
"400": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
}
},
"/login": {
"post": {
"consumes": [
@ -598,7 +715,7 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "gets all teams which have access to that namespace",
"operationId": "getNamespaceTeams",
@ -631,14 +748,14 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "Gives a team access to a namespace",
"operationId": "addTeamToNamespace",
"operationId": "giveTeamAccessToNamespace",
"parameters": [
{
"type": "string",
"description": "ID of the namespace that list should belong to",
"description": "ID of the namespace to use",
"name": "namespaceID",
"in": "path",
"required": true
@ -677,14 +794,14 @@
"application/json"
],
"tags": [
"teams"
"sharing"
],
"summary": "Removes a team from a namespace",
"operationId": "removeTeamFromNamespace",
"parameters": [
{
"type": "string",
"description": "ID of the namespace",
"description": "ID of the namespace to use",
"name": "namespaceID",
"in": "path",
"required": true
@ -713,6 +830,130 @@
}
}
},
"/namespaces/{namespaceID}/users": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "gets all users which have access to that namespace",
"operationId": "getNamespaceUsers",
"parameters": [
{
"type": "string",
"description": "ID of the namespace to show",
"name": "namespaceID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/User"
},
"400": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "Gives a user access to a namespace",
"operationId": "giveUserAccessToNamespace",
"parameters": [
{
"type": "string",
"description": "ID of the namespace to use",
"name": "namespaceID",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserNamespace"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/UserNamespace"
},
"400": {
"$ref": "#/responses/Message"
},
"403": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
}
},
"/namespaces/{namespaceID}/users/{userID}": {
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sharing"
],
"summary": "Removes a user from a namespace",
"operationId": "removeUserFromNamespace",
"parameters": [
{
"type": "string",
"description": "ID of the namespace to use",
"name": "namespaceID",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ID of the user you want to remove",
"name": "userID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Message"
},
"400": {
"$ref": "#/responses/Message"
},
"403": {
"$ref": "#/responses/Message"
},
"500": {
"$ref": "#/responses/Message"
}
}
}
},
"/register": {
"post": {
"consumes": [
@ -1216,6 +1457,41 @@
},
"x-go-package": "code.vikunja.io/api/models"
},
"ListUser": {
"description": "ListUser represents a list \u003c-\u003e user relation",
"type": "object",
"properties": {
"created": {
"type": "integer",
"format": "int64",
"x-go-name": "Created"
},
"id": {
"type": "integer",
"format": "int64",
"x-go-name": "ID"
},
"list_id": {
"type": "integer",
"format": "int64",
"x-go-name": "ListID"
},
"right": {
"$ref": "#/definitions/UserRight"
},
"updated": {
"type": "integer",
"format": "int64",
"x-go-name": "Updated"
},
"user_id": {
"type": "integer",
"format": "int64",
"x-go-name": "UserID"
}
},
"x-go-package": "code.vikunja.io/api/models"
},
"Message": {
"description": "Message is a standard message",
"type": "object",
@ -1260,6 +1536,41 @@
},
"x-go-package": "code.vikunja.io/api/models"
},
"NamespaceUser": {
"description": "NamespaceUser represents a namespace \u003c-\u003e user relation",
"type": "object",
"properties": {
"created": {
"type": "integer",
"format": "int64",
"x-go-name": "Created"
},
"id": {
"type": "integer",
"format": "int64",
"x-go-name": "ID"
},
"namespace_id": {
"type": "integer",
"format": "int64",
"x-go-name": "NamespaceID"
},
"right": {
"$ref": "#/definitions/UserRight"
},
"updated": {
"type": "integer",
"format": "int64",
"x-go-name": "Updated"
},
"user_id": {
"type": "integer",
"format": "int64",
"x-go-name": "UserID"
}
},
"x-go-package": "code.vikunja.io/api/models"
},
"Team": {
"description": "Team holds a team object",
"type": "object",
@ -1470,6 +1781,12 @@
}
},
"x-go-package": "code.vikunja.io/api/models"
},
"UserRight": {
"description": "UserRight defines the rights users can have for lists/namespaces",
"type": "integer",
"format": "int64",
"x-go-package": "code.vikunja.io/api/models"
}
},
"responses": {
@ -1543,10 +1860,22 @@
"$ref": "#/definitions/User"
}
},
"UserList": {
"description": "UserList",
"schema": {
"$ref": "#/definitions/ListUser"
}
},
"UserNamespace": {
"description": "UserNamespace",
"schema": {
"$ref": "#/definitions/NamespaceUser"
}
},
"parameterBodies": {
"description": "parameterBodies",
"schema": {
"$ref": "#/definitions/TeamNamespace"
"$ref": "#/definitions/NamespaceUser"
}
}
}

View File

@ -34,4 +34,10 @@ type swaggerParameterBodies struct {
// in:body
TeamNamespace models.TeamNamespace
// in:body
ListUser models.ListUser
// in:body
NamespaceUser models.NamespaceUser
}

View File

@ -93,3 +93,17 @@ type swaggerResponseTeamNamespace struct {
// in:body
Body models.TeamNamespace `json:"body"`
}
// UserList
// swagger:response UserList
type swaggerResponseUserList struct {
// in:body
Body models.ListUser `json:"body"`
}
// UserNamespace
// swagger:response UserNamespace
type swaggerResponseUserNamespace struct {
// in:body
Body models.NamespaceUser `json:"body"`
}

View File

@ -149,62 +149,6 @@ package v1
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /namespaces/{namespaceID}/teams teams addTeamToNamespace
// ---
// summary: Gives a team access to a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace that list should belong to
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/TeamNamespace"
// responses:
// "200":
// "$ref": "#/responses/TeamNamespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /namespaces/{namespaceID}/teams/{teamID} teams removeTeamFromNamespace
// ---
// summary: Removes a team from a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace
// type: string
// required: true
// - name: teamID
// in: path
// description: ID of the team you want to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation POST /lists/{listID} lists upadteList
// ---
// summary: Updates a list
@ -361,27 +305,6 @@ package v1
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /namespaces/{namespaceID}/teams teams getNamespaceTeams
// ---
// summary: gets all teams which have access to that namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Team"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /namespaces namespaces getNamespaces
// ---
// summary: Get all namespaces the currently logged in user has at least read access
@ -395,78 +318,6 @@ package v1
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /lists/{listID}/teams teams getTeamsByList
// ---
// summary: gets all teams which have access to the list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Team"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /lists/{listID}/teams teams addTeamToList
// ---
// summary: adds a team to a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/TeamList"
// responses:
// "200":
// "$ref": "#/responses/TeamList"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /lists/{listID}/teams/{teamID} teams deleteTeamFromList
// ---
// summary: removes a team from a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list
// type: string
// required: true
// - name: teamID
// in: path
// description: ID of the team to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /teams teams getTeams
// ---
// summary: gets all teams the current user is part of
@ -632,3 +483,301 @@ package v1
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /namespaces/{namespaceID}/teams sharing getNamespaceTeams
// ---
// summary: gets all teams which have access to that namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Team"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /lists/{listID}/teams sharing getTeamsByList
// ---
// summary: gets all teams which have access to the list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Team"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /lists/{listID}/teams sharing addTeamToList
// ---
// summary: adds a team to a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/TeamList"
// responses:
// "200":
// "$ref": "#/responses/TeamList"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /lists/{listID}/teams/{teamID} sharing deleteTeamFromList
// ---
// summary: removes a team from a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: teamID
// in: path
// description: ID of the team to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /namespaces/{namespaceID}/teams sharing giveTeamAccessToNamespace
// ---
// summary: Gives a team access to a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to use
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/TeamNamespace"
// responses:
// "200":
// "$ref": "#/responses/TeamNamespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /namespaces/{namespaceID}/teams/{teamID} sharing removeTeamFromNamespace
// ---
// summary: Removes a team from a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to use
// type: string
// required: true
// - name: teamID
// in: path
// description: ID of the team you want to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /lists/{listID}/users sharing getUsersByList
// ---
// summary: gets all users which have access to the list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/User"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /lists/{listID}/users sharing addUserToList
// ---
// summary: adds a user to a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/UserList"
// responses:
// "200":
// "$ref": "#/responses/UserList"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /lists/{listID}/users/{userID} sharing deleteUserFromList
// ---
// summary: removes a user from a list
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: listID
// in: path
// description: ID of the list to use
// type: string
// required: true
// - name: userID
// in: path
// description: ID of the user to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation GET /namespaces/{namespaceID}/users sharing getNamespaceUsers
// ---
// summary: gets all users which have access to that namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to show
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/User"
// "400":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation PUT /namespaces/{namespaceID}/users sharing giveUserAccessToNamespace
// ---
// summary: Gives a user access to a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to use
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/UserNamespace"
// responses:
// "200":
// "$ref": "#/responses/UserNamespace"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"
// swagger:operation DELETE /namespaces/{namespaceID}/users/{userID} sharing removeUserFromNamespace
// ---
// summary: Removes a user from a namespace
// consumes:
// - application/json
// produces:
// - application/json
// parameters:
// - name: namespaceID
// in: path
// description: ID of the namespace to use
// type: string
// required: true
// - name: userID
// in: path
// description: ID of the user you want to remove
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/Message"
// "400":
// "$ref": "#/responses/Message"
// "403":
// "$ref": "#/responses/Message"
// "500":
// "$ref": "#/responses/Message"