Adding in all endpoints/open API definitions, need to flesh everything out.

This commit is contained in:
mike12345567 2022-02-21 19:04:13 +00:00
parent e1352ffbd2
commit d0f18d109e
11 changed files with 720 additions and 77 deletions

View File

@ -43,6 +43,33 @@
"schema": { "schema": {
"type": "string" "type": "string"
} }
},
"appIdUrl": {
"in": "path",
"name": "appId",
"required": true,
"description": "The ID of the app which this request is targeting.",
"schema": {
"type": "string"
}
},
"queryId": {
"in": "path",
"name": "queryId",
"required": true,
"description": "The ID of the query which this request is targeting.",
"schema": {
"type": "string"
}
},
"userId": {
"in": "path",
"name": "userId",
"required": true,
"description": "The ID of the user which this request is targeting.",
"schema": {
"type": "string"
}
} }
}, },
"examples": { "examples": {
@ -366,6 +393,18 @@
] ]
} }
} }
},
"query": {
"type": "object",
"properties": {}
},
"user": {
"type": "object",
"properties": {}
},
"application": {
"type": "object",
"properties": {}
} }
} }
}, },
@ -375,12 +414,133 @@
} }
], ],
"paths": { "paths": {
"/applications/search": {
"post": {
"summary": "Search for an application based on its app name.",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the applications that were found based on the search parameters.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/application"
}
}
}
}
}
}
}
},
"/applications": {
"post": {
"summary": "Create a new application.",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the created application.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/applications/{appId}": {
"put": {
"summary": "Update an existing application by its ID.",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appIdUrl"
}
],
"responses": {
"200": {
"description": "Returns the updated application.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"delete": {
"summary": "Delete an existing application by its ID.",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appIdUrl"
}
],
"responses": {
"200": {
"description": "Returns the deleted application.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/queries/search": { "/queries/search": {
"post": { "post": {
"summary": "Search for a query based on its name.", "summary": "Search for a query based on its name.",
"tags": [ "tags": [
"queries" "queries"
] ],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the queries found based on the search parameters.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/query"
}
}
}
}
}
}
} }
}, },
"/queries/{queryId}": { "/queries/{queryId}": {
@ -388,7 +548,30 @@
"summary": "Execute a query and retrieve its response.", "summary": "Execute a query and retrieve its response.",
"tags": [ "tags": [
"queries" "queries"
] ],
"parameters": [
{
"$ref": "#/components/parameters/queryId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the result of the query execution.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
} }
}, },
"/tables/{tableId}/rows/search": { "/tables/{tableId}/rows/search": {
@ -866,37 +1049,6 @@
} }
}, },
"/tables/{tableId}": { "/tables/{tableId}": {
"get": {
"summary": "Get a single table by its ID, internal and external within an app.",
"tags": [
"tables"
],
"parameters": [
{
"$ref": "#/components/parameters/tableId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the table that was found.",
"content": {
"application/json": {
"schema": {
"type": "object"
},
"examples": {
"table": {
"$ref": "#/components/examples/row"
}
}
}
}
}
}
},
"delete": { "delete": {
"summary": "Delete a single table and all of its data.", "summary": "Delete a single table and all of its data.",
"tags": [ "tags": [
@ -928,6 +1080,113 @@
} }
} }
} }
},
"/users/search": {
"post": {
"summary": "Search for a user based on their email/username.",
"tags": [
"users"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the found users based on search parameters.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/user"
}
}
}
}
}
}
}
},
"/users": {
"post": {
"summary": "Create a new user in the Budibase portal.",
"tags": [
"users"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the created user.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/users/{userId}": {
"put": {
"summary": "Update an existing user by their ID.",
"tags": [
"users"
],
"parameters": [
{
"$ref": "#/components/parameters/userId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the updated user.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"delete": {
"summary": "Delete an existing user by their ID.",
"tags": [
"users"
],
"parameters": [
{
"$ref": "#/components/parameters/userId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the deleted user.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
} }
}, },
"tags": [] "tags": []

View File

@ -31,6 +31,27 @@ components:
description: The ID of the app which this request is targeting. description: The ID of the app which this request is targeting.
schema: schema:
type: string type: string
appIdUrl:
in: path
name: appId
required: true
description: The ID of the app which this request is targeting.
schema:
type: string
queryId:
in: path
name: queryId
required: true
description: The ID of the query which this request is targeting.
schema:
type: string
userId:
in: path
name: userId
required: true
description: The ID of the user which this request is targeting.
schema:
type: string
examples: examples:
table: table:
value: value:
@ -267,19 +288,109 @@ components:
autocolumn: autocolumn:
type: boolean type: boolean
description: Defines whether the column is automatically generated. description: Defines whether the column is automatically generated.
query:
type: object
properties: {}
user:
type: object
properties: {}
application:
type: object
properties: {}
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
paths: paths:
/applications/search:
post:
summary: Search for an application based on its app name.
tags:
- applications
parameters:
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the applications that were found based on the search
parameters.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/application"
/applications:
post:
summary: Create a new application.
tags:
- applications
parameters:
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the created application.
content:
application/json:
schema:
type: object
"/applications/{appId}":
put:
summary: Update an existing application by its ID.
tags:
- applications
parameters:
- $ref: "#/components/parameters/appIdUrl"
responses:
"200":
description: Returns the updated application.
content:
application/json:
schema:
type: object
delete:
summary: Delete an existing application by its ID.
tags:
- applications
parameters:
- $ref: "#/components/parameters/appIdUrl"
responses:
"200":
description: Returns the deleted application.
content:
application/json:
schema:
type: object
/queries/search: /queries/search:
post: post:
summary: Search for a query based on its name. summary: Search for a query based on its name.
tags: tags:
- queries - queries
parameters:
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the queries found based on the search parameters.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/query"
"/queries/{queryId}": "/queries/{queryId}":
post: post:
summary: Execute a query and retrieve its response. summary: Execute a query and retrieve its response.
tags: tags:
- queries - queries
parameters:
- $ref: "#/components/parameters/queryId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the result of the query execution.
content:
application/json:
schema:
type: array
items:
type: object
"/tables/{tableId}/rows/search": "/tables/{tableId}/rows/search":
post: post:
summary: Used to search for rows within a table. summary: Used to search for rows within a table.
@ -580,23 +691,6 @@ paths:
table: table:
$ref: "#/components/examples/row" $ref: "#/components/examples/row"
"/tables/{tableId}": "/tables/{tableId}":
get:
summary: Get a single table by its ID, internal and external within an app.
tags:
- tables
parameters:
- $ref: "#/components/parameters/tableId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the table that was found.
content:
application/json:
schema:
type: object
examples:
table:
$ref: "#/components/examples/row"
delete: delete:
summary: Delete a single table and all of its data. summary: Delete a single table and all of its data.
tags: tags:
@ -614,4 +708,63 @@ paths:
examples: examples:
table: table:
$ref: "#/components/examples/table" $ref: "#/components/examples/table"
/users/search:
post:
summary: Search for a user based on their email/username.
tags:
- users
parameters:
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the found users based on search parameters.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/user"
/users:
post:
summary: Create a new user in the Budibase portal.
tags:
- users
parameters:
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the created user.
content:
application/json:
schema:
type: object
"/users/{userId}":
put:
summary: Update an existing user by their ID.
tags:
- users
parameters:
- $ref: "#/components/parameters/userId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the updated user.
content:
application/json:
schema:
type: object
delete:
summary: Delete an existing user by their ID.
tags:
- users
parameters:
- $ref: "#/components/parameters/userId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the deleted user.
content:
application/json:
schema:
type: object
tags: [] tags: []

View File

@ -27,3 +27,33 @@ exports.appId = {
type: "string", type: "string",
}, },
} }
exports.appIdUrl = {
in: "path",
name: "appId",
required: true,
description: "The ID of the app which this request is targeting.",
schema: {
type: "string",
},
}
exports.queryId = {
in: "path",
name: "queryId",
required: true,
description: "The ID of the query which this request is targeting.",
schema: {
type: "string",
},
}
exports.userId = {
in: "path",
name: "userId",
required: true,
description: "The ID of the user which this request is targeting.",
schema: {
type: "string",
},
}

View File

@ -143,3 +143,18 @@ exports.table = {
}, },
}, },
} }
exports.query = {
type: "object",
properties: {},
}
exports.user = {
type: "object",
properties: {},
}
exports.application = {
type: "object",
properties: {},
}

