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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B3YS1tb3RpZi1vcGVuLWFwaS9pbmZvLXNlcnZpY2UvIiwic291cmNlcyI6WyJsaWIvY29uZmlndXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUEsNkNBT0M7OztJQU5HLDBDQUFvQzs7SUFDcEMsMkNBQWtCOztJQUNsQiwyQ0FBa0I7O0lBQ2xCLDhDQUFzQzs7SUFDdEMsMkNBQWtCOztJQUNsQixrREFBMEI7O0FBRzlCLE1BQU0sT0FBTyxhQUFhOzs7O0lBUXRCLFlBQVksMEJBQW1ELEVBQUU7UUFDN0QsSUFBSSxDQUFDLE9BQU8sR0FBRyx1QkFBdUIsQ0FBQyxPQUFPLENBQUM7UUFDL0MsSUFBSSxDQUFDLFFBQVEsR0FBRyx1QkFBdUIsQ0FBQyxRQUFRLENBQUM7UUFDakQsSUFBSSxDQUFDLFFBQVEsR0FBRyx1QkFBdUIsQ0FBQyxRQUFRLENBQUM7UUFDakQsSUFBSSxDQUFDLFdBQVcsR0FBRyx1QkFBdUIsQ0FBQyxXQUFXLENBQUM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