Repository URL to install this package:
import { __values } from 'tslib';
import { WC_API_BASE_PATH } from 'web-console-core';
import { Inject, Injectable, Optional, InjectionToken, NgModule, SkipSelf, defineInjectable, inject } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Configuration = /** @class */ (function () {
function Configuration(configurationParameters) {
if (configurationParameters === void 0) { configurationParameters = {}; }
this.apiKeys = configurationParameters.apiKeys;
this.username = configurationParameters.username;
this.password = configurationParameters.password;
this.accessToken = configurationParameters.accessToken;
this.basePath = configurationParameters.basePath;
this.withCredentials = configurationParameters.withCredentials;
}
/**
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
/**
* Select the correct content-type to use for a request.
* Uses {\@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {?} contentTypes - the array of content types that are available for selection
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
Configuration.prototype.selectHeaderContentType = /**
* Select the correct content-type to use for a request.
* Uses {\@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {?} contentTypes - the array of content types that are available for selection
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
function (contentTypes) {
var _this = this;
if (contentTypes.length === 0) {
return undefined;
}
/** @type {?} */
var type = contentTypes.find((/**
* @param {?} x
* @return {?}
*/
function (x) { return _this.isJsonMime(x); }));
if (type === undefined) {
return contentTypes[0];
}
return type;
};
/**
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
/**
* Select the correct accept content-type to use for a request.
* Uses {\@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {?} accepts - the array of content types that are available for selection.
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
Configuration.prototype.selectHeaderAccept = /**
* Select the correct accept content-type to use for a request.
* Uses {\@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {?} accepts - the array of content types that are available for selection.
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
function (accepts) {
var _this = this;
if (accepts.length === 0) {
return undefined;
}
/** @type {?} */
var type = accepts.find((/**
* @param {?} x
* @return {?}
*/
function (x) { return _this.isJsonMime(x); }));
if (type === undefined) {
return accepts[0];
}
return type;
};
/**
* 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.
*/
/**
* 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.
*/
Configuration.prototype.isJsonMime = /**
* 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.
*/
function (mime) {
/** @type {?} */
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
};
return Configuration;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ApplicationsService = /** @class */ (function () {
function ApplicationsService(httpClient, basePath, configuration) {
this.httpClient = httpClient;
this.basePath = 'http://localhost:8080/rest/v2';
this.defaultHeaders = new HttpHeaders();
this.configuration = new Configuration();
if (configuration) {
this.configuration = configuration;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
}
else {
this.configuration.basePath = basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
/**
* @private
* @param {?} consumes string[] mime-types
* @return {?} true: consumes contains 'multipart/form-data', false: otherwise
*/
ApplicationsService.prototype.canConsumeForm = /**
* @private
* @param {?} consumes string[] mime-types
* @return {?} true: consumes contains 'multipart/form-data', false: otherwise
*/
function (consumes) {
var e_1, _a;
/** @type {?} */
var form = 'multipart/form-data';
try {
for (var consumes_1 = __values(consumes), consumes_1_1 = consumes_1.next(); !consumes_1_1.done; consumes_1_1 = consumes_1.next()) {
var consume = consumes_1_1.value;
if (form === consume) {
return true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (consumes_1_1 && !consumes_1_1.done && (_a = consumes_1.return)) _a.call(consumes_1);
}
finally { if (e_1) throw e_1.error; }
}
return false;
};
/**
* @param {?} domain
* @param {?} application
* @param {?} property
* @param {?=} observe
* @param {?=} reportProgress
* @return {?}
*/
ApplicationsService.prototype.getApplicationProperty = /**
* @param {?} domain
* @param {?} application
* @param {?} property
* @param {?=} observe
* @param {?=} reportProgress
* @return {?}
*/
function (domain, application, property, observe, reportProgress) {
if (observe === void 0) { observe = 'body'; }
if (reportProgress === void 0) { reportProgress = false; }
if (domain === null || domain === undefined) {
throw new Error('Required parameter domain was null or undefined when calling getApplicationProperty.');
}
if (application === null || application === undefined) {
throw new Error('Required parameter application was null or undefined when calling getApplicationProperty.');
}
if (property === null || property === undefined) {
throw new Error('Required parameter property was null or undefined when calling getApplicationProperty.');
}
/** @type {?} */
var headers = this.defaultHeaders;
// authentication (vipera_basic) required
if (this.configuration.username || this.configuration.password) {
headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
}
// authentication (vipera_cookie) required
// authentication (vipera_oauth2) required
if (this.configuration.accessToken) {
/** @type {?} */
var accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
/** @type {?} */
var httpHeaderAccepts = [
'application/json'
];
/** @type {?} */
var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.get(this.configuration.basePath + "/catalog/domains/" + encodeURIComponent(String(domain)) + "/applications/" + encodeURIComponent(String(application)) + "/properties/" + encodeURIComponent(String(property)), {
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
};
/**
* @param {?} domain
* @param {?} application
* @param {?=} observe
* @param {?=} reportProgress
* @return {?}
*/
ApplicationsService.prototype.getServiceList = /**
* @param {?} domain
* @param {?} application
* @param {?=} observe
* @param {?=} reportProgress
* @return {?}
*/
function (domain, application, observe, reportProgress) {
if (observe === void 0) { observe = 'body'; }
if (reportProgress === void 0) { reportProgress = false; }
if (domain === null || domain === undefined) {
throw new Error('Required parameter domain was null or undefined when calling getServiceList.');
}
if (application === null || application === undefined) {
throw new Error('Required parameter application was null or undefined when calling getServiceList.');
}
/** @type {?} */
var headers = this.defaultHeaders;
// authentication (vipera_basic) required
if (this.configuration.username || this.configuration.password) {
headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
}
// authentication (vipera_cookie) required
// authentication (vipera_oauth2) required
if (this.configuration.accessToken) {
/** @type {?} */
var accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
/** @type {?} */
var httpHeaderAccepts = [
'application/json'
];
/** @type {?} */
var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.get(this.configuration.basePath + "/catalog/domains/" + encodeURIComponent(String(domain)) + "/applications/" + encodeURIComponent(String(application)) + "/services", {
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
};
ApplicationsService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
ApplicationsService.ctorParameters = function () { return [
{ type: HttpClient },
{ type: String, decorators: [{ type: Optional }, { type: Inject, args: [WC_API_BASE_PATH,] }] },
{ type: Configuration, decorators: [{ type: Optional }] }
]; };
/** @nocollapse */ ApplicationsService.ngInjectableDef = defineInjectable({ factory: function ApplicationsService_Factory() { return new ApplicationsService(inject(HttpClient), inject(WC_API_BASE_PATH, 8), inject(Configuration, 8)); }, token: ApplicationsService, providedIn: "root" });
return ApplicationsService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var OperationsService = /** @class */ (function () {
function OperationsService(httpClient, basePath, configuration) {
this.httpClient = httpClient;
this.basePath = 'http://localhost:8080/rest/v2';
this.defaultHeaders = new HttpHeaders();
this.configuration = new Configuration();
if (configuration) {
this.configuration = configuration;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
}
else {
this.configuration.basePath = basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
/**
* @private
* @param {?} consumes string[] mime-types
* @return {?} true: consumes contains 'multipart/form-data', false: otherwise
Loading ...