View File

@ -0,0 +1,15 @@
exports.search = () => {
}
exports.create = () => {
}
exports.update = () => {
}
exports.delete = () => {
}

View File

@ -6,10 +6,6 @@ exports.create = () => {
} }
exports.singleRead = () => {
}
exports.update = () => { exports.update = () => {
} }

View File

@ -0,0 +1,15 @@
exports.search = () => {
}
exports.create = () => {
}
exports.update = () => {
}
exports.delete = () => {
}

View File

@ -1,5 +1,84 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../../controllers/public/applications")
const router = Router() const router = Router()
/**
* @openapi
* /applications/search:
* post:
* summary: Search for an application based on its app name.
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the applications that were found based on the search parameters.
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/application'
*/
router.post("/applications/search", controller.search)
/**
* @openapi
* /applications:
* post:
* summary: Create a new application.
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the created application.
* content:
* application/json:
* schema:
* type: object
*/
router.post("/applications", controller.create)
/**
* @openapi
* /applications/{appId}:
* put:
* summary: Update an existing application by its ID.
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appIdUrl'
* responses:
* 200:
* description: Returns the updated application.
* content:
* application/json:
* schema:
* type: object
*/
router.put("/applications/:appId", controller.update)
/**
* @openapi
* /applications/{appId}:
* delete:
* summary: Delete an existing application by its ID.
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appIdUrl'
* responses:
* 200:
* description: Returns the deleted application.
* content:
* application/json:
* schema:
* type: object
*/
router.delete("/applications/:appId", controller.delete)
module.exports = router module.exports = router

