From 17dcc65552b058faaa8182c614fdbe2b109c8ad6 Mon Sep 17 00:00:00 2001 From: Jan Sobotta Date: Sun, 1 Mar 2026 19:07:06 +0100 Subject: [PATCH 1/4] feat(types): added type generation client --- package.json | 10 +- pnpm-lock.yaml | 210 ++++++++++++++++++++++++++++++--- rollup.config.mjs | 62 +++++++++- src/bin/check-configuration.ts | 53 +++++++++ src/bin/cli.ts | 68 +++++++++++ src/bin/generate.ts | 94 +++++++++++++++ src/bin/types.ts | 4 + 7 files changed, 479 insertions(+), 22 deletions(-) create mode 100644 src/bin/check-configuration.ts create mode 100644 src/bin/cli.ts create mode 100644 src/bin/generate.ts create mode 100644 src/bin/types.ts diff --git a/package.json b/package.json index f7b8cd2..f9dbaf5 100644 --- a/package.json +++ b/package.json @@ -64,22 +64,27 @@ "watch": "pnpm run build --watch", "prepack": "pnpm exec ./scripts/pre-pack.sh" }, + "bin": { + "strapi-client": "dist/bin/cli.mjs" + }, "devDependencies": { "@commitlint/cli": "19.6.1", "@commitlint/config-conventional": "19.6.0", "@commitlint/types": "19.5.0", "@rollup/plugin-commonjs": "28.0.2", + "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "16.0.0", "@rollup/plugin-replace": "6.0.2", "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "12.1.2", "@strapi/eslint-config": "0.2.1", - "@types/node": "^20", "@types/debug": "4.1.12", + "@types/node": "^20", "@types/qs": "6.9.18", - "@vitest/coverage-v8": "latest", "@typescript-eslint/eslint-plugin": "8.21.0", "@typescript-eslint/parser": "8.21.0", + "@vitest/coverage-v8": "latest", + "commander": "^14.0.3", "eslint": "8.57.1", "eslint-plugin-import": "2.31.0", "husky": "9.1.7", @@ -96,6 +101,7 @@ }, "dependencies": { "debug": "4.4.0", + "openapi-typescript": "^7.13.0", "qs": "6.14.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3be9270..43ef977 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: debug: specifier: 4.4.0 - version: 4.4.0 + version: 4.4.0(supports-color@10.2.2) qs: specifier: 6.14.0 version: 6.14.0 @@ -27,6 +27,9 @@ importers: '@rollup/plugin-commonjs': specifier: 28.0.2 version: 28.0.2(rollup@4.31.0) + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@4.31.0) '@rollup/plugin-node-resolve': specifier: 16.0.0 version: 16.0.0(rollup@4.31.0) @@ -60,6 +63,9 @@ importers: '@vitest/coverage-v8': specifier: latest version: 4.0.3(vitest@4.0.3(@types/debug@4.1.12)(@types/node@20.19.1)(jiti@2.4.2)(terser@5.37.0)(yaml@2.6.1)) + commander: + specifier: ^14.0.3 + version: 14.0.3 eslint: specifier: 8.57.1 version: 8.57.1 @@ -72,6 +78,9 @@ importers: lint-staged: specifier: 15.4.1 version: 15.4.1 + openapi-typescript: + specifier: ^7.13.0 + version: 7.13.0(typescript@5.7.3) prettier: specifier: 3.4.2 version: 3.4.2 @@ -487,6 +496,16 @@ packages: resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} engines: {node: '>=12.4.0'} + '@redocly/ajv@8.11.2': + resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==} + + '@redocly/config@0.22.0': + resolution: {integrity: sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==} + + '@redocly/openapi-core@1.34.8': + resolution: {integrity: sha512-/oy8sXi5xK4+HvcFR7xS1A74zJ5aS6rtacNEr91SczLqvtxz79opxp7yYpdYtfGQAp6igx9eU9alwSC/R/X3Cg==} + engines: {node: '>=18.17.0', npm: '>=9.5.0'} + '@rollup/plugin-commonjs@28.0.2': resolution: {integrity: sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==} engines: {node: '>=16.0.0 || 14 >= 14.17'} @@ -496,6 +515,15 @@ packages: rollup: optional: true + '@rollup/plugin-json@6.1.0': + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/plugin-node-resolve@16.0.0': resolution: {integrity: sha512-0FPvAeVUT/zdWoO0jnb/V5BlBsUSNfkIOtFHzMO4H9MOklrmQFY6FduVHKucNb/aTFxvnGhj4MNj/T1oNdDfNg==} engines: {node: '>=14.0.0'} @@ -970,12 +998,20 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} ajv@8.17.1: resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + ansi-escapes@7.0.0: resolution: {integrity: sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==} engines: {node: '>=18'} @@ -1127,6 +1163,9 @@ packages: resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + change-case@5.4.4: + resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} + cli-cursor@5.0.0: resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} engines: {node: '>=18'} @@ -1146,6 +1185,9 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + colorette@1.4.0: + resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==} + colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -1153,6 +1195,10 @@ packages: resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} engines: {node: '>=18'} + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -1790,6 +1836,10 @@ packages: html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + human-signals@5.0.0: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} @@ -1814,6 +1864,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + index-to-position@1.2.0: + resolution: {integrity: sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==} + engines: {node: '>=18'} + inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. @@ -2007,6 +2061,10 @@ packages: resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true + js-levenshtein@1.1.6: + resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==} + engines: {node: '>=0.10.0'} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -2185,6 +2243,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -2264,6 +2326,12 @@ packages: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} + openapi-typescript@7.13.0: + resolution: {integrity: sha512-EFP392gcqXS7ntPvbhBzbF8TyBA+baIYEm791Hy5YkjDYKTnk/Tn5OQeKm5BIZvJihpp8Zzr4hzx0Irde1LNGQ==} + hasBin: true + peerDependencies: + typescript: ^5.x + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -2295,6 +2363,10 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + parse-json@8.3.0: + resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==} + engines: {node: '>=18'} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -2349,6 +2421,10 @@ packages: engines: {node: '>=0.10'} hasBin: true + pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -2642,6 +2718,10 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + supports-color@10.2.2: + resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} + engines: {node: '>=18'} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -2716,6 +2796,10 @@ packages: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + typed-array-buffer@1.0.3: resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} engines: {node: '>= 0.4'} @@ -2754,6 +2838,9 @@ packages: peerDependencies: browserslist: '>= 4.21.0' + uri-js-replace@1.0.1: + resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==} + uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -2883,6 +2970,9 @@ packages: yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + yaml-ast-parser@0.0.43: + resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==} + yaml@2.6.1: resolution: {integrity: sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==} engines: {node: '>= 14'} @@ -2932,7 +3022,7 @@ snapshots: '@babel/traverse': 7.26.4 '@babel/types': 7.26.3 convert-source-map: 2.0.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3011,7 +3101,7 @@ snapshots: '@babel/parser': 7.26.3 '@babel/template': 7.25.9 '@babel/types': 7.26.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -3226,7 +3316,7 @@ snapshots: '@eslint/eslintrc@2.1.4': dependencies: ajv: 6.12.6 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.2 @@ -3244,7 +3334,7 @@ snapshots: '@humanwhocodes/config-array@0.11.14': dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -3252,7 +3342,7 @@ snapshots: '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -3317,6 +3407,29 @@ snapshots: '@nolyfill/is-core-module@1.0.39': {} + '@redocly/ajv@8.11.2': + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js-replace: 1.0.1 + + '@redocly/config@0.22.0': {} + + '@redocly/openapi-core@1.34.8(supports-color@10.2.2)': + dependencies: + '@redocly/ajv': 8.11.2 + '@redocly/config': 0.22.0 + colorette: 1.4.0 + https-proxy-agent: 7.0.6(supports-color@10.2.2) + js-levenshtein: 1.1.6 + js-yaml: 4.1.0 + minimatch: 5.1.6 + pluralize: 8.0.0 + yaml-ast-parser: 0.0.43 + transitivePeerDependencies: + - supports-color + '@rollup/plugin-commonjs@28.0.2(rollup@4.31.0)': dependencies: '@rollup/pluginutils': 5.1.4(rollup@4.31.0) @@ -3329,6 +3442,12 @@ snapshots: optionalDependencies: rollup: 4.31.0 + '@rollup/plugin-json@6.1.0(rollup@4.31.0)': + dependencies: + '@rollup/pluginutils': 5.1.4(rollup@4.31.0) + optionalDependencies: + rollup: 4.31.0 + '@rollup/plugin-node-resolve@16.0.0(rollup@4.31.0)': dependencies: '@rollup/pluginutils': 5.1.4(rollup@4.31.0) @@ -3582,7 +3701,7 @@ snapshots: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.45.0)(typescript@5.7.3) '@typescript-eslint/utils': 5.62.0(eslint@8.45.0)(typescript@5.7.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) eslint: 8.45.0 graphemer: 1.4.0 ignore: 5.3.2 @@ -3616,7 +3735,7 @@ snapshots: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.7.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) eslint: 8.45.0 optionalDependencies: typescript: 5.7.3 @@ -3629,7 +3748,7 @@ snapshots: '@typescript-eslint/types': 8.21.0 '@typescript-eslint/typescript-estree': 8.21.0(typescript@5.7.3) '@typescript-eslint/visitor-keys': 8.21.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) eslint: 8.57.1 typescript: 5.7.3 transitivePeerDependencies: @@ -3649,7 +3768,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.7.3) '@typescript-eslint/utils': 5.62.0(eslint@8.45.0)(typescript@5.7.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) eslint: 8.45.0 tsutils: 3.21.0(typescript@5.7.3) optionalDependencies: @@ -3661,7 +3780,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 8.21.0(typescript@5.7.3) '@typescript-eslint/utils': 8.21.0(eslint@8.57.1)(typescript@5.7.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) eslint: 8.57.1 ts-api-utils: 2.0.0(typescript@5.7.3) typescript: 5.7.3 @@ -3676,7 +3795,7 @@ snapshots: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.3 @@ -3690,7 +3809,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.21.0 '@typescript-eslint/visitor-keys': 8.21.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 @@ -3805,6 +3924,8 @@ snapshots: acorn@8.14.0: {} + agent-base@7.1.4: {} + ajv@6.12.6: dependencies: fast-deep-equal: 3.1.3 @@ -3819,6 +3940,8 @@ snapshots: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + ansi-colors@4.1.3: {} + ansi-escapes@7.0.0: dependencies: environment: 1.1.0 @@ -3985,6 +4108,8 @@ snapshots: chalk@5.4.1: {} + change-case@5.4.4: {} + cli-cursor@5.0.0: dependencies: restore-cursor: 5.1.0 @@ -4006,10 +4131,14 @@ snapshots: color-name@1.1.4: {} + colorette@1.4.0: {} + colorette@2.0.20: {} commander@12.1.0: {} + commander@14.0.3: {} + commander@2.20.3: {} commondir@1.0.1: {} @@ -4088,9 +4217,11 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.4.0: + debug@4.4.0(supports-color@10.2.2): dependencies: ms: 2.1.3 + optionalDependencies: + supports-color: 10.2.2 debug@4.4.3: dependencies: @@ -4363,7 +4494,7 @@ snapshots: eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0)(eslint@8.45.0): dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) enhanced-resolve: 5.18.0 eslint: 8.45.0 fast-glob: 3.3.2 @@ -4579,7 +4710,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -4622,7 +4753,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -4903,6 +5034,13 @@ snapshots: html-escaper@2.0.2: {} + https-proxy-agent@7.0.6(supports-color@10.2.2): + dependencies: + agent-base: 7.1.4 + debug: 4.4.0(supports-color@10.2.2) + transitivePeerDependencies: + - supports-color + human-signals@5.0.0: {} husky@9.1.7: {} @@ -4918,6 +5056,8 @@ snapshots: imurmurhash@0.1.4: {} + index-to-position@1.2.0: {} + inflight@1.0.6: dependencies: once: 1.4.0 @@ -5083,7 +5223,7 @@ snapshots: istanbul-lib-source-maps@5.0.6: dependencies: '@jridgewell/trace-mapping': 0.3.25 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -5108,6 +5248,8 @@ snapshots: jiti@2.4.2: {} + js-levenshtein@1.1.6: {} + js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -5166,7 +5308,7 @@ snapshots: dependencies: chalk: 5.4.1 commander: 12.1.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@10.2.2) execa: 8.0.1 lilconfig: 3.1.3 listr2: 8.2.5 @@ -5275,6 +5417,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -5355,6 +5501,16 @@ snapshots: dependencies: mimic-function: 5.0.1 + openapi-typescript@7.13.0(typescript@5.7.3): + dependencies: + '@redocly/openapi-core': 1.34.8(supports-color@10.2.2) + ansi-colors: 4.1.3 + change-case: 5.4.4 + parse-json: 8.3.0 + supports-color: 10.2.2 + typescript: 5.7.3 + yargs-parser: 21.1.1 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -5393,6 +5549,12 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + parse-json@8.3.0: + dependencies: + '@babel/code-frame': 7.26.2 + index-to-position: 1.2.0 + type-fest: 4.41.0 + path-exists@4.0.0: {} path-exists@5.0.0: {} @@ -5424,6 +5586,8 @@ snapshots: pidtree@0.6.0: {} + pluralize@8.0.0: {} + possible-typed-array-names@1.0.0: {} postcss@8.5.6: @@ -5787,6 +5951,8 @@ snapshots: strip-json-comments@3.1.1: {} + supports-color@10.2.2: {} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -5850,6 +6016,8 @@ snapshots: type-fest@0.20.2: {} + type-fest@4.41.0: {} + typed-array-buffer@1.0.3: dependencies: call-bound: 1.0.3 @@ -5902,6 +6070,8 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 + uri-js-replace@1.0.1: {} + uri-js@4.4.1: dependencies: punycode: 2.3.1 @@ -6035,6 +6205,8 @@ snapshots: yallist@3.1.1: {} + yaml-ast-parser@0.0.43: {} + yaml@2.6.1: {} yargs-parser@21.1.1: {} diff --git a/rollup.config.mjs b/rollup.config.mjs index 4f95e26..065aae8 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -3,6 +3,7 @@ import nodeResolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import replace from '@rollup/plugin-replace'; import terser from '@rollup/plugin-terser'; +import json from '@rollup/plugin-json'; const isProduction = process.env.NODE_ENV === 'production'; @@ -163,5 +164,64 @@ const iife_build = { ], }; +/** + * This configuration is designed to create IIFE format bundles suitable for direct + * inclusion in web browsers. + * + * Outputs: + * - IIFE Minified (dist/bundle.browser.min.js): Minified JavaScript file containing the entire bundle, optimized + * for direct browser usage and embedding, exposed with the global `strapi` variable. + * + * External Dependencies: + * - `debug` is excluded from the bundle and replaced with a no-op function. + * + * @type {import('rollup').RollupOptions} + */ +const cli_build = { + input: 'src/bin/cli.ts', + cache: true, + output: [ + // CommonJS build + { + file: 'dist/bin/cli.cjs', + format: 'cjs', + sourcemap: isProduction ? 'hidden' : true, + exports: 'named', + }, + // ESM build + { + file: 'dist/bin/cli.mjs', + format: 'esm', + sourcemap: isProduction ? 'hidden' : true, + exports: 'named', + }, + ], + external: ['debug', 'openapi-typescript'], + plugins: [ + json(), // Allow Rollup to import JSON files, which may be used for configuration or other purposes in the CLI + // Locate modules using the Node resolution algorithm, for using third party modules in node_modules + nodeResolve({ + browser: false, // "browser" properties in package files are ignored + preferBuiltins: true, // Prefer built-in modules + }), + // Convert CommonJS modules to ES6, so they can be included in a Rollup bundle + commonjs(), + // Transpile (disable declaration emit — CLI binaries don't need .d.ts files, + // and the shared tsconfig would produce paths like ../errors/strapi.d.ts that + // are invalid relative to the dist/bin/ output directory) + typescript({ + tsconfig: './tsconfig.build.json', + compilerOptions: { declaration: false, declarationMap: false }, + }), + // Replace environment variables + replace({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), + preventAssignment: true, + }), + // Minify the output in production + isProduction && terser(), + ], +}; + // Export configurations -export default [node_build, browser_build, iife_build]; +export default [node_build, browser_build, iife_build, cli_build]; diff --git a/src/bin/check-configuration.ts b/src/bin/check-configuration.ts new file mode 100644 index 0000000..a208882 --- /dev/null +++ b/src/bin/check-configuration.ts @@ -0,0 +1,53 @@ + +import { execSync } from 'child_process'; +import { readFileSync, existsSync, lstatSync } from 'fs'; +import { join } from 'path'; + +export function checkPathIsStrapiInstance(path: string): boolean { + // Check if the path exists and is a directory + if (!existsSync(path) || !lstatSync(path).isDirectory()) { + return false; + } + + // Check if the path contains a package.json file with "strapi" as a dependency + const packageJsonPath = join(path, 'package.json'); + if (!existsSync(packageJsonPath)) { + return false; + } + + const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); + const dependencies = { + ...packageJson.dependencies, + ...packageJson.devDependencies, + }; + + return dependencies && (dependencies['@strapi/strapi'] || dependencies['strapi']); +} + +export function checkStrapiVersion(path: string): { major: number, minor: number, patch: number } | null { + // exec the `npx strapi --version` command to get the current strapi version + try { + const version = execSync(`npx strapi --version`, { cwd: path }).toString().trim(); + const [major, minor, patch] = version.split('.').map(Number); + if (!major || !minor || !patch) { + return null; + } + return { major, minor, patch }; + } catch (error) { + console.error('Error checking Strapi version:', error); + return null; + } +} + +export function checkStrapi(path: string): boolean { + if (!checkPathIsStrapiInstance(path)) { + console.error('The provided path is not a valid Strapi instance. Please provide a valid path to a Strapi instance.'); + process.exit(1); + } + const version = checkStrapiVersion(path); + if (!version || version?.major < 5) { + console.error('The provided Strapi instance is not compatible with Strapi Client. Please provide a Strapi instance with version 5 or higher.'); + process.exit(1); + } + return true; +} \ No newline at end of file diff --git a/src/bin/cli.ts b/src/bin/cli.ts new file mode 100644 index 0000000..afa1021 --- /dev/null +++ b/src/bin/cli.ts @@ -0,0 +1,68 @@ +import { writeFileSync, readFileSync } from 'fs'; + +import { Command } from 'commander'; + +import { checkStrapi } from './check-configuration'; +import { generateStrapiClientCode, generateStrapiClientTypes, generateStrapiOpenapiSpecs } from './generate'; +import { StrapiClientGeneratorConfig } from './types'; + +const program = new Command(); + +program + .name('strapi-client') + .description('A CLI for Strapi Client') + .version('1.0.0'); + +/** + * The init command initializes a new Strapi Client configuration. + * It takes a required argument which specifies the path to a Strapi instance. + * Then it generates a `strapi-client.config.json` file in the current working directory with the provided path and options. + */ +program.command('init') + .description('Initialize a new Strapi Client configuration') + .argument('', 'the path to a strapi instance') + .option('-o, --output [file]', 'the output folder for the generated code', 'src/strapi-client/') + .action((str, options) => { + console.log('Initializing Strapi Client configuration...'); + + checkStrapi(str); + + // generate the strapi-client.config.json file in the current working directory with the provided path and options + const config: StrapiClientGeneratorConfig = { + strapiPath: str, + output: options.output, + }; + + // Write the config to a file + writeFileSync('strapi-client.config.json', JSON.stringify(config, null, 2)); + + console.log('\nStrapi Client configuration initialized successfully.\n'); + console.log('Strapi instance path:', str); + console.log('Client generated output folder:', options.output); + + console.log('\nTo generate the client, run the following command:\n'); + console.log(' strapi-client generate'); + }); + +/** + * The generate command generates code for a Strapi instance. + * It uses the configuration provided by the init command or the options passed directly to it. + * The generated code can be used to interact with the Strapi instance specified in the configuration. + */ +program.command('generate') + .description('Generate code for a Strapi instance') + .action(async () => { + console.log('Generating code for Strapi instance...'); + + // load the configuration from strapi-client.config.json + const config = JSON.parse(readFileSync('strapi-client.config.json', 'utf-8')); + console.log('\nUsing configuration from strapi-client.config.json'); + + checkStrapi(config.strapiPath); + + generateStrapiOpenapiSpecs(config); + await generateStrapiClientTypes(config); + generateStrapiClientCode(config); + }); + +program.parse(); diff --git a/src/bin/generate.ts b/src/bin/generate.ts new file mode 100644 index 0000000..7234561 --- /dev/null +++ b/src/bin/generate.ts @@ -0,0 +1,94 @@ +import { execSync } from "child_process"; +import { existsSync, readFileSync, writeFileSync } from "fs"; +import { join, resolve } from "path"; + +import openapiTS, { astToString } from "openapi-typescript"; + +import { StrapiClientGeneratorConfig } from "./types"; + + + +export function generateStrapiOpenapiSpecs(config: StrapiClientGeneratorConfig) { + // exec the `npx strapi generate openapi` command to generate the OpenAPI specifications for the Strapi instance specified in the configuration + console.log('Generating OpenAPI specifications for Strapi instance...'); + const workingDir = process.cwd(); + const absoluteStrapiPath = resolve(config.strapiPath); + // get relative path from strapi directory to the current working directory + + // Check if spec file is already present + const specFile = join(absoluteStrapiPath, 'specification.json'); + let exists = false; + if (existsSync(specFile)) { + exists = true; + } + + // ensure the output directory exists + const outputDir = join(workingDir, config.output); + try { + execSync(`mkdir -p ${outputDir}`); + } catch (error) { + console.error('Error ensuring output directory:', error); + } + + // generate the OpenAPI specifications using the Strapi CLI command + try { + execSync(`npx strapi openapi generate`, { cwd: absoluteStrapiPath, stdio: 'inherit' }); + } catch (error) { + console.error('Error generating OpenAPI specifications:', error); + } + + if (exists) { + // copy the spec file to the output directory + const outputSpecFile = join(workingDir, config.output, 'specification.json'); + try { + execSync(`cp ${specFile} ${outputSpecFile}`); + } catch (error) { + console.error('Error copying OpenAPI specification file:', error); + } + } else { + // move the generated spec file from the strapi directory to the output directory + const outputSpecFile = join(workingDir, config.output, 'specification.json'); + try { + execSync(`mv ${specFile} ${outputSpecFile}`); + } catch (error) { + console.error('Error moving OpenAPI specification file:', error); + } + } +} + +export async function generateStrapiClientTypes(config: StrapiClientGeneratorConfig) { + // Here you would add the logic to generate the Strapi Client code from the OpenAPI specifications + // This is a placeholder function and should be implemented with the actual logic to generate the Strapi Client code + console.log('Generating Strapi Client types code from the OpenAPI specifications...'); + + // read the specs file and generate the types using openapi-typescript + const specsFilePath = join(process.cwd(), config.output, 'specification.json'); + const typeFilePath = join(process.cwd(), config.output, 'index.ts'); + + const ast = await openapiTS(readFileSync(specsFilePath, 'utf-8')); + + writeFileSync(typeFilePath, astToString(ast)); + + console.log('\nStrapi Client types code generated successfully.\n'); +} + +export function generateStrapiClientCode(config: StrapiClientGeneratorConfig) { + // append client code at the end of the generated types file + console.log('Generating Strapi Client code...'); + + const typeFilePath = join(process.cwd(), config.output, 'index.ts'); + const importCode = `import { Config, strapi } from '@strapi/client'; + +` + const clientCode = ` + +export function createClient(config: Config) { + return strapi(config); +} +export default createClient; +`; + + writeFileSync(typeFilePath, importCode + readFileSync(typeFilePath, 'utf-8') + clientCode); + + console.log('\nStrapi Client code generated successfully.\n'); +} \ No newline at end of file diff --git a/src/bin/types.ts b/src/bin/types.ts new file mode 100644 index 0000000..a1318c6 --- /dev/null +++ b/src/bin/types.ts @@ -0,0 +1,4 @@ +export interface StrapiClientGeneratorConfig { + strapiPath: string; + output: string; +} From 44c499c79490ccebaf77dbf799c50146b28a643c Mon Sep 17 00:00:00 2001 From: Jan Sobotta Date: Mon, 2 Mar 2026 14:38:58 +0100 Subject: [PATCH 2/4] feat: added typing test project --- .../node-typescript-test-typings/package.json | 29 + .../pnpm-lock.yaml | 52 + .../node-typescript-test-typings/src/index.ts | 86 + .../src/strapi-client/index.ts | 3925 ++++++++++ .../src/strapi-client/specification.json | 6694 +++++++++++++++++ .../strapi-client.config.json | 4 + .../tsconfig.json | 26 + 7 files changed, 10816 insertions(+) create mode 100644 demo/node-typescript-test-typings/package.json create mode 100644 demo/node-typescript-test-typings/pnpm-lock.yaml create mode 100644 demo/node-typescript-test-typings/src/index.ts create mode 100644 demo/node-typescript-test-typings/src/strapi-client/index.ts create mode 100644 demo/node-typescript-test-typings/src/strapi-client/specification.json create mode 100644 demo/node-typescript-test-typings/strapi-client.config.json create mode 100644 demo/node-typescript-test-typings/tsconfig.json diff --git a/demo/node-typescript-test-typings/package.json b/demo/node-typescript-test-typings/package.json new file mode 100644 index 0000000..8ac17d3 --- /dev/null +++ b/demo/node-typescript-test-typings/package.json @@ -0,0 +1,29 @@ +{ + "name": "demo-node-typescript", + "version": "1.0.0", + "description": "A Strapi Client demo using a Node x TypeScript application", + "main": "dist/index.js", + "private": true, + "type": "module", + "scripts": { + "build": "tsc -p tsconfig.json", + "watch": "tsc -p tsconfig.json -w", + "start": "node dist/index.js", + "debug": "DEBUG=strapi:* node dist/index.js" + }, + "dependencies": { + "@strapi/client": "link:../..", + "dotenv": "16.4.7" + }, + "devDependencies": { + "@types/node": "22.12.0", + "typescript": "5.7.3" + }, + "keywords": [], + "author": { + "name": "Strapi Solutions SAS", + "email": "hi@strapi.io", + "url": "https://strapi.io" + }, + "license": "ISC" +} diff --git a/demo/node-typescript-test-typings/pnpm-lock.yaml b/demo/node-typescript-test-typings/pnpm-lock.yaml new file mode 100644 index 0000000..88fa645 --- /dev/null +++ b/demo/node-typescript-test-typings/pnpm-lock.yaml @@ -0,0 +1,52 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@strapi/client': + specifier: link:../.. + version: link:../.. + dotenv: + specifier: 16.4.7 + version: 16.4.7 + devDependencies: + '@types/node': + specifier: 22.12.0 + version: 22.12.0 + typescript: + specifier: 5.7.3 + version: 5.7.3 + +packages: + + '@types/node@22.12.0': + resolution: {integrity: sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==} + + dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + engines: {node: '>=12'} + + typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + +snapshots: + + '@types/node@22.12.0': + dependencies: + undici-types: 6.20.0 + + dotenv@16.4.7: {} + + typescript@5.7.3: {} + + undici-types@6.20.0: {} diff --git a/demo/node-typescript-test-typings/src/index.ts b/demo/node-typescript-test-typings/src/index.ts new file mode 100644 index 0000000..63fa215 --- /dev/null +++ b/demo/node-typescript-test-typings/src/index.ts @@ -0,0 +1,86 @@ +import * as dotenv from 'dotenv'; +import * as os from 'os'; +import createClient, { paths } from './strapi-client/index.js'; +import { CLIENT, HTTPError } from '../../../dist/exports.js'; +dotenv.config(); + +const api_token = process.env.FULL_ACCESS_TOKEN; // READ_ONLY_TOKEN is also available + +console.log('Running with api token ' + api_token); + +// Create the Strapi client instance +// const client = strapi({ baseURL: 'http://localhost:1337/api', auth: api_token }); +const client = createClient({ baseURL: 'http://localhost:1337/api', auth: api_token }); + +async function runDemo() { + await demonstrateCollection(); + await demonstrateFetch(); +} + +async function demonstrateCollection() { + console.log(os.EOL); + console.log('=== Basic Category Data ==='); + console.log(os.EOL); + + const categories = client.collection('tests'); + + const testDocs = await categories.find(); + + console.log(`Found ${testDocs.data.length} tests:`); + testDocs.data.forEach((test) => { + console.log(`- ${test.documentId} (${test.test})`); + }); +} + +async function demonstrateFetch() { + console.log(os.EOL); + console.log('=== Basic Category Data ==='); + console.log(os.EOL); + + // fetch example + const requestResult = await client.fetch('/tests/{id}', { + method: 'get', + parameters: { + path: { + id: 'k3a31s6hkab6h6xn464pk47q', + }, + query: { + fields: ['test'], + populate: '*', + }, + }, + }); + const requestResultData = await requestResult.json(); + console.log('Request result:', requestResultData); + + // fetch example + const imageCreationResult = await client.fetch('/', { + method: 'post', + body: new FormData(), + }); + const imageCreationResultData = await imageCreationResult.json(); + + // login example + let loginResult: Promise | null = null; + try { + loginResult = client.fetch('/auth/local', { + method: 'post', + body: { + identifier: 'demo_user', + password: 'demo_password', + }, + }); + const loginResultData = await (await loginResult).json(); + + console.log('Login result:', loginResultData); + } catch (error) { + const e = error as HTTPError; + console.error('Login error:', e.message); + if (e.response) { + const errorData = await e.response.json(); + console.error('Login error response text:', errorData); + } + } +} + +runDemo(); diff --git a/demo/node-typescript-test-typings/src/strapi-client/index.ts b/demo/node-typescript-test-typings/src/strapi-client/index.ts new file mode 100644 index 0000000..b446b92 --- /dev/null +++ b/demo/node-typescript-test-typings/src/strapi-client/index.ts @@ -0,0 +1,3925 @@ +import { Config, strapi } from '@strapi/client'; + +export interface paths { + '/tests': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['test/get/tests']; + put?: never; + post: operations['test/post/tests']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/tests/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['test/get/tests_by_id']; + put: operations['test/put/tests_by_id']; + post?: never; + delete: operations['test/delete/tests_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content-types': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/content_types']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content-types/{uid}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/content_types_by_uid']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/components': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/components']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/components/{uid}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/components_by_uid']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['upload/post']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/files': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['upload/get/files']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/files/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['upload/get/files_by_id']; + put?: never; + post?: never; + delete: operations['upload/delete/files_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/locales': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['i18n/get/locales']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/connect/(.*)': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/connect_____']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/local': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_local']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/local/register': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_local_register']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/{provider}/callback': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/auth_by_provider_callback']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/forgot-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_forgot_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/reset-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_reset_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/email-confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/auth_email_confirmation']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/send-email-confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_send_email_confirmation']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/change-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_change_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/refresh': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_refresh']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/logout': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_logout']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/count': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_count']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users']; + put?: never; + post: operations['users-permissions/post/users']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/me': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_me']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_by_id']; + put: operations['users-permissions/put/users_by_id']; + post?: never; + delete: operations['users-permissions/delete/users_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/roles_by_id']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/roles']; + put?: never; + post: operations['users-permissions/post/roles']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles/{role}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put: operations['users-permissions/put/roles_by_role']; + post?: never; + delete: operations['users-permissions/delete/roles_by_role']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/permissions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/permissions']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: never; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + 'test/get/tests': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + filters?: { + [key: string]: unknown; + }; + _q?: string; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + sort?: + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt') + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.245Z + */ + publishedAt: string; + others: unknown; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/post/tests': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + data: { + /** @description A string field */ + test: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.255Z + */ + publishedAt: string; + /** + * Format: uuid + * @description A relational field + */ + others?: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.256Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/get/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + filters?: { + [key: string]: unknown; + }; + sort?: + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt') + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.251Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/put/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + data: { + /** @description A string field */ + test?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.259Z + */ + publishedAt?: string; + /** + * Format: uuid + * @description A relational field + */ + others?: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.260Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/delete/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + filters?: { + [key: string]: unknown; + }; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.263Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/content_types': { + parameters: { + query: { + kind: 'collectionType' | 'singleType'; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + plugin?: string; + apiID: string; + schema: { + displayName: string; + singularName: string; + pluralName: string; + description: string; + draftAndPublish: boolean; + /** @enum {string} */ + kind: 'collectionType' | 'singleType'; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + visible: boolean; + restrictRelationsTo: string[] | null; + pluginOptions?: { + [key: string]: unknown; + }; + options?: { + [key: string]: unknown; + }; + reviewWorkflows?: boolean; + populateCreatorFields?: boolean; + comment?: string; + version?: string; + }; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/content_types_by_uid': { + parameters: { + query?: never; + header?: never; + path: { + uid: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + plugin?: string; + apiID: string; + schema: { + displayName: string; + singularName: string; + pluralName: string; + description: string; + draftAndPublish: boolean; + /** @enum {string} */ + kind: 'collectionType' | 'singleType'; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + visible: boolean; + restrictRelationsTo: string[] | null; + pluginOptions?: { + [key: string]: unknown; + }; + options?: { + [key: string]: unknown; + }; + reviewWorkflows?: boolean; + populateCreatorFields?: boolean; + comment?: string; + version?: string; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/components': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + category: string; + apiId: string; + schema: { + displayName: string; + description: string; + icon?: string; + connection?: string; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/components_by_uid': { + parameters: { + query?: never; + header?: never; + path: { + uid: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + category: string; + apiId: string; + schema: { + displayName: string; + description: string; + icon?: string; + connection?: string; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/post': { + parameters: { + query?: { + id?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': + | { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + } + | { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/get/files': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + sort?: + | string + | string[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/get/files_by_id': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path: { + id: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/delete/files_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'i18n/get/locales': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + code: string; + createdAt: string; + updatedAt: string; + publishedAt: string | null; + isDefault: boolean; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/connect_____': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_local': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + identifier: string; + password: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_local_register': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username: string; + /** Format: email */ + email: string; + password: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': + | { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + } + | { + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/auth_by_provider_callback': { + parameters: { + query?: never; + header?: never; + path: { + provider: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_forgot_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + /** Format: email */ + email: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_reset_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + code: string; + password: string; + passwordConfirmation: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/auth_email_confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_send_email_confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + /** Format: email */ + email: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + email: string; + sent: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_change_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + currentPassword: string; + password: string; + passwordConfirmation: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_refresh': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_logout': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_count': { + parameters: { + query?: { + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': number; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + sort?: + | string + | string[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/users': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username: string; + /** Format: email */ + email: string; + password: string; + role?: number; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_me': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_by_id': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/put/users_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username?: string; + /** Format: email */ + email?: string; + password?: string; + role?: number; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/delete/users_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/roles_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + role: { + id: number; + documentId: string; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + publishedAt: string; + nb_users?: number; + permissions?: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + users?: unknown[]; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + roles: { + id: number; + documentId: string; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + publishedAt: string; + nb_users?: number; + permissions?: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + users?: unknown[]; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + name: string; + description?: string; + type: string; + permissions?: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/put/roles_by_role': { + parameters: { + query?: never; + header?: never; + path: { + role: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + name?: string; + description?: string; + type?: string; + permissions?: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/delete/roles_by_role': { + parameters: { + query?: never; + header?: never; + path: { + role: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/permissions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + permissions: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; +} + +export function createClient(config: Config) { + return strapi(config); +} +export default createClient; diff --git a/demo/node-typescript-test-typings/src/strapi-client/specification.json b/demo/node-typescript-test-typings/src/strapi-client/specification.json new file mode 100644 index 0000000..c3ac431 --- /dev/null +++ b/demo/node-typescript-test-typings/src/strapi-client/specification.json @@ -0,0 +1,6694 @@ +{ + "openapi": "3.1.0", + "x-powered-by": "strapi", + "x-strapi-version": "5.37.1", + "info": { + "title": "kitchensink-ts", + "description": "API documentation for kitchensink-ts v0.0.0", + "version": "0.0.0" + }, + "paths": { + "/tests": { + "get": { + "operationId": "test/get/tests", + "parameters": [ + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones", + "readOnly": true, + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filters to apply to the query", + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "_q", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "pagination", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Pagination parameters", + "allOf": [ + { + "type": "object", + "properties": { + "withCount": { + "description": "Include total count in response", + "type": "boolean" + } + }, + "additionalProperties": false + }, + { + "anyOf": [ + { + "description": "Page-based pagination", + "type": "object", + "properties": { + "page": { + "description": "Page number (1-based)", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "pageSize": { + "description": "Number of entries per page", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["page", "pageSize"], + "additionalProperties": false + }, + { + "description": "Offset-based pagination", + "type": "object", + "properties": { + "start": { + "description": "Number of entries to skip", + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "limit": { + "description": "Maximum number of entries to return", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["start", "limit"], + "additionalProperties": false + } + ] + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Sort the result", + "anyOf": [ + { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + { + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + { + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "type": "array", + "items": { + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "description": "Populate all the first level relations, components, files, and dynamic zones for the entry", + "readOnly": true, + "type": "string", + "const": "*" + }, + { + "description": "Populate a single relation, component, file, or dynamic zone", + "readOnly": true, + "type": "string", + "enum": ["others"] + }, + { + "description": "Populate a selection of multiple relations, components, files, or dynamic zones", + "type": "array", + "items": { + "type": "string", + "enum": ["others"] + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Fetch documents based on their status. Default to \"published\" if not specified.", + "type": "string", + "enum": ["draft", "published"] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "hasPublishedVersion", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["true", "false"] + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "documentId": { + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "test": { + "description": "A string field", + "type": "string" + }, + "createdAt": { + "description": "A datetime field", + "type": "string" + }, + "updatedAt": { + "description": "A datetime field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.245Z", + "type": "string" + }, + "others": {} + }, + "required": ["documentId", "id", "test", "publishedAt", "others"], + "additionalProperties": false + } + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["test"] + }, + "post": { + "operationId": "test/post/tests", + "parameters": [ + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones", + "readOnly": true, + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "description": "Populate all the first level relations, components, files, and dynamic zones for the entry", + "readOnly": true, + "type": "string", + "const": "*" + }, + { + "description": "Populate a single relation, component, file, or dynamic zone", + "readOnly": true, + "type": "string", + "enum": ["others"] + }, + { + "description": "Populate a selection of multiple relations, components, files, or dynamic zones", + "type": "array", + "items": { + "type": "string", + "enum": ["others"] + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Fetch documents based on their status. Default to \"published\" if not specified.", + "type": "string", + "enum": ["draft", "published"] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "hasPublishedVersion", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["true", "false"] + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "documentId": { + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "test": { + "description": "A string field", + "type": "string" + }, + "createdAt": { + "description": "A datetime field", + "type": "string" + }, + "updatedAt": { + "description": "A datetime field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.256Z", + "type": "string" + }, + "others": {} + }, + "required": ["documentId", "id", "test", "publishedAt", "others"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["test"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "test": { + "description": "A string field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.255Z", + "type": "string" + }, + "others": { + "description": "A relational field", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + } + }, + "required": ["test", "publishedAt"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + } + } + }, + "/tests/{id}": { + "get": { + "operationId": "test/get/tests_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + } + }, + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones", + "readOnly": true, + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "description": "Populate all the first level relations, components, files, and dynamic zones for the entry", + "readOnly": true, + "type": "string", + "const": "*" + }, + { + "description": "Populate a single relation, component, file, or dynamic zone", + "readOnly": true, + "type": "string", + "enum": ["others"] + }, + { + "description": "Populate a selection of multiple relations, components, files, or dynamic zones", + "type": "array", + "items": { + "type": "string", + "enum": ["others"] + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filters to apply to the query", + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Sort the result", + "anyOf": [ + { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + { + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + { + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "type": "array", + "items": { + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Fetch documents based on their status. Default to \"published\" if not specified.", + "type": "string", + "enum": ["draft", "published"] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "hasPublishedVersion", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["true", "false"] + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "documentId": { + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "test": { + "description": "A string field", + "type": "string" + }, + "createdAt": { + "description": "A datetime field", + "type": "string" + }, + "updatedAt": { + "description": "A datetime field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.251Z", + "type": "string" + }, + "others": {} + }, + "required": ["documentId", "id", "test", "publishedAt", "others"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["test"] + }, + "put": { + "operationId": "test/put/tests_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + } + }, + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones", + "readOnly": true, + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "description": "Populate all the first level relations, components, files, and dynamic zones for the entry", + "readOnly": true, + "type": "string", + "const": "*" + }, + { + "description": "Populate a single relation, component, file, or dynamic zone", + "readOnly": true, + "type": "string", + "enum": ["others"] + }, + { + "description": "Populate a selection of multiple relations, components, files, or dynamic zones", + "type": "array", + "items": { + "type": "string", + "enum": ["others"] + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Fetch documents based on their status. Default to \"published\" if not specified.", + "type": "string", + "enum": ["draft", "published"] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "hasPublishedVersion", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["true", "false"] + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "documentId": { + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "test": { + "description": "A string field", + "type": "string" + }, + "createdAt": { + "description": "A datetime field", + "type": "string" + }, + "updatedAt": { + "description": "A datetime field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.260Z", + "type": "string" + }, + "others": {} + }, + "required": ["documentId", "id", "test", "publishedAt", "others"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["test"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "test": { + "description": "A string field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.259Z", + "type": "string" + }, + "others": { + "description": "A relational field", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + } + }, + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + } + }, + "delete": { + "operationId": "test/delete/tests_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + } + }, + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "The fields to return, this doesn't include populatable fields like relations, components, files, or dynamic zones", + "readOnly": true, + "type": "array", + "items": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + } + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "description": "Populate all the first level relations, components, files, and dynamic zones for the entry", + "readOnly": true, + "type": "string", + "const": "*" + }, + { + "description": "Populate a single relation, component, file, or dynamic zone", + "readOnly": true, + "type": "string", + "enum": ["others"] + }, + { + "description": "Populate a selection of multiple relations, components, files, or dynamic zones", + "type": "array", + "items": { + "type": "string", + "enum": ["others"] + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filters to apply to the query", + "type": "object", + "propertyNames": { + "type": "string", + "enum": ["test", "createdAt", "updatedAt", "publishedAt"] + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Fetch documents based on their status. Default to \"published\" if not specified.", + "type": "string", + "enum": ["draft", "published"] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "hasPublishedVersion", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Filter documents by whether they have a published version. Use with status=draft to find documents that have never been published", + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["true", "false"] + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "documentId": { + "description": "The document ID, represented by a UUID", + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "test": { + "description": "A string field", + "type": "string" + }, + "createdAt": { + "description": "A datetime field", + "type": "string" + }, + "updatedAt": { + "description": "A datetime field", + "type": "string" + }, + "publishedAt": { + "description": "A datetime field", + "default": "2026-03-01T18:13:17.263Z", + "type": "string" + }, + "others": {} + }, + "required": ["documentId", "id", "test", "publishedAt", "others"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["test"] + } + }, + "/content-types": { + "get": { + "operationId": "content-type-builder/get/content_types", + "parameters": [ + { + "name": "kind", + "in": "query", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "enum": ["collectionType", "singleType"] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "plugin": { + "type": "string" + }, + "apiID": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "singularName": { + "type": "string" + }, + "pluralName": { + "type": "string" + }, + "description": { + "type": "string" + }, + "draftAndPublish": { + "type": "boolean" + }, + "kind": { + "type": "string", + "enum": ["collectionType", "singleType"] + }, + "collectionName": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "media" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "multiple": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "allowedTypes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type", "multiple"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "relation" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "relation": { + "type": "string" + }, + "target": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "targetAttribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "autoPopulate": { + "type": "boolean" + }, + "mappedBy": { + "type": "string" + }, + "inversedBy": { + "type": "string" + } + }, + "required": ["type", "relation", "target", "targetAttribute"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "component" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "component": { + "type": "string" + }, + "repeatable": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "component", "repeatable"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dynamiczone" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "components": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + } + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "components"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uid" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "targetField": { + "type": "string" + } + }, + "required": ["type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "unique": { + "type": "boolean" + }, + "default": {}, + "min": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "max": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "minLength": { + "type": "number" + }, + "maxLength": { + "type": "number" + }, + "enum": { + "type": "array", + "items": { + "type": "string" + } + }, + "regex": { + "type": "string" + }, + "private": { + "type": "boolean" + }, + "configurable": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type"], + "additionalProperties": false + } + ] + } + }, + "visible": { + "type": "boolean" + }, + "restrictRelationsTo": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "reviewWorkflows": { + "type": "boolean" + }, + "populateCreatorFields": { + "type": "boolean" + }, + "comment": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "displayName", + "singularName", + "pluralName", + "description", + "draftAndPublish", + "kind", + "attributes", + "visible", + "restrictRelationsTo" + ], + "additionalProperties": false + } + }, + "required": ["uid", "apiID", "schema"], + "additionalProperties": false + } + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["content-type-builder"] + } + }, + "/content-types/{uid}": { + "get": { + "operationId": "content-type-builder/get/content_types_by_uid", + "parameters": [ + { + "name": "uid", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "plugin": { + "type": "string" + }, + "apiID": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "singularName": { + "type": "string" + }, + "pluralName": { + "type": "string" + }, + "description": { + "type": "string" + }, + "draftAndPublish": { + "type": "boolean" + }, + "kind": { + "type": "string", + "enum": ["collectionType", "singleType"] + }, + "collectionName": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "media" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "multiple": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "allowedTypes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type", "multiple"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "relation" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "relation": { + "type": "string" + }, + "target": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "targetAttribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "autoPopulate": { + "type": "boolean" + }, + "mappedBy": { + "type": "string" + }, + "inversedBy": { + "type": "string" + } + }, + "required": ["type", "relation", "target", "targetAttribute"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "component" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "component": { + "type": "string" + }, + "repeatable": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "component", "repeatable"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dynamiczone" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "components": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + } + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "components"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uid" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "targetField": { + "type": "string" + } + }, + "required": ["type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "unique": { + "type": "boolean" + }, + "default": {}, + "min": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "max": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "minLength": { + "type": "number" + }, + "maxLength": { + "type": "number" + }, + "enum": { + "type": "array", + "items": { + "type": "string" + } + }, + "regex": { + "type": "string" + }, + "private": { + "type": "boolean" + }, + "configurable": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type"], + "additionalProperties": false + } + ] + } + }, + "visible": { + "type": "boolean" + }, + "restrictRelationsTo": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "reviewWorkflows": { + "type": "boolean" + }, + "populateCreatorFields": { + "type": "boolean" + }, + "comment": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "displayName", + "singularName", + "pluralName", + "description", + "draftAndPublish", + "kind", + "attributes", + "visible", + "restrictRelationsTo" + ], + "additionalProperties": false + } + }, + "required": ["uid", "apiID", "schema"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["content-type-builder"] + } + }, + "/components": { + "get": { + "operationId": "content-type-builder/get/components", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + }, + "category": { + "type": "string" + }, + "apiId": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "connection": { + "type": "string" + }, + "collectionName": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "media" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "multiple": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "allowedTypes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type", "multiple"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "relation" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "relation": { + "type": "string" + }, + "target": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "targetAttribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "autoPopulate": { + "type": "boolean" + }, + "mappedBy": { + "type": "string" + }, + "inversedBy": { + "type": "string" + } + }, + "required": ["type", "relation", "target", "targetAttribute"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "component" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "component": { + "type": "string" + }, + "repeatable": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "component", "repeatable"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dynamiczone" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "components": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + } + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "components"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uid" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "targetField": { + "type": "string" + } + }, + "required": ["type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "unique": { + "type": "boolean" + }, + "default": {}, + "min": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "max": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "minLength": { + "type": "number" + }, + "maxLength": { + "type": "number" + }, + "enum": { + "type": "array", + "items": { + "type": "string" + } + }, + "regex": { + "type": "string" + }, + "private": { + "type": "boolean" + }, + "configurable": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type"], + "additionalProperties": false + } + ] + } + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["displayName", "description", "attributes"], + "additionalProperties": false + } + }, + "required": ["uid", "category", "apiId", "schema"], + "additionalProperties": false + } + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["content-type-builder"] + } + }, + "/components/{uid}": { + "get": { + "operationId": "content-type-builder/get/components_by_uid", + "parameters": [ + { + "name": "uid", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + }, + "category": { + "type": "string" + }, + "apiId": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "connection": { + "type": "string" + }, + "collectionName": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "media" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "multiple": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "allowedTypes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["type", "multiple"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "relation" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "relation": { + "type": "string" + }, + "target": { + "type": "string", + "pattern": "^((strapi|admin)::[\\w-]+|(api|plugin)::[\\w-]+\\.[\\w-]+)$" + }, + "targetAttribute": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "autoPopulate": { + "type": "boolean" + }, + "mappedBy": { + "type": "string" + }, + "inversedBy": { + "type": "string" + } + }, + "required": ["type", "relation", "target", "targetAttribute"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "component" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "component": { + "type": "string" + }, + "repeatable": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "component", "repeatable"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dynamiczone" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "components": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[\\w-]+\\.[\\w-]+$" + } + }, + "required": { + "type": "boolean" + }, + "min": { + "type": "number" + }, + "max": { + "type": "number" + } + }, + "required": ["type", "components"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "uid" + }, + "configurable": { + "type": "boolean", + "const": false + }, + "private": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "targetField": { + "type": "string" + } + }, + "required": ["type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "unique": { + "type": "boolean" + }, + "default": {}, + "min": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "max": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "minLength": { + "type": "number" + }, + "maxLength": { + "type": "number" + }, + "enum": { + "type": "array", + "items": { + "type": "string" + } + }, + "regex": { + "type": "string" + }, + "private": { + "type": "boolean" + }, + "configurable": { + "type": "boolean" + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type"], + "additionalProperties": false + } + ] + } + }, + "pluginOptions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["displayName", "description", "attributes"], + "additionalProperties": false + } + }, + "required": ["uid", "category", "apiId", "schema"], + "additionalProperties": false + } + }, + "required": ["data"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["content-type-builder"] + } + }, + "/": { + "post": { + "operationId": "upload/post", + "parameters": [ + { + "name": "id", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "alternativeText": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "caption": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "width": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "height": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "formats": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "hash": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "mime": { + "type": "string" + }, + "size": { + "type": "number" + }, + "url": { + "type": "string" + }, + "previewUrl": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "folder": { + "type": "number" + }, + "folderPath": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "provider_metadata": { + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "number" + }, + "updatedBy": { + "type": "number" + } + }, + "required": [ + "id", + "documentId", + "name", + "hash", + "mime", + "size", + "url", + "folderPath", + "provider", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "alternativeText": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "caption": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "width": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "height": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "formats": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "hash": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "mime": { + "type": "string" + }, + "size": { + "type": "number" + }, + "url": { + "type": "string" + }, + "previewUrl": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "folder": { + "type": "number" + }, + "folderPath": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "provider_metadata": { + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "number" + }, + "updatedBy": { + "type": "number" + } + }, + "required": [ + "id", + "documentId", + "name", + "hash", + "mime", + "size", + "url", + "folderPath", + "provider", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + } + ] + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["upload"] + } + }, + "/files": { + "get": { + "operationId": "upload/get/files", + "parameters": [ + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Select specific fields to return in the response", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Specify which relations to populate in the response", + "anyOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Sort the results by specified fields", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "type": "array", + "items": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "pagination", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Pagination parameters", + "allOf": [ + { + "type": "object", + "properties": { + "withCount": { + "description": "Include total count in response", + "type": "boolean" + } + }, + "additionalProperties": false + }, + { + "anyOf": [ + { + "description": "Page-based pagination", + "type": "object", + "properties": { + "page": { + "description": "Page number (1-based)", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "pageSize": { + "description": "Number of entries per page", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["page", "pageSize"], + "additionalProperties": false + }, + { + "description": "Offset-based pagination", + "type": "object", + "properties": { + "start": { + "description": "Number of entries to skip", + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "limit": { + "description": "Maximum number of entries to return", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["start", "limit"], + "additionalProperties": false + } + ] + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Apply filters to the query", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "alternativeText": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "caption": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "width": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "height": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "formats": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "hash": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "mime": { + "type": "string" + }, + "size": { + "type": "number" + }, + "url": { + "type": "string" + }, + "previewUrl": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "folder": { + "type": "number" + }, + "folderPath": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "provider_metadata": { + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "number" + }, + "updatedBy": { + "type": "number" + } + }, + "required": [ + "id", + "documentId", + "name", + "hash", + "mime", + "size", + "url", + "folderPath", + "provider", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["upload"] + } + }, + "/files/{id}": { + "get": { + "operationId": "upload/get/files_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Select specific fields to return in the response", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Specify which relations to populate in the response", + "anyOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "alternativeText": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "caption": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "width": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "height": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "formats": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "hash": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "mime": { + "type": "string" + }, + "size": { + "type": "number" + }, + "url": { + "type": "string" + }, + "previewUrl": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "folder": { + "type": "number" + }, + "folderPath": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "provider_metadata": { + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "number" + }, + "updatedBy": { + "type": "number" + } + }, + "required": [ + "id", + "documentId", + "name", + "hash", + "mime", + "size", + "url", + "folderPath", + "provider", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["upload"] + }, + "delete": { + "operationId": "upload/delete/files_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "alternativeText": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "caption": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "width": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "height": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "formats": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "hash": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "mime": { + "type": "string" + }, + "size": { + "type": "number" + }, + "url": { + "type": "string" + }, + "previewUrl": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "folder": { + "type": "number" + }, + "folderPath": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "provider_metadata": { + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "number" + }, + "updatedBy": { + "type": "number" + } + }, + "required": [ + "id", + "documentId", + "name", + "hash", + "mime", + "size", + "url", + "folderPath", + "provider", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["upload"] + } + }, + "/locales": { + "get": { + "operationId": "i18n/get/locales", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "documentId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$" + }, + "name": { + "type": "string" + }, + "code": { + "type": "string", + "minLength": 2, + "maxLength": 2 + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "isDefault": { + "type": "boolean" + } + }, + "required": [ + "id", + "documentId", + "name", + "code", + "createdAt", + "updatedAt", + "publishedAt", + "isDefault" + ], + "additionalProperties": false + } + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["i18n"] + } + }, + "/connect/(.*)": { + "get": { + "operationId": "users-permissions/get/connect_____", + "parameters": [], + "responses": { + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/auth/local": { + "post": { + "operationId": "users-permissions/post/auth_local", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "jwt": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["jwt", "user"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "identifier": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": ["identifier", "password"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/local/register": { + "post": { + "operationId": "users-permissions/post/auth_local_register", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "jwt": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["jwt", "user"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["user"], + "additionalProperties": false + } + ] + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "password": { + "type": "string" + } + }, + "required": ["username", "email", "password"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/{provider}/callback": { + "get": { + "operationId": "users-permissions/get/auth_by_provider_callback", + "parameters": [ + { + "name": "provider", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "jwt": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["jwt", "user"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/auth/forgot-password": { + "post": { + "operationId": "users-permissions/post/auth_forgot_password", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": ["ok"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": ["email"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/reset-password": { + "post": { + "operationId": "users-permissions/post/auth_reset_password", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "jwt": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["jwt", "user"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "password": { + "type": "string" + }, + "passwordConfirmation": { + "type": "string" + } + }, + "required": ["code", "password", "passwordConfirmation"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/email-confirmation": { + "get": { + "operationId": "users-permissions/get/auth_email_confirmation", + "parameters": [], + "responses": { + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/auth/send-email-confirmation": { + "post": { + "operationId": "users-permissions/post/auth_send_email_confirmation", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "sent": { + "type": "boolean" + } + }, + "required": ["email", "sent"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": ["email"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/change-password": { + "post": { + "operationId": "users-permissions/post/auth_change_password", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "jwt": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["jwt", "user"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "currentPassword": { + "type": "string" + }, + "password": { + "type": "string" + }, + "passwordConfirmation": { + "type": "string" + } + }, + "required": ["currentPassword", "password", "passwordConfirmation"], + "additionalProperties": false + } + } + } + } + } + }, + "/auth/refresh": { + "post": { + "operationId": "users-permissions/post/auth_refresh", + "parameters": [], + "responses": { + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/auth/logout": { + "post": { + "operationId": "users-permissions/post/auth_logout", + "parameters": [], + "responses": { + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/users/count": { + "get": { + "operationId": "users-permissions/get/users_count", + "parameters": [ + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Apply filters to the query", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "number" + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/users": { + "get": { + "operationId": "users-permissions/get/users", + "parameters": [ + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Select specific fields to return in the response", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Specify which relations to populate in the response", + "anyOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Sort the results by specified fields", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "type": "array", + "items": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string", + "enum": ["asc", "desc"] + } + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "pagination", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Pagination parameters", + "allOf": [ + { + "type": "object", + "properties": { + "withCount": { + "description": "Include total count in response", + "type": "boolean" + } + }, + "additionalProperties": false + }, + { + "anyOf": [ + { + "description": "Page-based pagination", + "type": "object", + "properties": { + "page": { + "description": "Page number (1-based)", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "pageSize": { + "description": "Number of entries per page", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["page", "pageSize"], + "additionalProperties": false + }, + { + "description": "Offset-based pagination", + "type": "object", + "properties": { + "start": { + "description": "Number of entries to skip", + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "limit": { + "description": "Maximum number of entries to return", + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["start", "limit"], + "additionalProperties": false + } + ] + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Apply filters to the query", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + }, + "post": { + "operationId": "users-permissions/post/users", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "password": { + "type": "string" + }, + "role": { + "type": "number" + } + }, + "required": ["username", "email", "password"], + "additionalProperties": false + } + } + } + } + } + }, + "/users/me": { + "get": { + "operationId": "users-permissions/get/users_me", + "parameters": [ + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Select specific fields to return in the response", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Specify which relations to populate in the response", + "anyOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/users/{id}": { + "get": { + "operationId": "users-permissions/get/users_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + }, + { + "name": "fields", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Select specific fields to return in the response", + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "x-strapi-serialize": "querystring" + }, + { + "name": "populate", + "in": "query", + "required": false, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Specify which relations to populate in the response", + "anyOf": [ + { + "type": "string", + "const": "*" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + ] + }, + "x-strapi-serialize": "querystring" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + }, + "put": { + "operationId": "users-permissions/put/users_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "password": { + "type": "string" + }, + "role": { + "type": "number" + } + }, + "additionalProperties": false + } + } + } + } + }, + "delete": { + "operationId": "users-permissions/delete/users_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "confirmed": { + "type": "boolean" + }, + "blocked": { + "type": "boolean" + }, + "role": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "type", + "createdAt", + "updatedAt" + ], + "additionalProperties": false + } + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "documentId", + "username", + "email", + "provider", + "confirmed", + "blocked", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/roles/{id}": { + "get": { + "operationId": "users-permissions/get/roles_by_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "role": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + }, + "nb_users": { + "type": "number" + }, + "permissions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "controllers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "policy": { + "type": "string" + } + }, + "required": ["enabled", "policy"], + "additionalProperties": false + } + } + } + }, + "required": ["controllers"], + "additionalProperties": false + } + }, + "users": { + "type": "array", + "items": {} + } + }, + "required": [ + "id", + "documentId", + "name", + "description", + "type", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + }, + "required": ["role"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/roles": { + "get": { + "operationId": "users-permissions/get/roles", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "publishedAt": { + "type": "string" + }, + "nb_users": { + "type": "number" + }, + "permissions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "controllers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "policy": { + "type": "string" + } + }, + "required": ["enabled", "policy"], + "additionalProperties": false + } + } + } + }, + "required": ["controllers"], + "additionalProperties": false + } + }, + "users": { + "type": "array", + "items": {} + } + }, + "required": [ + "id", + "documentId", + "name", + "description", + "type", + "createdAt", + "updatedAt", + "publishedAt" + ], + "additionalProperties": false + } + } + }, + "required": ["roles"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + }, + "post": { + "operationId": "users-permissions/post/roles", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": ["ok"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "permissions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["name", "type"], + "additionalProperties": false + } + } + } + } + } + }, + "/roles/{role}": { + "put": { + "operationId": "users-permissions/put/roles_by_role", + "parameters": [ + { + "name": "role", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": ["ok"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "permissions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "additionalProperties": false + } + } + } + } + }, + "delete": { + "operationId": "users-permissions/delete/roles_by_role", + "parameters": [ + { + "name": "role", + "in": "path", + "required": true, + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": ["ok"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + }, + "/permissions": { + "get": { + "operationId": "users-permissions/get/permissions", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "permissions": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "controllers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "policy": { + "type": "string" + } + }, + "required": ["enabled", "policy"], + "additionalProperties": false + } + } + } + }, + "required": ["controllers"], + "additionalProperties": false + } + } + }, + "required": ["permissions"], + "additionalProperties": false + } + } + } + }, + "400": { + "description": "Bad request" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not found" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["users-permissions"] + } + } + }, + "components": { + "schemas": {} + } +} diff --git a/demo/node-typescript-test-typings/strapi-client.config.json b/demo/node-typescript-test-typings/strapi-client.config.json new file mode 100644 index 0000000..c8905ee --- /dev/null +++ b/demo/node-typescript-test-typings/strapi-client.config.json @@ -0,0 +1,4 @@ +{ + "strapiPath": "../../../strapi/examples/kitchensink-ts/", + "output": "src/strapi-client/" +} diff --git a/demo/node-typescript-test-typings/tsconfig.json b/demo/node-typescript-test-typings/tsconfig.json new file mode 100644 index 0000000..dcaa1fc --- /dev/null +++ b/demo/node-typescript-test-typings/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + /* Language and Environment */ + "allowSyntheticDefaultImports": true, + + /* Modules */ + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "module": "nodenext", + + /* Emit */ + "moduleResolution": "NodeNext", + + /* Interop Constraints */ + + "outDir": "./dist", + "rootDir": "./src", + "skipLibCheck": false, + + /* Type Checking */ + "strict": true, + + /* Completeness */ + "target": "ESNext" + } +} From 7dee67514946bf78c067862a10f6cea0c66c4ec9 Mon Sep 17 00:00:00 2001 From: Jan Sobotta Date: Mon, 2 Mar 2026 14:43:32 +0100 Subject: [PATCH 3/4] feat: added typed client fetch params --- src/client.ts | 76 +++++++++++++-- src/exports.ts | 3 +- src/index.ts | 4 +- src/types/client.ts | 227 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 301 insertions(+), 9 deletions(-) create mode 100644 src/types/client.ts diff --git a/src/client.ts b/src/client.ts index 3dfabc0..9585b32 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,4 +1,5 @@ import createDebug from 'debug'; +import qs from 'qs'; import { AuthManager } from './auth'; import { @@ -11,6 +12,12 @@ import { StrapiError, StrapiInitializationError } from './errors'; import { FilesManager } from './files'; import { HttpClient } from './http'; import { AuthInterceptors, HttpInterceptors } from './interceptors'; +import { + ContentTypeNames, + GetPaths, + StaticParameters, + StrapiRequestInitPathGate, +} from './types/client'; import { StrapiConfigValidator } from './validators'; import type { UsersPermissionsUsersIdOverloads } from './content-types'; @@ -51,7 +58,7 @@ export interface AuthConfig { * It serves as the main interface through which users interact with * their Strapi installation programmatically. */ -export class StrapiClient { +export class StrapiClient { /** @internal */ private readonly _config: StrapiClientConfig; @@ -303,8 +310,65 @@ export class StrapiClient { * - The method automatically handles authentication by checking if the user is authenticated and attempts to authenticate if not. * - The base URL is prepended to the provided endpoint path. */ - fetch(url: string, init?: RequestInit) { - return this._httpClient.request(url, init); + fetch>(url: T, init?: StrapiRequestInitPathGate) { + // build request init + let requestInit = undefined; + let stringURL = url as string; + if (init) { + // extract body information + const body = init?.body; + delete init?.body; + + const parameters = init?.parameters as StaticParameters | undefined; + delete init?.parameters; + + // prepare body + let requestBody = undefined; + let headers = undefined; + // ReadableStream | Blob | BufferSource | FormData | URLSearchParams | string MISSING: ArrayBufferView + if ( + body && + typeof body === 'object' && + !(body instanceof ReadableStream) && + !(body instanceof Blob) && + !(body instanceof ArrayBuffer) && + !(body instanceof FormData) && + !(body instanceof URLSearchParams) + ) { + // If the body is an object (but not FormData), stringify it and set the content type to JSON + requestBody = body ? JSON.stringify(body) : undefined; + headers = { + ...init?.headers, + 'Content-Type': 'application/json', + }; + } else { + // For other body types (like string), use them directly without modification + requestBody = body; + headers = { + ...init?.headers, + }; + } + delete init?.headers; + + // build url + // apply path parameters to the URL + if (parameters?.path) { + Object.entries(parameters.path).forEach(([key, value]) => { + stringURL = stringURL.replace(`{${key}}`, encodeURIComponent(String(value))); + }); + } + // apply query parameters to the URL + if (parameters?.query) { + const queryString = qs.stringify(parameters.query, { arrayFormat: 'brackets' }); + stringURL += `?${queryString}`; + } + requestInit = { + ...init, + body: requestBody, + headers, + }; + } + return this._httpClient.request(stringURL, requestInit); } /** @@ -365,10 +429,10 @@ export class StrapiClient { * @see CollectionTypeManager * @see StrapiClient */ - collection( - resource: T, + collection>( + resource: ContentTypeName, options: ClientCollectionOptions = {} - ): T extends 'users' + ): ContentTypeName extends 'users' ? UsersPermissionsUsersManager & UsersPermissionsUsersIdOverloads : CollectionTypeManager { const { path, plugin } = options; diff --git a/src/exports.ts b/src/exports.ts index e2a3f0d..dcfc7cc 100644 --- a/src/exports.ts +++ b/src/exports.ts @@ -24,6 +24,7 @@ export type { StrapiClientConfig, StrapiClient } from './client'; export type { CollectionTypeManager, SingleTypeManager } from './content-types'; export type { FilesManager, FileQueryParams, FileResponse, FileListResponse } from './files'; export type * as API from './types/content-api'; +export type * as CLIENT from './types/client'; // ############################ // # Deprecated symbols # @@ -38,4 +39,4 @@ export type StrapiConfig = StrapiClientConfig; /** * @deprecated This type will be removed in v2, consider using {@link StrapiClient} as a replacement */ -export type Strapi = StrapiClient; +export type Strapi = StrapiClient; diff --git a/src/index.ts b/src/index.ts index 7017231..c09f466 100644 --- a/src/index.ts +++ b/src/index.ts @@ -88,7 +88,7 @@ export interface Config { * @throws {StrapiInitializationError} If the provided baseURL doesn't conform to a valid HTTP or HTTPS URL, * or if the auth configuration is invalid. */ -export const strapi = (config: Config) => { +export const strapi = (config: Config) => { const { baseURL, auth, headers } = config; const clientConfig: StrapiClientConfig = { baseURL, headers }; @@ -103,5 +103,5 @@ export const strapi = (config: Config) => { }; } - return new StrapiClient(clientConfig); + return new StrapiClient(clientConfig); }; diff --git a/src/types/client.ts b/src/types/client.ts new file mode 100644 index 0000000..66fe078 --- /dev/null +++ b/src/types/client.ts @@ -0,0 +1,227 @@ +type RequiredKeys = T extends object + ? { [K in keyof T]-?: {} extends Pick ? never : K }[keyof T] + : never; +type HasRequiredKeys = [T] extends [never] + ? false + : RequiredKeys extends never + ? false + : true; + +export type IfAny = 0 extends 1 & T ? Y : N; +export type IsAny = IfAny; + +export type SystemPaths = + | 'content-types' + | 'components' + | 'plugins' + | 'content-types' + | 'files' + | 'locales' + | 'permissions' + | 'roles'; + +export type StaticParameters = { + query?: any; + header?: any; + path?: any; + cookie?: any; +}; + +export type IsUndefinedOrNever = T extends never ? true : T extends undefined ? true : false; + +export type PathHasHandler< + Paths, + Path extends keyof Paths, + Handler extends SystemPathHandlers, +> = Handler extends keyof Paths[Path] + ? IsUndefinedOrNever extends true + ? false + : true + : false; + +export type GetAllHandlersNames = { + [K in keyof Paths & string]: PathHasHandler extends false ? never : K; +}[keyof Paths & string]; + +export type IsPathContentType = Path extends string + ? PathHasHandler extends true + ? PathHasHandler extends true + ? `${Path}/{id}` extends keyof Paths + ? PathHasHandler extends true + ? PathHasHandler extends true + ? PathHasHandler extends true + ? true + : false + : false + : false + : false + : false + : false + : false; + +export type GetAllContentTypeNames = { + [K in keyof Paths & string]: K extends `/${infer Name}` + ? IsPathContentType extends true + ? Name + : never + : never; +}[keyof Paths & string]; + +export type GetPaths = { + [Path in keyof Paths & string]: Path extends string ? Path : never; +}[keyof Paths & string]; + +export type AssignIfNotNever = [T] extends [never] ? U : S; + +export type ContentTypeNames = AssignIfNotNever< + Paths, + string, + GetAllContentTypeNames +>; + +export type GetRouteHandler< + Paths, + Path extends GetPaths, + Method extends SystemPathHandlers, +> = Method extends keyof Paths[Path] + ? PathHasHandler extends true + ? Paths[Path][Method] + : never + : never; + +export type IfIsKeyOf = Key extends keyof Target ? Target[Key] : never; + +export type SystemPathHandlers = + | 'get' + | 'put' + | 'post' + | 'delete' + | 'options' + | 'head' + | 'patch' + | 'trace'; + +export type StrapiRequestInitVariableParameters< + Paths, + Path extends GetPaths, + Method extends SystemPathHandlers, +> = [GetRouteHandler] extends [never] + ? BodyInit | null + : IfIsKeyOf, 'parameters'>; + +export type StrapiRequestInitVariable< + Paths, + Path extends GetPaths, + Method extends SystemPathHandlers, +> = [GetRouteHandler] extends [never] + ? { + /** A BodyInit object or null to set request's body. */ + body?: BodyInit | null; + method?: Method; + parameters?: StrapiRequestInitVariableParameters; + } + : { + /** A BodyInit object or null to set request's body. */ + body?: AssignIfNotNever< + ExtractBodyContentType, 'requestBody'>>, + BodyInit | null, + ExtractBodyContentType, 'requestBody'>> + >; + method?: Method; + } & (HasRequiredKeys, 'parameters'>> extends true + ? { parameters: StrapiRequestInitVariableParameters } + : { parameters?: StrapiRequestInitVariableParameters }); + +export interface StrapiRequestInitRest { + /** A string indicating how the request will interact with the browser's cache to set request's cache. */ + cache?: RequestCache; + /** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */ + credentials?: RequestCredentials; + /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ + headers?: HeadersInit; + /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ + integrity?: string; + /** A boolean to set request's keepalive. */ + keepalive?: boolean; + /** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */ + mode?: RequestMode; + priority?: RequestPriority; + /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */ + redirect?: RequestRedirect; + /** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */ + referrer?: string; + /** A referrer policy to set request's referrerPolicy. */ + referrerPolicy?: ReferrerPolicy; + /** An AbortSignal to set request's signal. */ + signal?: AbortSignal | null; + /** Can only be null. Used to disassociate request from any Window. */ + window?: null; +} + +export type ExtractBodyContentType = Body extends { content: infer Content } + ? ExtractContentType + : never; + +export type ExtractContentType = Content extends { 'application/json': infer Json } + ? Json + : never; + +export type IfPathHasHandler< + Paths, + Path extends GetPaths, + Handler extends SystemPathHandlers, + True, + False, +> = PathHasHandler extends true ? True : False; + +export type StrapiRequestInitMethod< + Paths, + Path extends GetPaths, + Handler extends SystemPathHandlers, +> = IfPathHasHandler< + Paths, + Path, + Handler, + StrapiRequestInitVariable & StrapiRequestInitRest, + never +>; + +export type StrapiRequestInit> = + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod + | StrapiRequestInitMethod; + +export type StrapiRequestInitPathGate> = AssignIfNotNever< + Paths, + any, + StrapiRequestInit +>; + +/* +parameters: { + query?: { + fields?: ("test" | "createdAt" | "updatedAt" | "publishedAt")[]; + populate?: "*" | "others" | "others"[]; + filters?: { + [key: string]: unknown; + }; + sort?: ("test" | "createdAt" | "updatedAt" | "publishedAt") | ("test" | "createdAt" | "updatedAt" | "publishedAt")[] | { + [key: string]: "asc" | "desc"; + } | { + [key: string]: "asc" | "desc"; + }[]; + status?: "draft" | "published"; + hasPublishedVersion?: boolean | ("true" | "false"); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; +*/ From 97749e4f352b5a675993880f63831a0695aefe20 Mon Sep 17 00:00:00 2001 From: Jan Sobotta Date: Mon, 2 Mar 2026 14:44:31 +0100 Subject: [PATCH 4/4] test: add typed client tests --- tests/fixtures/test-typed-client.ts | 3924 +++++++++++++++++++++++++++ tests/unit/client.types.test.ts | 274 ++ 2 files changed, 4198 insertions(+) create mode 100644 tests/fixtures/test-typed-client.ts create mode 100644 tests/unit/client.types.test.ts diff --git a/tests/fixtures/test-typed-client.ts b/tests/fixtures/test-typed-client.ts new file mode 100644 index 0000000..745078e --- /dev/null +++ b/tests/fixtures/test-typed-client.ts @@ -0,0 +1,3924 @@ +import { Config, strapi } from '@strapi/client'; + +export interface paths { + '/tests': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['test/get/tests']; + put?: never; + post: operations['test/post/tests']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/tests/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['test/get/tests_by_id']; + put: operations['test/put/tests_by_id']; + post?: never; + delete: operations['test/delete/tests_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content-types': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/content_types']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content-types/{uid}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/content_types_by_uid']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/components': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/components']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/components/{uid}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['content-type-builder/get/components_by_uid']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['upload/post']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/files': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['upload/get/files']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/files/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['upload/get/files_by_id']; + put?: never; + post?: never; + delete: operations['upload/delete/files_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/locales': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['i18n/get/locales']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/connect/(.*)': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/connect_____']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/local': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_local']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/local/register': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_local_register']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/{provider}/callback': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/auth_by_provider_callback']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/forgot-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_forgot_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/reset-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_reset_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/email-confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/auth_email_confirmation']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/send-email-confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_send_email_confirmation']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/change-password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_change_password']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/refresh': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_refresh']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/auth/logout': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post: operations['users-permissions/post/auth_logout']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/count': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_count']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users']; + put?: never; + post: operations['users-permissions/post/users']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/me': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_me']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/users/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/users_by_id']; + put: operations['users-permissions/put/users_by_id']; + post?: never; + delete: operations['users-permissions/delete/users_by_id']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles/{id}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/roles_by_id']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/roles']; + put?: never; + post: operations['users-permissions/post/roles']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/roles/{role}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put: operations['users-permissions/put/roles_by_role']; + post?: never; + delete: operations['users-permissions/delete/roles_by_role']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/permissions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get: operations['users-permissions/get/permissions']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: never; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + 'test/get/tests': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + filters?: { + [key: string]: unknown; + }; + _q?: string; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + sort?: + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt') + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.245Z + */ + publishedAt: string; + others: unknown; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/post/tests': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + data: { + /** @description A string field */ + test: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.255Z + */ + publishedAt: string; + /** + * Format: uuid + * @description A relational field + */ + others?: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.256Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/get/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + filters?: { + [key: string]: unknown; + }; + sort?: + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt') + | ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.251Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/put/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + data: { + /** @description A string field */ + test?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.259Z + */ + publishedAt?: string; + /** + * Format: uuid + * @description A relational field + */ + others?: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.260Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'test/delete/tests_by_id': { + parameters: { + query?: { + fields?: ('test' | 'createdAt' | 'updatedAt' | 'publishedAt')[]; + populate?: '*' | 'others' | 'others'[]; + filters?: { + [key: string]: unknown; + }; + status?: 'draft' | 'published'; + hasPublishedVersion?: boolean | ('true' | 'false'); + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + /** + * Format: uuid + * @description The document ID, represented by a UUID + */ + documentId: string; + id: string | number; + /** @description A string field */ + test: string; + /** @description A datetime field */ + createdAt?: string; + /** @description A datetime field */ + updatedAt?: string; + /** + * @description A datetime field + * @default 2026-03-01T18:13:17.263Z + */ + publishedAt: string; + others: unknown; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/content_types': { + parameters: { + query: { + kind: 'collectionType' | 'singleType'; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + plugin?: string; + apiID: string; + schema: { + displayName: string; + singularName: string; + pluralName: string; + description: string; + draftAndPublish: boolean; + /** @enum {string} */ + kind: 'collectionType' | 'singleType'; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + visible: boolean; + restrictRelationsTo: string[] | null; + pluginOptions?: { + [key: string]: unknown; + }; + options?: { + [key: string]: unknown; + }; + reviewWorkflows?: boolean; + populateCreatorFields?: boolean; + comment?: string; + version?: string; + }; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/content_types_by_uid': { + parameters: { + query?: never; + header?: never; + path: { + uid: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + plugin?: string; + apiID: string; + schema: { + displayName: string; + singularName: string; + pluralName: string; + description: string; + draftAndPublish: boolean; + /** @enum {string} */ + kind: 'collectionType' | 'singleType'; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + visible: boolean; + restrictRelationsTo: string[] | null; + pluginOptions?: { + [key: string]: unknown; + }; + options?: { + [key: string]: unknown; + }; + reviewWorkflows?: boolean; + populateCreatorFields?: boolean; + comment?: string; + version?: string; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/components': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + category: string; + apiId: string; + schema: { + displayName: string; + description: string; + icon?: string; + connection?: string; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'content-type-builder/get/components_by_uid': { + parameters: { + query?: never; + header?: never; + path: { + uid: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + data: { + uid: string; + category: string; + apiId: string; + schema: { + displayName: string; + description: string; + icon?: string; + connection?: string; + collectionName?: string; + attributes: { + [key: string]: + | { + /** @constant */ + type: 'media'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + multiple: boolean; + required?: boolean; + allowedTypes?: string[]; + } + | { + /** @constant */ + type: 'relation'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + relation: string; + target: string; + targetAttribute: string | null; + autoPopulate?: boolean; + mappedBy?: string; + inversedBy?: string; + } + | { + /** @constant */ + type: 'component'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + component: string; + repeatable: boolean; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'dynamiczone'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + components: string[]; + required?: boolean; + min?: number; + max?: number; + } + | { + /** @constant */ + type: 'uid'; + /** @constant */ + configurable?: false; + private?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + targetField?: string; + } + | { + type: string; + required?: boolean; + unique?: boolean; + default?: unknown; + min?: number | string; + max?: number | string; + minLength?: number; + maxLength?: number; + enum?: string[]; + regex?: string; + private?: boolean; + configurable?: boolean; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + pluginOptions?: { + [key: string]: unknown; + }; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/post': { + parameters: { + query?: { + id?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': + | { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + } + | { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/get/files': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + sort?: + | string + | string[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/get/files_by_id': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path: { + id: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'upload/delete/files_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + alternativeText?: string | null; + caption?: string | null; + width?: number; + height?: number; + formats?: { + [key: string]: unknown; + }; + hash: string; + ext?: string; + mime: string; + size: number; + url: string; + previewUrl?: string | null; + folder?: number; + folderPath: string; + provider: string; + provider_metadata?: { + [key: string]: unknown; + } | null; + createdAt: string; + updatedAt: string; + createdBy?: number; + updatedBy?: number; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'i18n/get/locales': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + /** Format: uuid */ + documentId: string; + name: string; + code: string; + createdAt: string; + updatedAt: string; + publishedAt: string | null; + isDefault: boolean; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/connect_____': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_local': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + identifier: string; + password: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_local_register': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username: string; + /** Format: email */ + email: string; + password: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': + | { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + } + | { + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/auth_by_provider_callback': { + parameters: { + query?: never; + header?: never; + path: { + provider: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_forgot_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + /** Format: email */ + email: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_reset_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + code: string; + password: string; + passwordConfirmation: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/auth_email_confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_send_email_confirmation': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + /** Format: email */ + email: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + email: string; + sent: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_change_password': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + currentPassword: string; + password: string; + passwordConfirmation: string; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + jwt: string; + refreshToken?: string; + user: { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_refresh': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/auth_logout': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_count': { + parameters: { + query?: { + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': number; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + sort?: + | string + | string[] + | { + [key: string]: 'asc' | 'desc'; + } + | { + [key: string]: 'asc' | 'desc'; + }[]; + pagination?: { + /** @description Include total count in response */ + withCount?: boolean; + } & ( + | { + /** @description Page number (1-based) */ + page: number; + /** @description Number of entries per page */ + pageSize: number; + } + | { + /** @description Number of entries to skip */ + start: number; + /** @description Maximum number of entries to return */ + limit: number; + } + ); + filters?: { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }[]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/users': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username: string; + /** Format: email */ + email: string; + password: string; + role?: number; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_me': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/users_by_id': { + parameters: { + query?: { + fields?: string | string[]; + populate?: + | '*' + | string + | string[] + | { + [key: string]: unknown; + }; + }; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/put/users_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + username?: string; + /** Format: email */ + email?: string; + password?: string; + role?: number; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/delete/users_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + id: number; + documentId: string; + username: string; + email: string; + provider: string; + confirmed: boolean; + blocked: boolean; + role?: + | number + | { + id: number; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + }; + createdAt: string; + updatedAt: string; + publishedAt: string; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/roles_by_id': { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + role: { + id: number; + documentId: string; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + publishedAt: string; + nb_users?: number; + permissions?: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + users?: unknown[]; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + roles: { + id: number; + documentId: string; + name: string; + description: string | null; + type: string; + createdAt: string; + updatedAt: string; + publishedAt: string; + nb_users?: number; + permissions?: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + users?: unknown[]; + }[]; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/post/roles': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + name: string; + description?: string; + type: string; + permissions?: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/put/roles_by_role': { + parameters: { + query?: never; + header?: never; + path: { + role: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + 'application/json': { + name?: string; + description?: string; + type?: string; + permissions?: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/delete/roles_by_role': { + parameters: { + query?: never; + header?: never; + path: { + role: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + ok: boolean; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + 'users-permissions/get/permissions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': { + permissions: { + [key: string]: { + controllers: { + [key: string]: { + [key: string]: { + enabled: boolean; + policy: string; + }; + }; + }; + }; + }; + }; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Forbidden */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; +} + +export function createClient(config: Config) { + return strapi(config); +} diff --git a/tests/unit/client.types.test.ts b/tests/unit/client.types.test.ts new file mode 100644 index 0000000..10d931f --- /dev/null +++ b/tests/unit/client.types.test.ts @@ -0,0 +1,274 @@ +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; + +import { StrapiClient } from '../../src/client'; +import { paths } from '../fixtures/test-typed-client'; + +import { + MockAuthManager, + MockAuthProvider, + MockHttpClient, + MockStrapiConfigValidator, +} from './mocks'; + +import type { StrapiClientConfig } from '../../src/client'; +import type { HttpClientConfig } from '../../src/http'; + +describe('Strapi Typings', () => { + const mockHttpClientFactory = (config: HttpClientConfig) => new MockHttpClient(config); + + beforeEach(() => { + vi.spyOn(MockHttpClient.prototype, 'fetch').mockImplementation(() => + Promise.resolve(new Response(JSON.stringify({ data: { id: 1 }, meta: {} }), { status: 200 })) + ); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + describe('Initialization', () => { + it('should initialize with valid config', () => { + // Arrange + const config = { + baseURL: 'https://localhost:1337/api', + auth: { strategy: MockAuthProvider.identifier }, + } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const validatorSpy = vi.spyOn(mockValidator, 'validateConfig'); + const authSetStrategySpy = vi.spyOn(MockAuthManager.prototype, 'setStrategy'); + + // Act + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + // Assert + + expect(client).toBeInstanceOf(StrapiClient); + expect(validatorSpy).toHaveBeenCalledWith(config); + expect(authSetStrategySpy).toHaveBeenCalledWith(MockAuthProvider.identifier, undefined); + }); + }); + + describe('Typed Fetch', () => { + it('fetch should accept a path and return a typed response', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + + // Act + await client.fetch('/tests'); + const requestInfo = fetchSpy.mock.lastCall?.[0]; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty('headers', expect.any(Headers)); + + const { headers } = requestInfo as Request; + + expect(headers).toBeDefined(); + expect((headers as Headers).get('Content-Type')).toBe('application/json'); + }); + + it('fetch works with path parameters', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + + // Act + await client.fetch('/tests/{id}', { + parameters: { + path: { id: 'TEST' }, + }, + }); + const requestInfo = fetchSpy.mock.lastCall?.[0]; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty('url', expect.stringContaining('/tests/TEST')); + }); + + it('fetch url with path parameters without providing init', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + + // Act + await client.fetch('/tests/{id}'); + const requestInfo = fetchSpy.mock.lastCall?.[0]; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty( + 'url', + expect.stringContaining('/tests/' + encodeRFC3986URIComponent('{id}')) + ); + }); + + it('fetch works with query parameters', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + + // Act + await client.fetch('/tests/{id}', { + parameters: { + path: { id: 'TEST' }, + query: { fields: ['test'], populate: '*' }, + }, + }); + const requestInfo = fetchSpy.mock.lastCall?.[0]; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty('url', expect.stringContaining('/tests/TEST')); + expect(requestInfo).toHaveProperty( + 'url', + expect.stringContaining( + encodeRFC3986URIComponent('fields[]') + '=' + encodeRFC3986URIComponent('test') + ) + ); + expect(requestInfo).toHaveProperty( + 'url', + expect.stringContaining( + encodeRFC3986URIComponent('populate') + '=' + encodeRFC3986URIComponent('*') + ) + ); + }); + + it('fetch works with object body', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + + // Act + await client.fetch('/auth/local', { + method: 'post', + body: { identifier: 'demo_user', password: 'demo_password' }, + }); + const requestInfo = fetchSpy.mock.lastCall?.[0] as Request; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty('url', expect.stringContaining('/auth/local')); + expect(requestInfo).toHaveProperty('headers', expect.any(Headers)); + + const { headers } = requestInfo as Request; + + expect(headers).toBeDefined(); + expect((headers as Headers).get('Content-Type')).toBe('application/json'); + + const body = await requestInfo.json(); + expect(body).toEqual({ identifier: 'demo_user', password: 'demo_password' }); + }); + + it('fetch works with FormData', async () => { + // Arrange + const config = { baseURL: 'https://localhost:1337/api' } satisfies StrapiClientConfig; + + const mockValidator = new MockStrapiConfigValidator(); + const mockAuthManager = new MockAuthManager(); + + const client = new StrapiClient( + config, + mockValidator, + mockAuthManager, + mockHttpClientFactory + ); + + const fetchSpy = vi.spyOn(MockHttpClient.prototype, 'fetch'); + const data = new FormData(); + data.append('file', new Blob(['file content'], { type: 'text/plain' }), 'test.txt'); + + // Act + await client.fetch('/', { + method: 'post', + body: data, + }); + const requestInfo = fetchSpy.mock.lastCall?.[0] as Request; + + // Assert + expect(requestInfo).toBeInstanceOf(Request); + expect(requestInfo).toHaveProperty('url', expect.stringContaining('/')); + expect(requestInfo).toHaveProperty('headers', expect.any(Headers)); + + const { headers } = requestInfo as Request; + + expect(headers).toBeDefined(); + expect((headers as Headers).get('Content-Type')).toContain('multipart/form-data'); + + const body = await requestInfo.text(); + expect(body).toContain('formdata'); + expect(body).toContain('Content-Disposition: form-data; name="file"; filename="test.txt"'); + expect(body).toContain('Content-Type: text/plain'); + }); + }); +}); + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}` + ); +}