1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-24 10:37:28 +02:00

chore(server): update openapi (#2205)

This commit is contained in:
Michel Heusschen 2023-04-09 04:26:09 +02:00 committed by GitHub
parent 91e27affeb
commit 983abf5e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 275 additions and 319 deletions

View File

@ -1 +1 @@
6.0.1
6.5.0

BIN
mobile/openapi/README.md generated

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,6 @@
"/album": {
"get": {
"operationId": "getAllAlbums",
"description": "",
"parameters": [
{
"name": "shared",
@ -54,7 +53,6 @@
},
"post": {
"operationId": "createAlbum",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -94,7 +92,6 @@
"/api-key": {
"post": {
"operationId": "createKey",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -132,7 +129,6 @@
},
"get": {
"operationId": "getKeys",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -165,7 +161,6 @@
"/api-key/{id}": {
"get": {
"operationId": "getKey",
"description": "",
"parameters": [
{
"name": "id",
@ -203,7 +198,6 @@
},
"put": {
"operationId": "updateKey",
"description": "",
"parameters": [
{
"name": "id",
@ -251,7 +245,6 @@
},
"delete": {
"operationId": "deleteKey",
"description": "",
"parameters": [
{
"name": "id",
@ -284,7 +277,6 @@
"/auth/login": {
"post": {
"operationId": "login",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -316,7 +308,6 @@
"/auth/admin-sign-up": {
"post": {
"operationId": "adminSignUp",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -351,7 +342,6 @@
"/auth/validateToken": {
"post": {
"operationId": "validateAccessToken",
"description": "",
"parameters": [],
"responses": {
"201": {
@ -381,7 +371,6 @@
"/auth/change-password": {
"post": {
"operationId": "changePassword",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -421,7 +410,6 @@
"/auth/logout": {
"post": {
"operationId": "logout",
"description": "",
"parameters": [],
"responses": {
"201": {
@ -451,7 +439,6 @@
"/device-info": {
"put": {
"operationId": "upsertDeviceInfo",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -491,7 +478,6 @@
"/jobs": {
"get": {
"operationId": "getAllJobsStatus",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -521,7 +507,6 @@
"/jobs/{jobId}": {
"put": {
"operationId": "sendJobCommand",
"description": "",
"parameters": [
{
"name": "jobId",
@ -570,7 +555,6 @@
"/oauth/mobile-redirect": {
"get": {
"operationId": "mobileRedirect",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -585,7 +569,6 @@
"/oauth/config": {
"post": {
"operationId": "generateConfig",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -617,7 +600,6 @@
"/oauth/callback": {
"post": {
"operationId": "callback",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -649,7 +631,6 @@
"/oauth/link": {
"post": {
"operationId": "link",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -689,7 +670,6 @@
"/oauth/unlink": {
"post": {
"operationId": "unlink",
"description": "",
"parameters": [],
"responses": {
"201": {
@ -719,7 +699,6 @@
"/search": {
"get": {
"operationId": "search",
"description": "",
"parameters": [
{
"name": "q",
@ -874,7 +853,6 @@
"/search/config": {
"get": {
"operationId": "getSearchConfig",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -904,7 +882,6 @@
"/search/explore": {
"get": {
"operationId": "getExploreData",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -937,7 +914,6 @@
"/server-info": {
"get": {
"operationId": "getServerInfo",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -967,7 +943,6 @@
"/server-info/ping": {
"get": {
"operationId": "pingServer",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -989,7 +964,6 @@
"/server-info/version": {
"get": {
"operationId": "getServerVersion",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1011,7 +985,6 @@
"/server-info/stats": {
"get": {
"operationId": "getStats",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1041,7 +1014,6 @@
"/share": {
"get": {
"operationId": "getAllSharedLinks",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1074,7 +1046,6 @@
"/share/me": {
"get": {
"operationId": "getMySharedLink",
"description": "",
"parameters": [
{
"name": "key",
@ -1113,7 +1084,6 @@
"/share/{id}": {
"get": {
"operationId": "getSharedLinkById",
"description": "",
"parameters": [
{
"name": "id",
@ -1151,7 +1121,6 @@
},
"delete": {
"operationId": "removeSharedLink",
"description": "",
"parameters": [
{
"name": "id",
@ -1182,7 +1151,6 @@
},
"patch": {
"operationId": "editSharedLink",
"description": "",
"parameters": [
{
"name": "id",
@ -1232,7 +1200,6 @@
"/system-config": {
"get": {
"operationId": "getConfig",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1260,7 +1227,6 @@
},
"put": {
"operationId": "updateConfig",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -1300,7 +1266,6 @@
"/system-config/defaults": {
"get": {
"operationId": "getDefaults",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1330,7 +1295,6 @@
"/system-config/storage-template-options": {
"get": {
"operationId": "getStorageTemplateOptions",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1360,7 +1324,6 @@
"/user": {
"get": {
"operationId": "getAllUsers",
"description": "",
"parameters": [
{
"name": "isAll",
@ -1400,7 +1363,6 @@
},
"post": {
"operationId": "createUser",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -1438,7 +1400,6 @@
},
"put": {
"operationId": "updateUser",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -1478,7 +1439,6 @@
"/user/info/{userId}": {
"get": {
"operationId": "getUserById",
"description": "",
"parameters": [
{
"name": "userId",
@ -1518,7 +1478,6 @@
"/user/me": {
"get": {
"operationId": "getMyUserInfo",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -1548,7 +1507,6 @@
"/user/count": {
"get": {
"operationId": "getUserCount",
"description": "",
"parameters": [
{
"name": "admin",
@ -1580,7 +1538,6 @@
"/user/{userId}": {
"delete": {
"operationId": "deleteUser",
"description": "",
"parameters": [
{
"name": "userId",
@ -1620,7 +1577,6 @@
"/user/{userId}/restore": {
"post": {
"operationId": "restoreUser",
"description": "",
"parameters": [
{
"name": "userId",
@ -1660,7 +1616,6 @@
"/user/profile-image": {
"post": {
"operationId": "createProfileImage",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -1701,7 +1656,6 @@
"/user/profile-image/{userId}": {
"get": {
"operationId": "getProfileImage",
"description": "",
"parameters": [
{
"name": "userId",
@ -1741,7 +1695,6 @@
"/asset/upload": {
"post": {
"operationId": "uploadFile",
"description": "",
"parameters": [
{
"name": "key",
@ -1791,7 +1744,6 @@
"/asset/download/{assetId}": {
"get": {
"operationId": "downloadFile",
"description": "",
"parameters": [
{
"name": "assetId",
@ -1840,7 +1792,6 @@
"/asset/download-files": {
"post": {
"operationId": "downloadFiles",
"description": "",
"parameters": [
{
"name": "key",
@ -1949,7 +1900,6 @@
"/asset/file/{assetId}": {
"get": {
"operationId": "serveFile",
"description": "",
"parameters": [
{
"name": "isThumb",
@ -2016,7 +1966,6 @@
"/asset/thumbnail/{assetId}": {
"get": {
"operationId": "getAssetThumbnail",
"description": "",
"parameters": [
{
"name": "assetId",
@ -2073,7 +2022,6 @@
"/asset/curated-objects": {
"get": {
"operationId": "getCuratedObjects",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -2106,7 +2054,6 @@
"/asset/curated-locations": {
"get": {
"operationId": "getCuratedLocations",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -2139,7 +2086,6 @@
"/asset/search-terms": {
"get": {
"operationId": "getAssetSearchTerms",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -2172,7 +2118,6 @@
"/asset/search": {
"post": {
"operationId": "searchAsset",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2215,7 +2160,6 @@
"/asset/count-by-time-bucket": {
"post": {
"operationId": "getAssetCountByTimeBucket",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2255,7 +2199,6 @@
"/asset/count-by-user-id": {
"get": {
"operationId": "getAssetCountByUserId",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -2342,7 +2285,6 @@
},
"delete": {
"operationId": "deleteAsset",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2385,7 +2327,6 @@
"/asset/time-bucket": {
"post": {
"operationId": "getAssetByTimeBucket",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2658,7 +2599,6 @@
"/asset/shared-link": {
"post": {
"operationId": "createAssetsSharedLink",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2698,7 +2638,6 @@
"/asset/shared-link/add": {
"patch": {
"operationId": "addAssetsToSharedLink",
"description": "",
"parameters": [
{
"name": "key",
@ -2747,7 +2686,6 @@
"/asset/shared-link/remove": {
"patch": {
"operationId": "removeAssetsFromSharedLink",
"description": "",
"parameters": [
{
"name": "key",
@ -2796,7 +2734,6 @@
"/tag": {
"post": {
"operationId": "create",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
@ -2834,7 +2771,6 @@
},
"get": {
"operationId": "findAll",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -2867,7 +2803,6 @@
"/tag/{id}": {
"get": {
"operationId": "findOne",
"description": "",
"parameters": [
{
"name": "id",
@ -2905,7 +2840,6 @@
},
"patch": {
"operationId": "update",
"description": "",
"parameters": [
{
"name": "id",
@ -2953,7 +2887,6 @@
},
"delete": {
"operationId": "delete",
"description": "",
"parameters": [
{
"name": "id",
@ -2986,7 +2919,6 @@
"/album/count-by-user-id": {
"get": {
"operationId": "getAlbumCountByUserId",
"description": "",
"parameters": [],
"responses": {
"200": {
@ -3016,7 +2948,6 @@
"/album/{albumId}/users": {
"put": {
"operationId": "addUsersToAlbum",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3066,7 +2997,6 @@
"/album/{albumId}/assets": {
"put": {
"operationId": "addAssetsToAlbum",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3122,7 +3052,6 @@
},
"delete": {
"operationId": "removeAssetFromAlbum",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3172,7 +3101,6 @@
"/album/{albumId}": {
"get": {
"operationId": "getAlbumInfo",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3218,7 +3146,6 @@
},
"delete": {
"operationId": "deleteAlbum",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3249,7 +3176,6 @@
},
"patch": {
"operationId": "updateAlbumInfo",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3299,7 +3225,6 @@
"/album/{albumId}/user/{userId}": {
"delete": {
"operationId": "removeUserFromAlbum",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3340,7 +3265,6 @@
"/album/{albumId}/download": {
"get": {
"operationId": "downloadArchive",
"description": "",
"parameters": [
{
"name": "albumId",
@ -3405,7 +3329,6 @@
"/album/create-shared-link": {
"post": {
"operationId": "createAlbumSharedLink",
"description": "",
"parameters": [],
"requestBody": {
"required": true,

View File

@ -2,6 +2,6 @@
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.0.1"
"version": "6.5.0"
}
}
}

View File

@ -6,7 +6,7 @@
"packages": {
"": {
"name": "immich",
"version": "1.52.1",
"version": "1.53.0",
"license": "UNLICENSED",
"dependencies": {
"@babel/runtime": "^7.20.13",
@ -57,7 +57,7 @@
"@nestjs/cli": "^9.1.8",
"@nestjs/schematics": "^9.0.4",
"@nestjs/testing": "^9.2.1",
"@openapitools/openapi-generator-cli": "2.5.1",
"@openapitools/openapi-generator-cli": "2.5.2",
"@types/archiver": "^5.3.1",
"@types/bcrypt": "^5.0.0",
"@types/cookie-parser": "^1.4.3",
@ -1583,13 +1583,13 @@
}
},
"node_modules/@nestjs/mapped-types": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-1.2.0.tgz",
"integrity": "sha512-NTFwPZkQWsArQH8QSyFWGZvJ08gR+R4TofglqZoihn/vU+ktHEJjMqsIsADwb7XD97DhiD+TVv5ac+jG33BHrg==",
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-1.2.2.tgz",
"integrity": "sha512-3dHxLXs3M0GPiriAcCFFJQHoDFUuzTD5w6JDhE7TyfT89YKpe6tcCCIqOZWdXmt9AZjjK30RkHRSFF+QEnWFQg==",
"peerDependencies": {
"@nestjs/common": "^7.0.8 || ^8.0.0 || ^9.0.0",
"class-transformer": "^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0",
"class-validator": "^0.11.1 || ^0.12.0 || ^0.13.0",
"class-validator": "^0.11.1 || ^0.12.0 || ^0.13.0 || ^0.14.0",
"reflect-metadata": "^0.1.12"
},
"peerDependenciesMeta": {
@ -1670,15 +1670,15 @@
}
},
"node_modules/@nestjs/swagger": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-6.1.4.tgz",
"integrity": "sha512-kE8VjR+NaoKqxg8XqM/YYfALScPh4AcoR8Wywga8/OxHsTHY+MKxqvTpWp7IhCUWSA6xT8nQUpcC9Rt7C+r7Hw==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-6.3.0.tgz",
"integrity": "sha512-Gnig189oa1tD+h0BYIfUwhp/wvvmTn6iO3csR2E4rQrDTgCxSxZDlNdfZo3AC+Rmf8u0KX4ZAX1RZN1qXTtC7A==",
"dependencies": {
"@nestjs/mapped-types": "1.2.0",
"@nestjs/mapped-types": "1.2.2",
"js-yaml": "4.1.0",
"lodash": "4.17.21",
"path-to-regexp": "3.2.0",
"swagger-ui-dist": "4.15.5"
"swagger-ui-dist": "4.18.2"
},
"peerDependencies": {
"@fastify/static": "^6.0.0",
@ -1817,9 +1817,9 @@
}
},
"node_modules/@openapitools/openapi-generator-cli": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.5.1.tgz",
"integrity": "sha512-WSRQBU0dCSVD+0Qv8iCsv0C4iMaZe/NpJ/CT4SmrEYLH3txoKTE8wEfbdj/kqShS8Or0YEGDPUzhSIKY151L0w==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.5.2.tgz",
"integrity": "sha512-FLgkjzpDiHVsH821db0VDSElDoA6TcspGyq3RD4zLBJaJhbSsRwr4u87sNoyuHKBg4OMJbZMT4iJxAhkosKrzw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -10365,9 +10365,9 @@
}
},
"node_modules/swagger-ui-dist": {
"version": "4.15.5",
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.15.5.tgz",
"integrity": "sha512-V3eIa28lwB6gg7/wfNvAbjwJYmDXy1Jo1POjyTzlB6wPcHiGlRxq39TSjYGVjQrUSAzpv+a7nzp7mDxgNy57xA=="
"version": "4.18.2",
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.18.2.tgz",
"integrity": "sha512-oVBoBl9Dg+VJw8uRWDxlyUyHoNEDC0c1ysT6+Boy6CTgr2rUcLcfPon4RvxgS2/taNW6O0+US+Z/dlAsWFjOAQ=="
},
"node_modules/symbol-observable": {
"version": "4.0.0",
@ -12829,9 +12829,9 @@
}
},
"@nestjs/mapped-types": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-1.2.0.tgz",
"integrity": "sha512-NTFwPZkQWsArQH8QSyFWGZvJ08gR+R4TofglqZoihn/vU+ktHEJjMqsIsADwb7XD97DhiD+TVv5ac+jG33BHrg==",
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-1.2.2.tgz",
"integrity": "sha512-3dHxLXs3M0GPiriAcCFFJQHoDFUuzTD5w6JDhE7TyfT89YKpe6tcCCIqOZWdXmt9AZjjK30RkHRSFF+QEnWFQg==",
"requires": {}
},
"@nestjs/platform-express": {
@ -12878,15 +12878,15 @@
}
},
"@nestjs/swagger": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-6.1.4.tgz",
"integrity": "sha512-kE8VjR+NaoKqxg8XqM/YYfALScPh4AcoR8Wywga8/OxHsTHY+MKxqvTpWp7IhCUWSA6xT8nQUpcC9Rt7C+r7Hw==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-6.3.0.tgz",
"integrity": "sha512-Gnig189oa1tD+h0BYIfUwhp/wvvmTn6iO3csR2E4rQrDTgCxSxZDlNdfZo3AC+Rmf8u0KX4ZAX1RZN1qXTtC7A==",
"requires": {
"@nestjs/mapped-types": "1.2.0",
"@nestjs/mapped-types": "1.2.2",
"js-yaml": "4.1.0",
"lodash": "4.17.21",
"path-to-regexp": "3.2.0",
"swagger-ui-dist": "4.15.5"
"swagger-ui-dist": "4.18.2"
}
},
"@nestjs/testing": {
@ -12953,9 +12953,9 @@
}
},
"@openapitools/openapi-generator-cli": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.5.1.tgz",
"integrity": "sha512-WSRQBU0dCSVD+0Qv8iCsv0C4iMaZe/NpJ/CT4SmrEYLH3txoKTE8wEfbdj/kqShS8Or0YEGDPUzhSIKY151L0w==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.5.2.tgz",
"integrity": "sha512-FLgkjzpDiHVsH821db0VDSElDoA6TcspGyq3RD4zLBJaJhbSsRwr4u87sNoyuHKBg4OMJbZMT4iJxAhkosKrzw==",
"dev": true,
"requires": {
"@nestjs/common": "8.4.4",
@ -19588,9 +19588,9 @@
"dev": true
},
"swagger-ui-dist": {
"version": "4.15.5",
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.15.5.tgz",
"integrity": "sha512-V3eIa28lwB6gg7/wfNvAbjwJYmDXy1Jo1POjyTzlB6wPcHiGlRxq39TSjYGVjQrUSAzpv+a7nzp7mDxgNy57xA=="
"version": "4.18.2",
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-4.18.2.tgz",
"integrity": "sha512-oVBoBl9Dg+VJw8uRWDxlyUyHoNEDC0c1ysT6+Boy6CTgr2rUcLcfPon4RvxgS2/taNW6O0+US+Z/dlAsWFjOAQ=="
},
"symbol-observable": {
"version": "4.0.0",

View File

@ -85,7 +85,7 @@
"@nestjs/cli": "^9.1.8",
"@nestjs/schematics": "^9.0.4",
"@nestjs/testing": "^9.2.1",
"@openapitools/openapi-generator-cli": "2.5.1",
"@openapitools/openapi-generator-cli": "2.5.2",
"@types/archiver": "^5.3.1",
"@types/bcrypt": "^5.0.0",
"@types/cookie-parser": "^1.4.3",
@ -158,4 +158,4 @@
},
"globalSetup": "<rootDir>/libs/domain/test/global-setup.js"
}
}
}

View File

@ -1 +1 @@
6.0.1
6.5.0

File diff suppressed because it is too large Load Diff

View File

@ -13,10 +13,11 @@
*/
import { Configuration } from "./configuration";
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
export const BASE_PATH = "/api".replace(/\/+$/, "");
@ -64,8 +65,8 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}

View File

@ -13,9 +13,10 @@
*/
import { Configuration } from "./configuration";
import { RequiredError, RequestArgs } from "./base";
import { AxiosInstance, AxiosResponse } from 'axios';
import type { Configuration } from "./configuration";
import type { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
/**
*
@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
}