View File

@ -10,6 +10,17 @@ const router = Router()
* summary: Search for a query based on its name. * summary: Search for a query based on its name.
* tags: * tags:
* - queries * - queries
* parameters:
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the queries found based on the search parameters.
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/query'
*/ */
router.post("/queries/search", controller.search) router.post("/queries/search", controller.search)
@ -20,6 +31,18 @@ router.post("/queries/search", controller.search)
* summary: Execute a query and retrieve its response. * summary: Execute a query and retrieve its response.
* tags: * tags:
* - queries * - queries
* parameters:
* - $ref: '#/components/parameters/queryId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the result of the query execution.
* content:
* application/json:
* schema:
* type: array
* items:
* type: object
*/ */
router.post("/queries/:queryId", controller.execute) router.post("/queries/:queryId", controller.execute)

View File

@ -99,29 +99,6 @@ router.post("/tables", controller.create)
*/ */
router.put("/tables/:tableId", controller.update) router.put("/tables/:tableId", controller.update)
/**
* @openapi
* /tables/{tableId}:
* get:
* summary: Get a single table by its ID, internal and external within an app.
* tags:
* - tables
* parameters:
* - $ref: '#/components/parameters/tableId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the table that was found.
* content:
* application/json:
* schema:
* type: object
* examples:
* table:
* $ref: '#/components/examples/row'
*/
router.get("/tables/:tableId", controller.singleRead)
/** /**
* @openapi * @openapi
* /tables/{tableId}: * /tables/{tableId}:

View File

@ -1,5 +1,86 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../../controllers/public/users")
const router = Router() const router = Router()
/**
* @openapi
* /users/search:
* post:
* summary: Search for a user based on their email/username.
* tags:
* - users
* parameters:
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the found users based on search parameters.
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/user'
*/
router.post("/users/search", controller.search)
/**
* @openapi
* /users:
* post:
* summary: Create a new user in the Budibase portal.
* tags:
* - users
* parameters:
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the created user.
* content:
* application/json:
* schema:
* type: object
*/
router.post("/users", controller.create)
/**
* @openapi
* /users/{userId}:
* put:
* summary: Update an existing user by their ID.
* tags:
* - users
* parameters:
* - $ref: '#/components/parameters/userId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the updated user.
* content:
* application/json:
* schema:
* type: object
*/
router.put("/users/:userId", controller.update)
/**
* @openapi
* /users/{userId}:
* delete:
* summary: Delete an existing user by their ID.
* tags:
* - users
* parameters:
* - $ref: '#/components/parameters/userId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the deleted user.
* content:
* application/json:
* schema:
* type: object
*/
router.delete("/users/:userId", controller.delete)
module.exports = router module.exports = router