mirror of https://github.com/immich-app/immich.git
refactor: open api (#6334)
parent
a1523a9af0
commit
2439c5ab57
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
OPENAPI_GENEARTOR_VERSION=v6.6.0
|
||||||
|
|
||||||
|
# usage: ./bin/generate-open-api.sh
|
||||||
|
|
||||||
|
function dart {
|
||||||
|
rm -rf ../mobile/openapi
|
||||||
|
cd ./templates/mobile/serialization/native
|
||||||
|
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
|
||||||
|
patch -u native_class.mustache <native_class.mustache.patch
|
||||||
|
cd ../../../..
|
||||||
|
npx --yes @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./templates/mobile
|
||||||
|
|
||||||
|
# Post generate patches
|
||||||
|
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./patch/api_client.dart.patch
|
||||||
|
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./patch/api.dart.patch
|
||||||
|
sed -i 's/0.17.0/0.18.0/g' ../mobile/openapi/pubspec.yaml
|
||||||
|
}
|
||||||
|
|
||||||
|
function typescript {
|
||||||
|
rm -rf ./typescript-sdk/client
|
||||||
|
cd ./templates/typescript
|
||||||
|
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
||||||
|
patch -u apiInner.mustache < apiInner.mustache.patch
|
||||||
|
cd ../..
|
||||||
|
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ./typescript-sdk/client -t ./templates/typescript --additional-properties=useSingleRequestParameter=true
|
||||||
|
npm --prefix typescript-sdk ci && npm --prefix typescript-sdk run build
|
||||||
|
}
|
||||||
|
|
||||||
|
node ./bin/sync-spec-version.js
|
||||||
|
|
||||||
|
if [[ $1 == 'dart' ]]; then
|
||||||
|
dart
|
||||||
|
elif [[ $1 == 'typescript' ]]; then
|
||||||
|
typescript
|
||||||
|
else
|
||||||
|
dart
|
||||||
|
typescript
|
||||||
|
fi
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
const spec = require('../immich-openapi-specs.json');
|
||||||
|
const pkg = require('../../server/package.json');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
spec.info.version = pkg.version;
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(__dirname, '../immich-openapi-specs.json'),
|
||||||
|
JSON.stringify(spec, null, 2)
|
||||||
|
);
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||||
|
"spaces": 2,
|
||||||
|
"generator-cli": {
|
||||||
|
"version": "6.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
export * from './client';
|
||||||
|
export * as base from './client/base';
|
||||||
|
export * as configuration from './client/configuration';
|
||||||
|
export * as common from './client/common';
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
{
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "20.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz",
|
||||||
|
"integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~5.26.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "0.27.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||||
|
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.14.9",
|
||||||
|
"form-data": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
|
||||||
|
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||||
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "5.26.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||||
|
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "@immich/sdk",
|
||||||
|
"version": "1.92.1",
|
||||||
|
"description": "",
|
||||||
|
"type": "commonjs",
|
||||||
|
"main": "./build/cjs/index.js",
|
||||||
|
"module": "./build/esm/index.js",
|
||||||
|
"typings": "./build/types/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./build/esm/index.js",
|
||||||
|
"require": "./build/cjs/index.js",
|
||||||
|
"default": "./build/cjs/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.27.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.0",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/cjs",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "es2022",
|
||||||
|
"lib": ["es2022"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/esm",
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"lib": ["esnext", "dom"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build/types",
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"lib": ["es2020"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,46 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
OPENAPI_GENEARTOR_VERSION=v6.6.0
|
|
||||||
|
|
||||||
function mobile {
|
|
||||||
rm -rf ../mobile/openapi
|
|
||||||
cd ./openapi-generator/templates/mobile/serialization/native
|
|
||||||
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
|
|
||||||
patch -u native_class.mustache <native_class.mustache.patch
|
|
||||||
cd ../../../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./openapi-generator/templates/mobile
|
|
||||||
|
|
||||||
# Post generate patches
|
|
||||||
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api_client.dart <./openapi-generator/patch/api_client.dart.patch
|
|
||||||
patch --no-backup-if-mismatch -u ../mobile/openapi/lib/api.dart <./openapi-generator/patch/api.dart.patch
|
|
||||||
sed -i 's/0.17.0/0.18.0/g' ../mobile/openapi/pubspec.yaml
|
|
||||||
}
|
|
||||||
|
|
||||||
function web {
|
|
||||||
rm -rf ../web/src/api/open-api
|
|
||||||
cd ./openapi-generator/templates/web
|
|
||||||
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
|
||||||
patch -u apiInner.mustache < apiInner.mustache.patch
|
|
||||||
cd ../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api -t ./openapi-generator/templates/web --additional-properties=useSingleRequestParameter=true
|
|
||||||
}
|
|
||||||
|
|
||||||
function cli {
|
|
||||||
rm -rf ../cli/src/api/open-api
|
|
||||||
cd ./openapi-generator/templates/cli
|
|
||||||
wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENEARTOR_VERSION/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache
|
|
||||||
patch -u apiInner.mustache < apiInner.mustache.patch
|
|
||||||
cd ../../..
|
|
||||||
npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../cli/src/api/open-api -t ./openapi-generator/templates/cli --additional-properties=useSingleRequestParameter=true
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $1 == 'mobile' ]]; then
|
|
||||||
mobile
|
|
||||||
elif [[ $1 == 'web' ]]; then
|
|
||||||
web
|
|
||||||
elif [[ $1 == 'cli' ]]; then
|
|
||||||
cli
|
|
||||||
else
|
|
||||||
mobile
|
|
||||||
web
|
|
||||||
cli
|
|
||||||
fi
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
const spec = require('../immich-openapi-specs.json');
|
|
||||||
const pkg = require('../package.json');
|
|
||||||
const path = require('path');
|
|
||||||
const fs = require('fs');
|
|
||||||
spec.info.version = pkg.version;
|
|
||||||
fs.writeFileSync(path.join(__dirname, '../immich-openapi-specs.json'), JSON.stringify(spec, null, 2));
|
|
||||||
@ -1,391 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import type { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{! `val == null` covers for both `null` and `undefined`}}
|
|
||||||
if ({{paramName}} != null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
{{! isString is falsy also for $ref that defines a string or enum type}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string'
|
|
||||||
? {{paramName}}
|
|
||||||
: JSON.stringify({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isEnum}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isEnum}}{{^isEnum}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isEnum}}{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
options: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
||||||
@ -1,390 +0,0 @@
|
|||||||
{{#withSeparateModelsAndApi}}
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
{{>licenseInfo}}
|
|
||||||
|
|
||||||
import type { Configuration } from '{{apiRelativeToRoot}}configuration';
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
{{#withNodeImports}}
|
|
||||||
// URLSearchParams not necessarily used
|
|
||||||
// @ts-ignore
|
|
||||||
import { URL, URLSearchParams } from 'url';
|
|
||||||
{{#multipartFormData}}
|
|
||||||
import FormData from 'form-data'
|
|
||||||
{{/multipartFormData}}
|
|
||||||
{{/withNodeImports}}
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
|
||||||
{{#imports}}
|
|
||||||
// @ts-ignore
|
|
||||||
import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
|
|
||||||
{{/imports}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{^withSeparateModelsAndApi}}
|
|
||||||
{{/withSeparateModelsAndApi}}
|
|
||||||
{{#operations}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - axios parameter creator{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
|
||||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
||||||
let baseOptions;
|
|
||||||
if (configuration) {
|
|
||||||
baseOptions = configuration.baseOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
|
|
||||||
const localVarHeaderParameter = {} as any;
|
|
||||||
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
|
|
||||||
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
|
|
||||||
{{#authMethods}}
|
|
||||||
// authentication {{name}} required
|
|
||||||
{{#isApiKey}}
|
|
||||||
{{#isKeyInHeader}}
|
|
||||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInHeader}}
|
|
||||||
{{#isKeyInQuery}}
|
|
||||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
|
||||||
{{/isKeyInQuery}}
|
|
||||||
{{/isApiKey}}
|
|
||||||
{{#isBasicBasic}}
|
|
||||||
// http basic authentication required
|
|
||||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
|
||||||
{{/isBasicBasic}}
|
|
||||||
{{#isBasicBearer}}
|
|
||||||
// http bearer authentication required
|
|
||||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
||||||
{{/isBasicBearer}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
|
||||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
|
||||||
{{/isOAuth}}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
|
||||||
{{#queryParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
{{#uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) {
|
|
||||||
{{#isDateTime}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString() :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ?
|
|
||||||
({{paramName}} as any).toISOString().substr(0,10) :
|
|
||||||
{{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDate}}
|
|
||||||
localVarQueryParameter['{{baseName}}'] = {{paramName}};
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/queryParams}}
|
|
||||||
{{#headerParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#uniqueItems}}
|
|
||||||
let mapped = Array.from({{paramName}}).map(value => (<any>"{{{dataType}}}" !== "Set<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
{{^uniqueItems}}
|
|
||||||
let mapped = {{paramName}}.map(value => (<any>"{{{dataType}}}" !== "Array<string>") ? JSON.stringify(value) : (value || ""));
|
|
||||||
{{/uniqueItems}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]);
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{! `val == null` covers for both `null` and `undefined`}}
|
|
||||||
if ({{paramName}} != null) {
|
|
||||||
{{#isString}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
{{^isString}}
|
|
||||||
{{! isString is falsy also for $ref that defines a string or enum type}}
|
|
||||||
localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string'
|
|
||||||
? {{paramName}}
|
|
||||||
: JSON.stringify({{paramName}});
|
|
||||||
{{/isString}}
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
|
||||||
|
|
||||||
{{/headerParams}}
|
|
||||||
{{#vendorExtensions}}
|
|
||||||
{{#formParams}}
|
|
||||||
{{#isArray}}
|
|
||||||
if ({{paramName}}) {
|
|
||||||
{{#isCollectionFormatMulti}}
|
|
||||||
{{paramName}}.forEach((element) => {
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', element as any);
|
|
||||||
})
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
{{^isCollectionFormatMulti}}
|
|
||||||
localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));
|
|
||||||
{{/isCollectionFormatMulti}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
|
|
||||||
{{/hasFormParams}}{{/vendorExtensions}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
{{^consumes}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
||||||
{{/consumes}}
|
|
||||||
{{#consumes.0}}
|
|
||||||
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
|
|
||||||
{{/consumes.0}}
|
|
||||||
|
|
||||||
{{/bodyParam}}
|
|
||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers};
|
|
||||||
{{#hasFormParams}}
|
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
|
||||||
{{/hasFormParams}}
|
|
||||||
{{#bodyParam}}
|
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
|
||||||
{{/bodyParam}}
|
|
||||||
|
|
||||||
return {
|
|
||||||
url: toPathString(localVarUrlObj),
|
|
||||||
options: localVarRequestOptions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - functional programming interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
|
||||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
|
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
||||||
},
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {{classname}} - factory interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
||||||
const localVarFp = {{classname}}Fp(configuration)
|
|
||||||
return {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
|
||||||
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
|
||||||
},
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{/operation}}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
{{#withInterfaces}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - interface{{#description}}
|
|
||||||
* {{&description}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}
|
|
||||||
*/
|
|
||||||
export interface {{classname}}Interface {
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}Interface
|
|
||||||
*/
|
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>;
|
|
||||||
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#operation}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
/**
|
|
||||||
* Request parameters for {{nickname}} operation in {{classname}}.
|
|
||||||
* @export
|
|
||||||
* @interface {{classname}}{{operationIdCamelCase}}Request
|
|
||||||
*/
|
|
||||||
export interface {{classname}}{{operationIdCamelCase}}Request {
|
|
||||||
{{#allParams}}
|
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
* @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%>
|
|
||||||
* @memberof {{classname}}{{operationIdCamelCase}}
|
|
||||||
*/
|
|
||||||
readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/allParams}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/operation}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
/**
|
|
||||||
* {{classname}} - object-oriented interface{{#description}}
|
|
||||||
* {{{.}}}{{/description}}
|
|
||||||
* @export
|
|
||||||
* @class {{classname}}
|
|
||||||
* @extends {BaseAPI}
|
|
||||||
*/
|
|
||||||
{{#withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{^withInterfaces}}
|
|
||||||
export class {{classname}} extends BaseAPI {
|
|
||||||
{{/withInterfaces}}
|
|
||||||
{{#operation}}
|
|
||||||
/**
|
|
||||||
* {{¬es}}
|
|
||||||
{{#summary}}
|
|
||||||
* @summary {{&summary}}
|
|
||||||
{{/summary}}
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
{{#allParams.0}}
|
|
||||||
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
|
|
||||||
{{/allParams.0}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
{{#allParams}}
|
|
||||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
|
||||||
{{/allParams}}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
* @param {*} [options] Override http request option.{{#isDeprecated}}
|
|
||||||
* @deprecated{{/isDeprecated}}
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @memberof {{classname}}
|
|
||||||
*/
|
|
||||||
{{#useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^useSingleRequestParameter}}
|
|
||||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: AxiosRequestConfig) {
|
|
||||||
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(this.axios, this.basePath));
|
|
||||||
}
|
|
||||||
{{/useSingleRequestParameter}}
|
|
||||||
{{^-last}}
|
|
||||||
|
|
||||||
{{/-last}}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
|
||||||
{{/operations}}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
--- apiInner.mustache 2023-02-10 17:44:20.945845049 +0000
|
|
||||||
+++ apiInner.mustache.patch 2023-02-10 17:46:28.669054112 +0000
|
|
||||||
@@ -173,8 +173,9 @@
|
|
||||||
{{^isArray}}
|
|
||||||
if ({{paramName}} !== undefined) { {{^multipartFormData}}
|
|
||||||
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}
|
|
||||||
- localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}
|
|
||||||
- localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isEnum}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isEnum}}{{^isEnum}}
|
|
||||||
+ localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isEnum}}{{/isPrimitiveType}}{{/multipartFormData}}
|
|
||||||
}{{/isArray}}
|
|
||||||
{{/formParams}}{{/vendorExtensions}}
|
|
||||||
{{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}}
|
|
||||||
@ -1,3 +1,3 @@
|
|||||||
export * from './api';
|
export * from './api';
|
||||||
export * from './open-api';
|
export * from '@immich/sdk';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
wwwroot/*.js
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
dist
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
.gitignore
|
|
||||||
.npmignore
|
|
||||||
.openapi-generator-ignore
|
|
||||||
api.ts
|
|
||||||
base.ts
|
|
||||||
common.ts
|
|
||||||
configuration.ts
|
|
||||||
git_push.sh
|
|
||||||
index.ts
|
|
||||||
@ -1 +0,0 @@
|
|||||||
6.5.0
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import type { Configuration } from './configuration';
|
|
||||||
// Some imports not used depending on template conditions
|
|
||||||
// @ts-ignore
|
|
||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
||||||
import globalAxios from 'axios';
|
|
||||||
|
|
||||||
export const BASE_PATH = "/api".replace(/\/+$/, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const COLLECTION_FORMATS = {
|
|
||||||
csv: ",",
|
|
||||||
ssv: " ",
|
|
||||||
tsv: "\t",
|
|
||||||
pipes: "|",
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @interface RequestArgs
|
|
||||||
*/
|
|
||||||
export interface RequestArgs {
|
|
||||||
url: string;
|
|
||||||
options: AxiosRequestConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @class BaseAPI
|
|
||||||
*/
|
|
||||||
export class BaseAPI {
|
|
||||||
protected configuration: Configuration | undefined;
|
|
||||||
|
|
||||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
this.basePath = configuration.basePath || this.basePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @class RequiredError
|
|
||||||
* @extends {Error}
|
|
||||||
*/
|
|
||||||
export class RequiredError extends Error {
|
|
||||||
constructor(public field: string, msg?: string) {
|
|
||||||
super(msg);
|
|
||||||
this.name = "RequiredError"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,150 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import type { Configuration } from "./configuration";
|
|
||||||
import type { RequestArgs } from "./base";
|
|
||||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
||||||
import { RequiredError } from "./base";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const DUMMY_BASE_URL = 'https://example.com'
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws {RequiredError}
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
|
||||||
if (paramValue === null || paramValue === undefined) {
|
|
||||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.apiKey) {
|
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey(keyParamName)
|
|
||||||
: await configuration.apiKey;
|
|
||||||
object[keyParamName] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && (configuration.username || configuration.password)) {
|
|
||||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const accessToken = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken()
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + accessToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
|
||||||
if (configuration && configuration.accessToken) {
|
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken(name, scopes)
|
|
||||||
: await configuration.accessToken;
|
|
||||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
setFlattenedQueryParams(searchParams, objects);
|
|
||||||
url.search = searchParams.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
|
||||||
const nonString = typeof value !== 'string';
|
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
return needsSerialization
|
|
||||||
? JSON.stringify(value !== undefined ? value : {})
|
|
||||||
: (value || "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const toPathString = function (url: URL) {
|
|
||||||
return url.pathname + url.search + url.hash
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
||||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
||||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
|
||||||
return axios.request<T, R>(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
basePath?: string;
|
|
||||||
baseOptions?: any;
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Configuration {
|
|
||||||
/**
|
|
||||||
* parameter for apiKey security
|
|
||||||
* @param name security name
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
username?: string;
|
|
||||||
/**
|
|
||||||
* parameter for basic security
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
password?: string;
|
|
||||||
/**
|
|
||||||
* parameter for oauth2 security
|
|
||||||
* @param name security name
|
|
||||||
* @param scopes oauth2 scope
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
||||||
/**
|
|
||||||
* override base path
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
basePath?: string;
|
|
||||||
/**
|
|
||||||
* base options for axios calls
|
|
||||||
*
|
|
||||||
* @type {any}
|
|
||||||
* @memberof Configuration
|
|
||||||
*/
|
|
||||||
baseOptions?: any;
|
|
||||||
/**
|
|
||||||
* The FormData constructor that will be used to create multipart form data
|
|
||||||
* requests. You can inject this here so that execution environments that
|
|
||||||
* do not support the FormData class can still run the generated client.
|
|
||||||
*
|
|
||||||
* @type {new () => FormData}
|
|
||||||
*/
|
|
||||||
formDataCtor?: new () => any;
|
|
||||||
|
|
||||||
constructor(param: ConfigurationParameters = {}) {
|
|
||||||
this.apiKey = param.apiKey;
|
|
||||||
this.username = param.username;
|
|
||||||
this.password = param.password;
|
|
||||||
this.accessToken = param.accessToken;
|
|
||||||
this.basePath = param.basePath;
|
|
||||||
this.baseOptions = param.baseOptions;
|
|
||||||
this.formDataCtor = param.formDataCtor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given MIME is a JSON MIME.
|
|
||||||
* JSON MIME examples:
|
|
||||||
* application/json
|
|
||||||
* application/json; charset=UTF8
|
|
||||||
* APPLICATION/JSON
|
|
||||||
* application/vnd.company+json
|
|
||||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
||||||
* @return True if the given MIME is JSON, false otherwise.
|
|
||||||
*/
|
|
||||||
public isJsonMime(mime: string): boolean {
|
|
||||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
||||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
git_host=$4
|
|
||||||
|
|
||||||
if [ "$git_host" = "" ]; then
|
|
||||||
git_host="github.com"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=$(git remote)
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Immich
|
|
||||||
* Immich API
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.92.1
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export * from "./api";
|
|
||||||
export * from "./configuration";
|
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { MemoryLaneResponseDto } from '../../api/open-api';
|
import type { MemoryLaneResponseDto } from '@api';
|
||||||
|
|
||||||
export const memoryStore = writable<MemoryLaneResponseDto[]>();
|
export const memoryStore = writable<MemoryLaneResponseDto[]>();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { AssetResponseDto } from '../../api/open-api';
|
import type { AssetResponseDto } from '@api';
|
||||||
|
|
||||||
export const stackAssetsStore = writable<AssetResponseDto[]>([]);
|
export const stackAssetsStore = writable<AssetResponseDto[]>([]);
|
||||||
|
|||||||
Loading…
Reference in New Issue