wallee
Version:
TypeScript/JavaScript client for wallee
181 lines (174 loc) • 8.65 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* Wallee AG TypeScript SDK
*
* This library allows to interact with the Wallee AG payment service.
*
* Copyright owner: Wallee AG
* Website: https://en.wallee.com
* Developer email: ecosystem-team@wallee.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebAppsService = void 0;
const runtime = require("../runtime");
const index_1 = require("../models/index");
const ServiceApiUtils_1 = require("../utils/ServiceApiUtils");
/**
*
*/
class WebAppsService extends runtime.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* Return true if the web app is installed in the provided space.
* Check whether the web app is installed
*/
getWebAppsInstalledRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['space'] == null) {
throw new runtime.RequiredError('space', 'Required parameter "space" was null or undefined when calling getWebAppsInstalled().');
}
const queryParameters = {};
const headerParameters = {};
if (requestParameters['space'] != null) {
headerParameters['Space'] = String(requestParameters['space']);
}
const method = 'GET';
const path = `/web-apps/installed`;
if (this.configuration.httpBearerAuth) {
yield this.configuration.httpBearerAuth.applyToRequest(path, method, queryParameters, headerParameters);
}
// Set per-request timeout in initOverrides: use the incoming parameter or fall back to the Configuration value
const requestTimeoutInSeconds = this.configuration.requestTimeout;
const updatedInitOverrides = yield ServiceApiUtils_1.ServiceApiUtils.adjustRequestSignalAsync(initOverrides, requestTimeoutInSeconds);
const response = yield this.request({
path: `/web-apps/installed`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, updatedInitOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Return true if the web app is installed in the provided space.
* Check whether the web app is installed
*/
getWebAppsInstalled(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getWebAppsInstalledRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Confirm the installation of a web app. This has to be done when the user returns to the web app after granting permissions, using the activation code provided in the request.
* Confirm a web app installation
*/
postWebAppsConfirmCodeRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['code'] == null) {
throw new runtime.RequiredError('code', 'Required parameter "code" was null or undefined when calling postWebAppsConfirmCode().');
}
const queryParameters = {};
if (requestParameters['expand'] != null) {
queryParameters['expand'] = requestParameters['expand'];
}
const headerParameters = {};
const method = 'POST';
const path = `/web-apps/confirm/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters['code'])));
if (this.configuration.httpBearerAuth) {
yield this.configuration.httpBearerAuth.applyToRequest(path, method, queryParameters, headerParameters);
}
// Set per-request timeout in initOverrides: use the incoming parameter or fall back to the Configuration value
const requestTimeoutInSeconds = this.configuration.requestTimeout;
const updatedInitOverrides = yield ServiceApiUtils_1.ServiceApiUtils.adjustRequestSignalAsync(initOverrides, requestTimeoutInSeconds);
const response = yield this.request({
path: `/web-apps/confirm/{code}`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters['code']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, updatedInitOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WebAppConfirmationResponseFromJSON)(jsonValue));
});
}
/**
* Confirm the installation of a web app. This has to be done when the user returns to the web app after granting permissions, using the activation code provided in the request.
* Confirm a web app installation
*/
postWebAppsConfirmCode(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.postWebAppsConfirmCodeRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Uninstall the web app from the provided space.
* Uninstall a web app
*/
postWebAppsUninstallRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['space'] == null) {
throw new runtime.RequiredError('space', 'Required parameter "space" was null or undefined when calling postWebAppsUninstall().');
}
const queryParameters = {};
const headerParameters = {};
if (requestParameters['space'] != null) {
headerParameters['Space'] = String(requestParameters['space']);
}
const method = 'POST';
const path = `/web-apps/uninstall`;
if (this.configuration.httpBearerAuth) {
yield this.configuration.httpBearerAuth.applyToRequest(path, method, queryParameters, headerParameters);
}
// Set per-request timeout in initOverrides: use the incoming parameter or fall back to the Configuration value
const requestTimeoutInSeconds = this.configuration.requestTimeout;
const updatedInitOverrides = yield ServiceApiUtils_1.ServiceApiUtils.adjustRequestSignalAsync(initOverrides, requestTimeoutInSeconds);
const response = yield this.request({
path: `/web-apps/uninstall`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, updatedInitOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Uninstall the web app from the provided space.
* Uninstall a web app
*/
postWebAppsUninstall(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postWebAppsUninstallRaw(requestParameters, initOverrides);
});
}
}
exports.WebAppsService = WebAppsService;