From 8a459dee9cbaee411459985ea931895ffa64135b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 12 Mar 2024 11:39:04 +0100 Subject: [PATCH] chore: Add typescript and openapi-typescript definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- composer.json | 2 +- package-lock.json | 97 +- package.json | 7 +- src/types/openapi/openapi.ts | 2926 ++++++++++++++++++++++++++++++++++ tsconfig.json | 15 + 5 files changed, 3030 insertions(+), 17 deletions(-) create mode 100644 src/types/openapi/openapi.ts create mode 100644 tsconfig.json diff --git a/composer.json b/composer.json index 7d7694377..1e1227953 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "psalm:update-baseline": "./vendor/bin/psalm.phar --update-baseline", "psalm:fix": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType", "psalm:fix:dry": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run", - "openapi": "./vendor-bin/openapi-extractor/vendor/nextcloud/openapi-extractor/generate-spec", + "openapi": "generate-spec --verbose && (npm run typescript:generate || echo 'Please manually regenerate the typescript OpenAPI models')", "post-install-cmd": [ "[ $COMPOSER_DEV_MODE -eq 0 ] || composer bin all install --ansi" ], diff --git a/package-lock.json b/package-lock.json index 610427ee8..0b7a6baa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,8 @@ "@nextcloud/stylelint-config": "^2.4.0", "@nextcloud/webpack-vue-config": "^6.0.1", "cypress": "^13.6.4", - "cypress-downloadfile": "^1.2.3" + "cypress-downloadfile": "^1.2.3", + "openapi-typescript": "^6.7.4" }, "engines": { "node": "^20.0.0", @@ -2086,6 +2087,15 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@floating-ui/core": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz", @@ -4428,7 +4438,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, - "peer": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -4442,7 +4451,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, - "peer": true, "engines": { "node": ">= 8" } @@ -4452,7 +4460,6 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, - "peer": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -10467,11 +10474,10 @@ "peer": true }, "node_modules/fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, - "peer": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -10531,7 +10537,6 @@ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, - "peer": true, "dependencies": { "reusify": "^1.0.4" } @@ -17831,7 +17836,6 @@ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "peer": true, "engines": { "node": ">= 8" } @@ -19749,6 +19753,62 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/openapi-typescript": { + "version": "6.7.4", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-6.7.4.tgz", + "integrity": "sha512-EZyeW9Wy7UDCKv0iYmKrq2pVZtquXiD/YHiUClAKqiMi42nodx/EQH11K6fLqjt1IZlJmVokrAsExsBMM2RROQ==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.3", + "fast-glob": "^3.3.2", + "js-yaml": "^4.1.0", + "supports-color": "^9.4.0", + "undici": "^5.28.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "openapi-typescript": "bin/cli.js" + } + }, + "node_modules/openapi-typescript/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/openapi-typescript/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/openapi-typescript/node_modules/supports-color": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz", + "integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/openapi-typescript/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -20777,8 +20837,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "peer": true + ] }, "node_modules/quick-lru": { "version": "5.1.1", @@ -22056,7 +22115,6 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, - "peer": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -22117,7 +22175,6 @@ "url": "https://feross.org/support" } ], - "peer": true, "dependencies": { "queue-microtask": "^1.2.2" } @@ -24261,6 +24318,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dev": true, + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", diff --git a/package.json b/package.json index 4a3e768b0..adbfbd3cc 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "dev": "NODE_ENV=development webpack --progress --config webpack.js", "watch": "NODE_ENV=development webpack --progress --watch --config webpack.js", "serve": "NODE_ENV=development webpack serve --progress --config webpack.js", + "typescript:check": "tsc --noEmit", + "typescript:generate": "npx openapi-typescript \"./openapi*.json\" --immutable -t -o src/types/openapi/", "lint": "eslint --ext .js,.vue src", "lint:fix": "eslint --ext .js,.vue src --fix", "stylelint": "stylelint 'css/*.css' 'css/*.scss' 'src/**/*.scss' 'src/**/*.vue'", @@ -62,6 +64,7 @@ "@nextcloud/stylelint-config": "^2.4.0", "@nextcloud/webpack-vue-config": "^6.0.1", "cypress": "^13.6.4", - "cypress-downloadfile": "^1.2.3" + "cypress-downloadfile": "^1.2.3", + "openapi-typescript": "^6.7.4" } -} \ No newline at end of file +} diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts new file mode 100644 index 000000000..c7e693067 --- /dev/null +++ b/src/types/openapi/openapi.ts @@ -0,0 +1,2926 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + + +/** OneOf type helpers */ +type Without = { [P in Exclude]?: never }; +type XOR = (T | U) extends object ? (Without & U) | (Without & T) : T | U; +type OneOf = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR, ...Rest]> : never; + +export type paths = { + "/index.php/apps/tables/api/1/tables": { + /** Returns all Tables */ + get: operations["api1-list"]; + /** Create a new table and return it */ + post: operations["api1-create-table"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}": { + /** Get a table object */ + get: operations["api1-get-table"]; + /** Update tables properties */ + put: operations["api1-update-table"]; + /** Delete a table */ + delete: operations["api1-delete-table"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}/views": { + /** Get all views for a table */ + get: operations["api1-list-views"]; + /** Create a new view for a table */ + post: operations["api1-create-view"]; + }; + "/index.php/apps/tables/api/1/views/{viewId}": { + /** Get a view object */ + get: operations["api1-get-view"]; + /** Update a view via key-value sets */ + put: operations["api1-update-view"]; + /** Delete a view */ + delete: operations["api1-delete-view"]; + }; + "/index.php/apps/tables/api/1/shares/{shareId}": { + /** Get a share object */ + get: operations["api1-get-share"]; + /** Update a share permission */ + put: operations["api1-update-share-permissions"]; + /** Delete a share */ + delete: operations["api1-delete-share"]; + }; + "/index.php/apps/tables/api/1/views/{viewId}/shares": { + /** Get all shares for a view Will be empty if view does not exist */ + get: operations["api1-list-view-shares"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}/shares": { + /** Get all shares for a table Will be empty if table does not exist */ + get: operations["api1-list-table-shares"]; + /** Create a share for a table */ + post: operations["api1-create-table-share"]; + }; + "/index.php/apps/tables/api/1/shares": { + /** Create a new share */ + post: operations["api1-create-share"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}/columns": { + /** Get all columns for a table or a underlying view Return an empty array if no columns were found */ + get: operations["api1-list-table-columns"]; + /** Create a new column for a table */ + post: operations["api1-create-table-column"]; + }; + "/index.php/apps/tables/api/1/views/{viewId}/columns": { + /** Get all columns for a view Return an empty array if no columns were found */ + get: operations["api1-list-view-columns"]; + }; + "/index.php/apps/tables/api/1/columns": { + /** Create a column */ + post: operations["api1-create-column"]; + }; + "/index.php/apps/tables/api/1/columns/{columnId}": { + /** Returns a column object */ + get: operations["api1-get-column"]; + /** Update a column */ + put: operations["api1-update-column"]; + /** Delete a column */ + delete: operations["api1-delete-column"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}/rows/simple": { + /** List all rows values for a table, first row are the column titles */ + get: operations["api1-list-table-rows-simple"]; + }; + "/index.php/apps/tables/api/1/tables/{tableId}/rows": { + /** List all rows for a table */ + get: operations["api1-list-table-rows"]; + /** Create a row within a table */ + post: operations["api1-create-row-in-table"]; + }; + "/index.php/apps/tables/api/1/views/{viewId}/rows": { + /** List all rows for a view */ + get: operations["api1-list-view-rows"]; + /** Create a row within a view */ + post: operations["api1-create-row-in-view"]; + }; + "/index.php/apps/tables/api/1/rows/{rowId}": { + /** Get a row */ + get: operations["api1-get-row"]; + /** Update a row */ + put: operations["api1-update-row"]; + /** Delete a row */ + delete: operations["api1-delete-row"]; + }; + "/index.php/apps/tables/api/1/views/{viewId}/rows/{rowId}": { + /** Delete a row within a view */ + delete: operations["api1-delete-row-by-view"]; + }; + "/index.php/apps/tables/api/1/import/table/{tableId}": { + /** Import from file in to a table */ + post: operations["api1-import-in-table"]; + }; + "/index.php/apps/tables/api/1/import/views/{viewId}": { + /** Import from file in to a table */ + post: operations["api1-import-in-view"]; + }; + "/ocs/v2.php/apps/tables/api/2/init": { + /** + * [api v2] Returns all main resources + * @description Tables and views incl. shares + */ + get: operations["api_general-list"]; + }; + "/ocs/v2.php/apps/tables/api/2/tables": { + /** [api v2] Returns all Tables */ + get: operations["api_tables-list"]; + /** [api v2] Create a new table and return it */ + post: operations["api_tables-create"]; + }; + "/ocs/v2.php/apps/tables/api/2/tables/{id}": { + /** [api v2] Get a table object */ + get: operations["api_tables-show"]; + /** [api v2] Update tables properties */ + put: operations["api_tables-update"]; + /** [api v2] Delete a table */ + delete: operations["api_tables-destroy"]; + }; + "/ocs/v2.php/apps/tables/api/2/tables/{id}/transfer": { + /** + * [api v2] Transfer table + * @description Transfer table from one user to another + */ + put: operations["api_tables-transfer"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/{nodeType}/{nodeId}": { + /** + * [api v2] Get all columns for a table or a view + * @description Return an empty array if no columns were found + */ + get: operations["api_columns-list"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/{id}": { + /** [api v2] Get a column object */ + get: operations["api_columns-show"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/number": { + /** + * [api v2] Create new numbered column + * @description Specify a subtype to use any special numbered column + */ + post: operations["api_columns-create-number-column"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/text": { + /** + * [api v2] Create new text column + * @description Specify a subtype to use any special text column + */ + post: operations["api_columns-create-text-column"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/selection": { + /** + * [api v2] Create new selection column + * @description Specify a subtype to use any special selection column + */ + post: operations["api_columns-create-selection-column"]; + }; + "/ocs/v2.php/apps/tables/api/2/columns/datetime": { + /** + * [api v2] Create new datetime column + * @description Specify a subtype to use any special datetime column + */ + post: operations["api_columns-create-datetime-column"]; + }; + "/ocs/v2.php/apps/tables/api/2/favorites/{nodeType}/{nodeId}": { + /** [api v2] Add a node (table or view) to user favorites */ + post: operations["api_favorite-create"]; + /** [api v2] Remove a node (table or view) to from favorites */ + delete: operations["api_favorite-destroy"]; + }; +}; + +export type webhooks = Record; + +export type components = { + schemas: { + Capabilities: { + tables: { + enabled: boolean; + version: string; + apiVersions: string[]; + features: string[]; + column_types: string[]; + }; + }; + Column: { + /** Format: int64 */ + id: number; + title: string; + /** Format: int64 */ + tableId: number; + createdBy: string; + createdAt: string; + lastEditBy: string; + lastEditAt: string; + type: string; + subtype: string; + mandatory: boolean; + description: string; + /** Format: int64 */ + orderWeight: number; + /** Format: float */ + numberDefault: number; + /** Format: float */ + numberMin: number; + /** Format: float */ + numberMax: number; + /** Format: int64 */ + numberDecimals: number; + numberPrefix: string; + numberSuffix: string; + textDefault: string; + textAllowedPattern: string; + /** Format: int64 */ + textMaxLength: number; + selectionOptions: string; + selectionDefault: string; + datetimeDefault: string; + }; + ImportState: { + /** Format: int64 */ + found_columns_count: number; + /** Format: int64 */ + matching_columns_count: number; + /** Format: int64 */ + created_columns_count: number; + /** Format: int64 */ + inserted_rows_count: number; + /** Format: int64 */ + errors_parsing_count: number; + /** Format: int64 */ + errors_count: number; + }; + Index: { + tables: components["schemas"]["Table"][]; + views: components["schemas"]["View"][]; + }; + OCSMeta: { + status: string; + statuscode: number; + message?: string; + totalitems?: string; + itemsperpage?: string; + }; + Row: { + /** Format: int64 */ + id: number; + /** Format: int64 */ + tableId: number; + createdBy: string; + createdAt: string; + lastEditBy: string; + lastEditAt: string; + data: { + /** Format: int64 */ + columnId: number; + value: Record; + } | null; + }; + Share: { + /** Format: int64 */ + id: number; + sender: string; + receiver: string; + receiverDisplayName: string; + receiverType: string; + /** Format: int64 */ + nodeId: number; + nodeType: string; + permissionRead: boolean; + permissionCreate: boolean; + permissionUpdate: boolean; + permissionDelete: boolean; + permissionManage: boolean; + createdAt: string; + createdBy: string; + }; + Table: { + /** Format: int64 */ + id: number; + title: string; + emoji: string | null; + ownership: string; + ownerDisplayName: string; + createdBy: string; + createdAt: string; + lastEditBy: string; + lastEditAt: string; + archived: boolean; + favorite: boolean; + isShared: boolean; + onSharePermissions: { + read: boolean; + create: boolean; + update: boolean; + delete: boolean; + manage: boolean; + } | null; + hasShares: boolean; + /** Format: int64 */ + rowsCount: number; + views: components["schemas"]["View"][]; + /** Format: int64 */ + columnsCount: number; + }; + View: { + /** Format: int64 */ + id: number; + title: string; + emoji: string | null; + /** Format: int64 */ + tableId: number; + ownership: string; + ownerDisplayName: string | null; + createdBy: string; + createdAt: string; + lastEditBy: string; + lastEditAt: string; + description: string | null; + columns: number[]; + sort: ({ + /** Format: int64 */ + columnId: number; + /** @enum {string} */ + mode: "ASC" | "DESC"; + })[]; + filter: (({ + /** Format: int64 */ + columnId: number; + /** @enum {string} */ + operator: "begins-with" | "ends-with" | "contains" | "is-equal" | "is-greater-than" | "is-greater-than-or-equal" | "is-lower-than" | "is-lower-than-or-equal" | "is-empty"; + value: string | number; + })[])[]; + isShared: boolean; + favorite: boolean; + onSharePermissions: { + read: boolean; + create: boolean; + update: boolean; + delete: boolean; + manage: boolean; + } | null; + hasShares: boolean; + /** Format: int64 */ + rowsCount: number; + }; + }; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +}; + +export type $defs = Record; + +export type external = Record; + +export type operations = { + + /** Returns all Tables */ + "api1-list": { + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": components["schemas"]["Table"][]; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a new table and return it */ + "api1-create-table": { + parameters: { + query: { + /** @description Title of the table */ + title: string; + /** @description Emoji for the table */ + emoji?: string | null; + /** @description Template to use if wanted */ + template?: string; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": components["schemas"]["Table"]; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get a table object */ + "api1-get-table": { + parameters: { + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Table returned */ + 200: { + content: { + "application/json": components["schemas"]["Table"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Update tables properties */ + "api1-update-table": { + parameters: { + query?: { + /** @description New table title */ + title?: string | null; + /** @description New table emoji */ + emoji?: string | null; + /** @description Whether the table is archived */ + archived?: 0 | 1; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": components["schemas"]["Table"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a table */ + "api1-delete-table": { + parameters: { + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Deleted table returned */ + 200: { + content: { + "application/json": components["schemas"]["Table"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get all views for a table */ + "api1-list-views": { + parameters: { + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Views returned */ + 200: { + content: { + "application/json": components["schemas"]["View"][]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a new view for a table */ + "api1-create-view": { + parameters: { + query: { + /** @description Title for the view */ + title: string; + /** @description Emoji for the view */ + emoji?: string | null; + }; + path: { + /** @description Table ID that will hold the view */ + tableId: number; + }; + }; + responses: { + /** @description View created */ + 200: { + content: { + "application/json": components["schemas"]["View"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get a view object */ + "api1-get-view": { + parameters: { + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description View returned */ + 200: { + content: { + "application/json": components["schemas"]["View"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Update a view via key-value sets */ + "api1-update-view": { + parameters: { + query: { + /** @description key-value pairs */ + data: OneOf<[{ + /** @enum {string} */ + key: "title" | "emoji" | "description"; + value: string; + }, { + /** @enum {string} */ + key: "columns"; + value: number[]; + }, { + /** @enum {string} */ + key: "sort"; + value: { + /** Format: int64 */ + columnId: number; + /** @enum {string} */ + mode: "ASC" | "DESC"; + }; + }, { + /** @enum {string} */ + key: "filter"; + value: { + /** Format: int64 */ + columnId: number; + /** @enum {string} */ + operator: "begins-with" | "ends-with" | "contains" | "is-equal" | "is-greater-than" | "is-greater-than-or-equal" | "is-lower-than" | "is-lower-than-or-equal" | "is-empty"; + value: string | number; + }; + }]>; + }; + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description View updated */ + 200: { + content: { + "application/json": components["schemas"]["View"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a view */ + "api1-delete-view": { + parameters: { + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["View"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get a share object */ + "api1-get-share": { + parameters: { + path: { + /** @description Share ID */ + shareId: number; + }; + }; + responses: { + /** @description Share returned */ + 200: { + content: { + "application/json": components["schemas"]["Share"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Update a share permission */ + "api1-update-share-permissions": { + parameters: { + query: { + /** @description Permission type that should be changed */ + permissionType: string; + /** @description New permission value */ + permissionValue: 0 | 1; + }; + path: { + /** @description Share ID */ + shareId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["Share"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a share */ + "api1-delete-share": { + parameters: { + path: { + /** @description Share ID */ + shareId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["Share"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get all shares for a view Will be empty if view does not exist */ + "api1-list-view-shares": { + parameters: { + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description Shares returned */ + 200: { + content: { + "application/json": components["schemas"]["Share"][]; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get all shares for a table Will be empty if table does not exist */ + "api1-list-table-shares": { + parameters: { + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Shares returned */ + 200: { + content: { + "application/json": components["schemas"]["Share"][]; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a share for a table */ + "api1-create-table-share": { + parameters: { + query: { + /** @description Receiver ID */ + receiver: string; + /** @description Receiver type */ + receiverType: "user" | "group"; + /** @description Permission if receiver can read data */ + permissionRead: 0 | 1; + /** @description Permission if receiver can create data */ + permissionCreate: 0 | 1; + /** @description Permission if receiver can update data */ + permissionUpdate: 0 | 1; + /** @description Permission if receiver can delete data */ + permissionDelete: 0 | 1; + /** @description Permission if receiver can manage table */ + permissionManage: 0 | 1; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["Share"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a new share */ + "api1-create-share": { + parameters: { + query: { + /** @description Node ID */ + nodeId: number; + /** @description Node type */ + nodeType: "table" | "view"; + /** @description Receiver ID */ + receiver: string; + /** @description Receiver type */ + receiverType: "user" | "group"; + /** @description Permission if receiver can read data */ + permissionRead?: 0 | 1; + /** @description Permission if receiver can create data */ + permissionCreate?: 0 | 1; + /** @description Permission if receiver can update data */ + permissionUpdate?: 0 | 1; + /** @description Permission if receiver can delete data */ + permissionDelete?: 0 | 1; + /** @description Permission if receiver can manage node */ + permissionManage?: 0 | 1; + }; + }; + responses: { + /** @description Share returned */ + 200: { + content: { + "application/json": components["schemas"]["Share"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get all columns for a table or a underlying view Return an empty array if no columns were found */ + "api1-list-table-columns": { + parameters: { + query?: { + /** @description View ID */ + viewId?: number | null; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["Column"][]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a new column for a table */ + "api1-create-table-column": { + parameters: { + query: { + /** @description Title */ + title: string; + /** @description Column main type */ + type: "text" | "number" | "datetime" | "select"; + /** @description Column sub type */ + subtype?: string | null; + /** @description Is the column mandatory */ + mandatory: 0 | 1; + /** @description Description */ + description?: string | null; + /** @description Prefix if the column is a number field */ + numberPrefix?: string | null; + /** @description Suffix if the column is a number field */ + numberSuffix?: string | null; + /** @description Default number, if column is a number */ + numberDefault?: number | null; + /** @description Min value, if column is a number */ + numberMin?: number | null; + /** @description Max number, if column is a number */ + numberMax?: number | null; + /** @description Number of decimals, if column is a number */ + numberDecimals?: number | null; + /** @description Default text, if column is a text */ + textDefault?: string | null; + /** @description Allowed pattern (regex) for text columns (not yet implemented) */ + textAllowedPattern?: string | null; + /** @description Max length, if column is a text */ + textMaxLength?: number | null; + /** @description Options for a selection (json array{id: int, label: string}) */ + selectionOptions?: string | null; + /** @description Default option IDs for a selection (json int[]) */ + selectionDefault?: string | null; + /** @description Default value, if column is datetime */ + datetimeDefault?: string | null; + /** @description View IDs where this column should be added to be presented */ + "selectedViewIds[]"?: number[] | null; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": components["schemas"]["Column"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get all columns for a view Return an empty array if no columns were found */ + "api1-list-view-columns": { + parameters: { + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": components["schemas"]["Column"][]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a column */ + "api1-create-column": { + parameters: { + query: { + /** @description Table ID */ + tableId?: number | null; + /** @description View ID */ + viewId?: number | null; + /** @description Title */ + title: string; + /** @description Column main type */ + type: "text" | "number" | "datetime" | "select"; + /** @description Column sub type */ + subtype?: string | null; + /** @description Is the column mandatory */ + mandatory: 0 | 1; + /** @description Description */ + description?: string | null; + /** @description Prefix if the column is a number field */ + numberPrefix?: string | null; + /** @description Suffix if the column is a number field */ + numberSuffix?: string | null; + /** @description Default number, if column is a number */ + numberDefault?: number | null; + /** @description Min value, if column is a number */ + numberMin?: number | null; + /** @description Max number, if column is a number */ + numberMax?: number | null; + /** @description Number of decimals, if column is a number */ + numberDecimals?: number | null; + /** @description Default text, if column is a text */ + textDefault?: string | null; + /** @description Allowed pattern (regex) for text columns (not yet implemented) */ + textAllowedPattern?: string | null; + /** @description Max length, if column is a text */ + textMaxLength?: number | null; + /** @description Options for a selection (json array{id: int, label: string}) */ + selectionOptions?: string | null; + /** @description Default option IDs for a selection (json int[]) */ + selectionDefault?: string | null; + /** @description Default value, if column is datetime */ + datetimeDefault?: string | null; + /** @description View IDs where this column should be added to be presented */ + "selectedViewIds[]"?: number[] | null; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": components["schemas"]["Column"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Returns a column object */ + "api1-get-column": { + parameters: { + path: { + /** @description Wanted Column ID */ + columnId: number; + }; + }; + responses: { + /** @description Column returned */ + 200: { + content: { + "application/json": components["schemas"]["Column"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Update a column */ + "api1-update-column": { + parameters: { + query: { + /** @description Title */ + title?: string | null; + /** @description Column sub type */ + subtype?: string | null; + /** @description Is the column mandatory */ + mandatory: 0 | 1; + /** @description Description */ + description?: string | null; + /** @description Prefix if the column is a number field */ + numberPrefix?: string | null; + /** @description Suffix if the column is a number field */ + numberSuffix?: string | null; + /** @description Default number, if column is a number */ + numberDefault?: number | null; + /** @description Min value, if column is a number */ + numberMin?: number | null; + /** @description Max number, if column is a number */ + numberMax?: number | null; + /** @description Number of decimals, if column is a number */ + numberDecimals?: number | null; + /** @description Default text, if column is a text */ + textDefault?: string | null; + /** @description Allowed pattern (regex) for text columns (not yet implemented) */ + textAllowedPattern?: string | null; + /** @description Max length, if column is a text */ + textMaxLength?: number | null; + /** @description Options for a selection (json array{id: int, label: string}) */ + selectionOptions?: string | null; + /** @description Default option IDs for a selection (json int[]) */ + selectionDefault?: string | null; + /** @description Default value, if column is datetime */ + datetimeDefault?: string | null; + }; + path: { + /** @description Column ID that will be updated */ + columnId: number; + }; + }; + responses: { + /** @description Updated column */ + 200: { + content: { + "application/json": components["schemas"]["Column"]; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a column */ + "api1-delete-column": { + parameters: { + path: { + /** @description Wanted Column ID */ + columnId: number; + }; + }; + responses: { + /** @description Deleted column returned */ + 200: { + content: { + "application/json": components["schemas"]["Column"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** List all rows values for a table, first row are the column titles */ + "api1-list-table-rows-simple": { + parameters: { + query?: { + /** @description Limit */ + limit?: number | null; + /** @description Offset */ + offset?: number | null; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Row values returned */ + 200: { + content: { + "application/json": string[]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** List all rows for a table */ + "api1-list-table-rows": { + parameters: { + query?: { + /** @description Limit */ + limit?: number | null; + /** @description Offset */ + offset?: number | null; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Rows returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"][]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a row within a table */ + "api1-create-row-in-table": { + parameters: { + query: { + /** @description Data as key - value store */ + data: OneOf<[string, { + /** Format: int64 */ + columnId: number; + value: Record; + }]>; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** List all rows for a view */ + "api1-list-view-rows": { + parameters: { + query?: { + /** @description Limit */ + limit?: number | null; + /** @description Offset */ + offset?: number | null; + }; + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description Rows returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"][]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Create a row within a view */ + "api1-create-row-in-view": { + parameters: { + query: { + /** @description Data as key - value store */ + data: OneOf<[string, { + /** Format: int64 */ + columnId: number; + value: Record; + }]>; + }; + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description Row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Get a row */ + "api1-get-row": { + parameters: { + path: { + /** @description Row ID */ + rowId: number; + }; + }; + responses: { + /** @description Row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Update a row */ + "api1-update-row": { + parameters: { + query: { + /** @description View ID */ + viewId?: number | null; + /** @description Data as key - value store */ + data: OneOf<[string, { + /** Format: int64 */ + columnId: number; + value: Record; + }]>; + }; + path: { + /** @description Row ID */ + rowId: number; + }; + }; + responses: { + /** @description Updated row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a row */ + "api1-delete-row": { + parameters: { + path: { + /** @description Row ID */ + rowId: number; + }; + }; + responses: { + /** @description Deleted row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Delete a row within a view */ + "api1-delete-row-by-view": { + parameters: { + path: { + /** @description View ID */ + viewId: number; + /** @description Row ID */ + rowId: number; + }; + }; + responses: { + /** @description Deleted row returned */ + 200: { + content: { + "application/json": components["schemas"]["Row"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Import from file in to a table */ + "api1-import-in-table": { + parameters: { + query: { + /** @description Path to file */ + path: string; + /** @description Create missing columns */ + createMissingColumns?: 0 | 1; + }; + path: { + /** @description Table ID */ + tableId: number; + }; + }; + responses: { + /** @description Import status returned */ + 200: { + content: { + "application/json": components["schemas"]["ImportState"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** Import from file in to a table */ + "api1-import-in-view": { + parameters: { + query: { + /** @description Path to file */ + path: string; + /** @description Create missing columns */ + createMissingColumns?: 0 | 1; + }; + path: { + /** @description View ID */ + viewId: number; + }; + }; + responses: { + /** @description Import status returned */ + 200: { + content: { + "application/json": components["schemas"]["ImportState"]; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + message: string; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + message: string; + }; + }; + }; + 500: { + content: { + "application/json": { + message: string; + }; + }; + }; + }; + }; + /** + * [api v2] Returns all main resources + * @description Tables and views incl. shares + */ + "api_general-list": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Index returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Index"]; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Returns all Tables */ + "api_tables-list": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"][]; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Create a new table and return it */ + "api_tables-create": { + parameters: { + query: { + /** @description Title of the table */ + title: string; + /** @description Emoji for the table */ + emoji?: string | null; + /** @description Template to use if wanted */ + template?: string; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"]; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Get a table object */ + "api_tables-show": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Table ID */ + id: number; + }; + }; + responses: { + /** @description Table returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Update tables properties */ + "api_tables-update": { + parameters: { + query?: { + /** @description New table title */ + title?: string | null; + /** @description New table emoji */ + emoji?: string | null; + /** @description whether the table is archived */ + archived?: 0 | 1; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Table ID */ + id: number; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Delete a table */ + "api_tables-destroy": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Table ID */ + id: number; + }; + }; + responses: { + /** @description Deleted table returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** + * [api v2] Transfer table + * @description Transfer table from one user to another + */ + "api_tables-transfer": { + parameters: { + query: { + /** @description New user ID */ + newOwnerUserId: string; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Table ID */ + id: number; + }; + }; + responses: { + /** @description Ownership changed */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Table"]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** + * [api v2] Get all columns for a table or a view + * @description Return an empty array if no columns were found + */ + "api_columns-list": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Node type */ + nodeType: "table" | "view"; + /** @description Node ID */ + nodeId: number; + }; + }; + responses: { + /** @description View deleted */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"][]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Get a column object */ + "api_columns-show": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description Column ID */ + id: number; + }; + }; + responses: { + /** @description Column returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"]; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** + * [api v2] Create new numbered column + * @description Specify a subtype to use any special numbered column + */ + "api_columns-create-number-column": { + parameters: { + query: { + /** @description Context of the column creation */ + baseNodeId: number; + /** @description Title */ + title: string; + /** @description Default value for new rows */ + numberDefault?: number | null; + /** @description Decimals */ + numberDecimals?: number | null; + /** @description Prefix */ + numberPrefix?: string | null; + /** @description Suffix */ + numberSuffix?: string | null; + /** @description Min */ + numberMin?: number | null; + /** @description Max */ + numberMax?: number | null; + /** @description Subtype for the new column */ + subtype?: "progress" | "stars" | null; + /** @description Description */ + description?: string | null; + /** @description View IDs where this columns should be added */ + "selectedViewIds[]"?: number[] | null; + /** @description Is mandatory */ + mandatory?: 0 | 1; + /** @description Context type of the column creation */ + baseNodeType?: "table" | "view"; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"]; + }; + }; + }; + }; + /** @description No permission */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + "text/plain": string; + }; + }; + }; + }; + /** + * [api v2] Create new text column + * @description Specify a subtype to use any special text column + */ + "api_columns-create-text-column": { + parameters: { + query: { + /** @description Context of the column creation */ + baseNodeId: number; + /** @description Title */ + title: string; + /** @description Default */ + textDefault?: string | null; + /** @description Allowed regex pattern */ + textAllowedPattern?: string | null; + /** @description Max raw text length */ + textMaxLength?: number | null; + /** @description Subtype for the new column */ + subtype?: "progress" | "stars" | null; + /** @description Description */ + description?: string | null; + /** @description View IDs where this columns should be added */ + "selectedViewIds[]"?: number[] | null; + /** @description Is mandatory */ + mandatory?: 0 | 1; + /** @description Context type of the column creation */ + baseNodeType?: "table" | "view"; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"]; + }; + }; + }; + }; + /** @description No permission */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + "text/plain": string; + }; + }; + }; + }; + /** + * [api v2] Create new selection column + * @description Specify a subtype to use any special selection column + */ + "api_columns-create-selection-column": { + parameters: { + query: { + /** @description Context of the column creation */ + baseNodeId: number; + /** @description Title */ + title: string; + /** @description Json array{id: int, label: string} with options that can be selected, eg [{"id": 1, "label": "first"},{"id": 2, "label": "second"}] */ + selectionOptions: string; + /** @description Json int|int[] for default selected option(s), eg 5 or ["1", "8"] */ + selectionDefault?: string | null; + /** @description Subtype for the new column */ + subtype?: "progress" | "stars" | null; + /** @description Description */ + description?: string | null; + /** @description View IDs where this columns should be added */ + "selectedViewIds[]"?: number[] | null; + /** @description Is mandatory */ + mandatory?: 0 | 1; + /** @description Context type of the column creation */ + baseNodeType?: "table" | "view"; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"]; + }; + }; + }; + }; + /** @description No permission */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + "text/plain": string; + }; + }; + }; + }; + /** + * [api v2] Create new datetime column + * @description Specify a subtype to use any special datetime column + */ + "api_columns-create-datetime-column": { + parameters: { + query: { + /** @description Context of the column creation */ + baseNodeId: number; + /** @description Title */ + title: string; + /** @description For a subtype 'date' you can set 'today'. For a main type or subtype 'time' you can set to 'now'. */ + datetimeDefault?: "today" | "now" | null; + /** @description Subtype for the new column */ + subtype?: "progress" | "stars" | null; + /** @description Description */ + description?: string | null; + /** @description View IDs where this columns should be added */ + "selectedViewIds[]"?: number[] | null; + /** @description Is mandatory */ + mandatory?: 0 | 1; + /** @description Context type of the column creation */ + baseNodeType?: "table" | "view"; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + }; + responses: { + /** @description Column created */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Column"]; + }; + }; + }; + }; + /** @description No permission */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + "text/plain": string; + }; + }; + }; + }; + /** [api v2] Add a node (table or view) to user favorites */ + "api_favorite-create": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description any Application::NODE_TYPE_* constant */ + nodeType: number; + /** @description identifier of the node */ + nodeId: number; + }; + }; + responses: { + /** @description Tables returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: Record; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; + /** [api v2] Remove a node (table or view) to from favorites */ + "api_favorite-destroy": { + parameters: { + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + /** @description any Application::NODE_TYPE_* constant */ + nodeType: number; + /** @description identifier of the node */ + nodeId: number; + }; + }; + responses: { + /** @description Deleted table returned */ + 200: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: Record; + }; + }; + }; + }; + /** @description No permissions */ + 403: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + /** @description Not found */ + 404: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + 500: { + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: { + message: string; + }; + }; + }; + }; + }; + }; + }; +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..efe215729 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "@vue/tsconfig/tsconfig.json", + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "vendor"], + "compilerOptions": { + "outDir": "./js", + "allowJs": true, + "checkJs": true, + "allowImportingTsExtensions": true, + "lib": ["ESNext"], + }, + "vueCompilerOptions": { + "target": 2.7, + } +}