Repository URL to install this package:
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
export function ConfigurationParameters() { }
if (false) {
/** @type {?|undefined} */
ConfigurationParameters.prototype.apiKeys;
/** @type {?|undefined} */
ConfigurationParameters.prototype.username;
/** @type {?|undefined} */
ConfigurationParameters.prototype.password;
/** @type {?|undefined} */
ConfigurationParameters.prototype.accessToken;
/** @type {?|undefined} */
ConfigurationParameters.prototype.basePath;
/** @type {?|undefined} */
ConfigurationParameters.prototype.withCredentials;
}
export class Configuration {
/**
* @param {?=} configurationParameters
*/
constructor(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
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
selectHeaderContentType(contentTypes) {
if (contentTypes.length === 0) {
return undefined;
}
/** @type {?} */
let type = contentTypes.find((/**
* @param {?} x
* @return {?}
*/
x => 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.
* @return {?} the selected content-type or <code>undefined</code> if no selection could be made.
*/
selectHeaderAccept(accepts) {
if (accepts.length === 0) {
return undefined;
}
/** @type {?} */
let type = accepts.find((/**
* @param {?} x
* @return {?}
*/
x => 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.
*/
isJsonMime(mime) {
/** @type {?} */
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}
if (false) {
/** @type {?} */
Configuration.prototype.apiKeys;
/** @type {?} */
Configuration.prototype.username;
/** @type {?} */
Configuration.prototype.password;
/** @type {?} */
Configuration.prototype.accessToken;
/** @type {?} */
Configuration.prototype.basePath;
/** @type {?} */
Configuration.prototype.withCredentials;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B3YS1tb3RpZi1vcGVuLWFwaS9saWNlbnNlLW1hbmFnZW1lbnQtc2VydmljZS8iLCJzb3VyY2VzIjpbImxpYi9jb25maWd1cmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQSw2Q0FPQzs7O0lBTkcsMENBQW9DOztJQUNwQywyQ0FBa0I7O0lBQ2xCLDJDQUFrQjs7SUFDbEIsOENBQXNDOztJQUN0QywyQ0FBa0I7O0lBQ2xCLGtEQUEwQjs7QUFHOUIsTUFBTSxPQUFPLGFBQWE7Ozs7SUFRdEIsWUFBWSwwQkFBbUQsRUFBRTtRQUM3RCxJQUFJLENBQUMsT0FBTyxHQUFHLHVCQUF1QixDQUFDLE9BQU8sQ0FBQztRQUMvQyxJQUFJLENBQUMsUUFBUSxHQUFHLHVCQUF1QixDQUFDLFFBQVEsQ0FBQztRQUNqRCxJQUFJLENBQUMsUUFBUSxHQUFHLHVCQUF1QixDQUFDLFFBQVEsQ0FBQztRQUNqRCxJQUFJLENBQUMsV0FBVyxHQUFHLHVCQUF1QixD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