1
0
Fork 0
mirror of synced 2024-06-26 18:10:51 +12:00

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 282fa6cac2
commit 7443a17458
11 changed files with 720 additions and 77 deletions

View file

@ -43,6 +43,33 @@
"schema": {
"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": {
@ -366,6 +393,18 @@
]
}
}
},
"query": {
"type": "object",
"properties": {}
},
"user": {
"type": "object",
"properties": {}
},
"application": {
"type": "object",
"properties": {}
}
}
},
@ -375,12 +414,133 @@
}
],
"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": {
"post": {
"summary": "Search for a query based on its name.",
"tags": [
"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}": {
@ -388,7 +548,30 @@
"summary": "Execute a query and retrieve its response.",
"tags": [
"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": {
@ -866,37 +1049,6 @@
}
},
"/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": {
"summary": "Delete a single table and all of its data.",
"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": []

View file

@ -31,6 +31,27 @@ components:
description: The ID of the app which this request is targeting.
schema:
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:
table:
value:
@ -267,19 +288,109 @@ components:
autocolumn:
type: boolean
description: Defines whether the column is automatically generated.
query:
type: object
properties: {}
user:
type: object
properties: {}
application:
type: object
properties: {}
security:
- ApiKeyAuth: []
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:
post:
summary: Search for a query based on its name.
tags:
- 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}":
post:
summary: Execute a query and retrieve its response.
tags:
- 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":
post:
summary: Used to search for rows within a table.
@ -580,23 +691,6 @@ paths:
table:
$ref: "#/components/examples/row"
"/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:
summary: Delete a single table and all of its data.
tags:
@ -614,4 +708,63 @@ paths:
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: []

View file

@ -27,3 +27,33 @@ exports.appId = {
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 = () => {
}

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 controller = require("../../controllers/public/applications")
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

View file

@ -10,6 +10,17 @@ const router = Router()
* summary: Search for a query based on its name.
* tags:
* - 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)
@ -20,6 +31,18 @@ router.post("/queries/search", controller.search)
* summary: Execute a query and retrieve its response.
* tags:
* - 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)

View file

@ -99,29 +99,6 @@ router.post("/tables", controller.create)
*/
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
* /tables/{tableId}:

View file

@ -1,5 +1,86 @@
const Router = require("@koa/router")
const controller = require("../../controllers/public/users")
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